Cannot reset font size for help when shown in side pane.

Task-number: QTCREATORBUG-2924
Reviewed-by: ck
This commit is contained in:
kh1
2010-11-16 14:16:48 +01:00
parent 0985f9c1c4
commit da84000313
2 changed files with 48 additions and 16 deletions

View File

@@ -267,23 +267,18 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
action = new QAction(tr("Increase Font Size"), this); action = new QAction(tr("Increase Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE,
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl++")));
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomIn())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomIn()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Decrease Font Size"), this); action = new QAction(tr("Decrease Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE,
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+-")));
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomOut())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomOut()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Reset Font Size"), this); action = new QAction(tr("Reset Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE,
modecontext); modecontext);
#ifndef Q_WS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
#endif
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
} }
@@ -305,14 +300,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE); windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(),
SLOT(gotoNextPage())); SLOT(gotoNextPage()));
#ifdef Q_WS_MAC
ctrlTab->setDefaultKeySequence(QKeySequence(tr("Alt+Tab")));
ctrlShiftTab->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+Tab")));
#else
ctrlTab->setDefaultKeySequence(QKeySequence(tr("Ctrl+Tab")));
ctrlShiftTab->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Tab")));
#endif
} }
Aggregation::Aggregate *agg = new Aggregation::Aggregate; Aggregation::Aggregate *agg = new Aggregation::Aggregate;
@@ -583,15 +570,16 @@ void HelpPlugin::createRightPaneContextViewer()
Aggregation::Aggregate *agg = new Aggregation::Aggregate(); Aggregation::Aggregate *agg = new Aggregation::Aggregate();
agg->add(m_helpViewerForSideBar); agg->add(m_helpViewerForSideBar);
agg->add(new HelpViewerFindSupport(m_helpViewerForSideBar)); agg->add(new HelpViewerFindSupport(m_helpViewerForSideBar));
Core::Context context(Constants::C_HELP_SIDEBAR);
m_core->addContextObject(new Core::BaseContext(m_helpViewerForSideBar, m_core->addContextObject(new Core::BaseContext(m_helpViewerForSideBar,
Core::Context(Constants::C_HELP_SIDEBAR), this)); context, this));
QAction *copy = new QAction(this); QAction *copy = new QAction(this);
Core::Command *cmd = m_core->actionManager()->registerAction(copy, Core::Command *cmd = m_core->actionManager()->registerAction(copy,
Core::Constants::COPY, Core::Context(Constants::C_HELP_SIDEBAR)); Core::Constants::COPY, context);
copy->setText(cmd->action()->text()); copy->setText(cmd->action()->text());
copy->setIcon(cmd->action()->icon()); copy->setIcon(cmd->action()->icon());
connect(copy, SIGNAL(triggered()), m_helpViewerForSideBar, SLOT(copy())); connect(copy, SIGNAL(triggered()), m_helpViewerForSideBar, SLOT(copy()));
next->setEnabled(m_helpViewerForSideBar->isForwardAvailable()); next->setEnabled(m_helpViewerForSideBar->isForwardAvailable());
@@ -604,11 +592,51 @@ void HelpPlugin::createRightPaneContextViewer()
connect(m_helpViewerForSideBar, SIGNAL(backwardAvailable(bool)), back, connect(m_helpViewerForSideBar, SIGNAL(backwardAvailable(bool)), back,
SLOT(setEnabled(bool))); SLOT(setEnabled(bool)));
Core::ActionManager *am = m_core->actionManager();
if (Core::ActionContainer *advancedMenu = am->actionContainer(M_EDIT_ADVANCED)) {
// reuse TextEditor constants to avoid a second pair of menu actions
QAction *action = new QAction(tr("Increase Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE,
context);
connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneUp()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Decrease Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE,
context);
connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneDown()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Reset Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE,
context);
connect(action, SIGNAL(triggered()), this, SLOT(resetRightPaneScale()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
}
// force setup, as we might have never switched to full help mode // force setup, as we might have never switched to full help mode
// thus the help engine might still run without collection file setup // thus the help engine might still run without collection file setup
m_helpManager->setupGuiHelpEngine(); m_helpManager->setupGuiHelpEngine();
} }
void HelpPlugin::scaleRightPaneUp()
{
if (m_helpViewerForSideBar)
m_helpViewerForSideBar->scaleUp();
}
void HelpPlugin::scaleRightPaneDown()
{
if (m_helpViewerForSideBar)
m_helpViewerForSideBar->scaleDown();
}
void HelpPlugin::resetRightPaneScale()
{
if (m_helpViewerForSideBar)
m_helpViewerForSideBar->resetScale();
}
void HelpPlugin::activateHelpMode() void HelpPlugin::activateHelpMode()
{ {
if (contextHelpOption() != Help::Constants::ExternalHelpAlways) if (contextHelpOption() != Help::Constants::ExternalHelpAlways)

View File

@@ -115,6 +115,10 @@ private slots:
void openFindToolBar(); void openFindToolBar();
void scaleRightPaneUp();
void scaleRightPaneDown();
void resetRightPaneScale();
private: private:
void setupUi(); void setupUi();
void resetFilter(); void resetFilter();