Commit d01adc13 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Help: Use Qt5-style connects

The heavy lifting was done by clazy.

Change-Id: Ied9c7fcc031e530c41b342de950e2f0ac730bbb1
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 700239c6
...@@ -50,14 +50,12 @@ public: ...@@ -50,14 +50,12 @@ public:
void apply(); void apply();
void finish(); void finish();
private slots: private:
void addDocumentation(); void addDocumentation();
private:
bool eventFilter(QObject *object, QEvent *event); bool eventFilter(QObject *object, QEvent *event);
void removeDocumentation(const QList<QModelIndex> &items); void removeDocumentation(const QList<QModelIndex> &items);
private:
QList<QModelIndex> currentSelection() const; QList<QModelIndex> currentSelection() const;
Ui::DocSettingsPage m_ui; Ui::DocSettingsPage m_ui;
......
...@@ -63,8 +63,8 @@ QWidget *FilterSettingsPage::widget() ...@@ -63,8 +63,8 @@ QWidget *FilterSettingsPage::widget()
this, &FilterSettingsPage::addFilter); this, &FilterSettingsPage::addFilter);
connect(m_ui.filterRemoveButton, &QPushButton::clicked, connect(m_ui.filterRemoveButton, &QPushButton::clicked,
this, &FilterSettingsPage::removeFilter); this, &FilterSettingsPage::removeFilter);
connect(HelpManager::instance(), SIGNAL(documentationChanged()), connect(HelpManager::instance(), &HelpManager::documentationChanged,
this, SLOT(updateFilterPage())); this, &FilterSettingsPage::updateFilterPage);
} }
return m_widget; return m_widget;
} }
...@@ -221,8 +221,8 @@ void FilterSettingsPage::apply() ...@@ -221,8 +221,8 @@ void FilterSettingsPage::apply()
void FilterSettingsPage::finish() void FilterSettingsPage::finish()
{ {
disconnect(HelpManager::instance(), SIGNAL(documentationChanged()), disconnect(HelpManager::instance(), &HelpManager::documentationChanged,
this, SLOT(updateFilterPage())); this, &FilterSettingsPage::updateFilterPage);
delete m_widget; delete m_widget;
} }
......
...@@ -47,18 +47,15 @@ public: ...@@ -47,18 +47,15 @@ public:
signals: signals:
void filtersChanged(); void filtersChanged();
private slots: private:
void updateAttributes(QListWidgetItem *item); void updateAttributes(QListWidgetItem *item);
void updateFilterMap(); void updateFilterMap();
void updateFilterPage(); void updateFilterPage();
void addFilter(); void addFilter();
void removeFilter(); void removeFilter();
private:
void updateFilterDescription(const QString &filter); void updateFilterDescription(const QString &filter);
private:
QString msgFilterLabel(const QString &filter) const; QString msgFilterLabel(const QString &filter) const;
Ui::FilterSettingsPage m_ui; Ui::FilterSettingsPage m_ui;
QPointer<QWidget> m_widget; QPointer<QWidget> m_widget;
......
...@@ -49,20 +49,18 @@ public: ...@@ -49,20 +49,18 @@ public:
signals: signals:
void fontChanged(); void fontChanged();
private slots: private:
void setCurrentPage(); void setCurrentPage();
void setBlankPage(); void setBlankPage();
void setDefaultPage(); void setDefaultPage();
void importBookmarks(); void importBookmarks();
void exportBookmarks(); void exportBookmarks();
private:
void updateFontSize(); void updateFontSize();
void updateFontStyle(); void updateFontStyle();
void updateFontFamily(); void updateFontFamily();
int closestPointSizeIndex(int desiredPointSize) const; int closestPointSizeIndex(int desiredPointSize) const;
private:
QFont m_font; QFont m_font;
QFontDatabase m_fontDatabase; QFontDatabase m_fontDatabase;
......
...@@ -151,24 +151,24 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -151,24 +151,24 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(m_searchTaskHandler = new SearchTaskHandler); addAutoReleasedObject(m_searchTaskHandler = new SearchTaskHandler);
m_centralWidget = new CentralWidget(Context("Help.CentralHelpWidget")); m_centralWidget = new CentralWidget(Context("Help.CentralHelpWidget"));
connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, connect(m_centralWidget, &HelpWidget::sourceChanged, this,
SLOT(updateSideBarSource(QUrl))); &HelpPlugin::updateSideBarSource);
connect(m_centralWidget, &CentralWidget::closeButtonClicked, connect(m_centralWidget, &CentralWidget::closeButtonClicked,
&OpenPagesManager::instance(), &OpenPagesManager::closeCurrentPage); &OpenPagesManager::instance(), &OpenPagesManager::closeCurrentPage);
connect(LocalHelpManager::instance(), &LocalHelpManager::returnOnCloseChanged, connect(LocalHelpManager::instance(), &LocalHelpManager::returnOnCloseChanged,
m_centralWidget, &CentralWidget::updateCloseButton); m_centralWidget, &CentralWidget::updateCloseButton);
connect(HelpManager::instance(), SIGNAL(helpRequested(QUrl,Core::HelpManager::HelpViewerLocation)), connect(HelpManager::instance(), &HelpManager::helpRequested,
this, SLOT(handleHelpRequest(QUrl,Core::HelpManager::HelpViewerLocation))); this, &HelpPlugin::handleHelpRequest);
connect(m_searchTaskHandler, SIGNAL(search(QUrl)), this, connect(m_searchTaskHandler, &SearchTaskHandler::search, this,
SLOT(showLinkInHelpMode(QUrl))); &HelpPlugin::showLinkInHelpMode);
connect(m_filterSettingsPage, SIGNAL(filtersChanged()), this, connect(m_filterSettingsPage, &FilterSettingsPage::filtersChanged, this,
SLOT(setupHelpEngineIfNeeded())); &HelpPlugin::setupHelpEngineIfNeeded);
connect(HelpManager::instance(), SIGNAL(documentationChanged()), this, connect(HelpManager::instance(), &HelpManager::documentationChanged, this,
SLOT(setupHelpEngineIfNeeded())); &HelpPlugin::setupHelpEngineIfNeeded);
connect(HelpManager::instance(), SIGNAL(collectionFileChanged()), this, connect(HelpManager::instance(), &HelpManager::collectionFileChanged, this,
SLOT(setupHelpEngineIfNeeded())); &HelpPlugin::setupHelpEngineIfNeeded);
connect(ToolTip::instance(), &ToolTip::shown, ICore::instance(), []() { connect(ToolTip::instance(), &ToolTip::shown, ICore::instance(), []() {
ICore::addAdditionalContext(Context(kToolTipHelpContext), ICore::ContextPriority::High); ICore::addAdditionalContext(Context(kToolTipHelpContext), ICore::ContextPriority::High);
...@@ -185,29 +185,29 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -185,29 +185,29 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
tr(Constants::SB_CONTENTS), this); tr(Constants::SB_CONTENTS), this);
cmd = ActionManager::registerAction(action, "Help.ContentsMenu"); cmd = ActionManager::registerAction(action, "Help.ContentsMenu");
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(activateContents())); connect(action, &QAction::triggered, this, &HelpPlugin::activateContents);
action = new QAction(tr(Constants::SB_INDEX), this); action = new QAction(tr(Constants::SB_INDEX), this);
cmd = ActionManager::registerAction(action, "Help.IndexMenu"); cmd = ActionManager::registerAction(action, "Help.IndexMenu");
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(activateIndex())); connect(action, &QAction::triggered, this, &HelpPlugin::activateIndex);
action = new QAction(tr("Context Help"), this); action = new QAction(tr("Context Help"), this);
cmd = ActionManager::registerAction(action, Help::Constants::CONTEXT_HELP, cmd = ActionManager::registerAction(action, Help::Constants::CONTEXT_HELP,
Context(kToolTipHelpContext, Core::Constants::C_GLOBAL)); Context(kToolTipHelpContext, Core::Constants::C_GLOBAL));
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
connect(action, SIGNAL(triggered()), this, SLOT(showContextHelp())); connect(action, &QAction::triggered, this, &HelpPlugin::showContextHelp);
action = new QAction(tr("Technical Support"), this); action = new QAction(tr("Technical Support"), this);
cmd = ActionManager::registerAction(action, "Help.TechSupport"); cmd = ActionManager::registerAction(action, "Help.TechSupport");
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
connect(action, SIGNAL(triggered()), this, SLOT(slotOpenSupportPage())); connect(action, &QAction::triggered, this, &HelpPlugin::slotOpenSupportPage);
action = new QAction(tr("Report Bug..."), this); action = new QAction(tr("Report Bug..."), this);
cmd = ActionManager::registerAction(action, "Help.ReportBug"); cmd = ActionManager::registerAction(action, "Help.ReportBug");
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug())); connect(action, &QAction::triggered, this, &HelpPlugin::slotReportBug);
if (ActionContainer *windowMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW)) { if (ActionContainer *windowMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW)) {
// reuse EditorManager constants to avoid a second pair of menu actions // reuse EditorManager constants to avoid a second pair of menu actions
...@@ -216,16 +216,16 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -216,16 +216,16 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
Command *ctrlTab = ActionManager::registerAction(action, Core::Constants::GOTOPREVINHISTORY, Command *ctrlTab = ActionManager::registerAction(action, Core::Constants::GOTOPREVINHISTORY,
modecontext); modecontext);
windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE); windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), connect(action, &QAction::triggered, &OpenPagesManager::instance(),
SLOT(gotoPreviousPage())); &OpenPagesManager::gotoPreviousPage);
// Goto Next In History Action // Goto Next In History Action
action = new QAction(this); action = new QAction(this);
Command *ctrlShiftTab = ActionManager::registerAction(action, Core::Constants::GOTONEXTINHISTORY, Command *ctrlShiftTab = ActionManager::registerAction(action, Core::Constants::GOTONEXTINHISTORY,
modecontext); modecontext);
windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE); windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), connect(action, &QAction::triggered, &OpenPagesManager::instance(),
SLOT(gotoNextPage())); &OpenPagesManager::gotoNextPage);
} }
auto helpIndexFilter = new HelpIndexFilter(); auto helpIndexFilter = new HelpIndexFilter();
...@@ -237,8 +237,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) ...@@ -237,8 +237,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
RemoteHelpFilter *remoteHelpFilter = new RemoteHelpFilter(); RemoteHelpFilter *remoteHelpFilter = new RemoteHelpFilter();
addAutoReleasedObject(remoteHelpFilter); addAutoReleasedObject(remoteHelpFilter);
connect(remoteHelpFilter, SIGNAL(linkActivated(QUrl)), this, connect(remoteHelpFilter, &RemoteHelpFilter::linkActivated, this,
SLOT(showLinkInHelpMode(QUrl))); &HelpPlugin::showLinkInHelpMode);
QDesktopServices::setUrlHandler(QLatin1String("qthelp"), HelpManager::instance(), "handleHelpRequest"); QDesktopServices::setUrlHandler(QLatin1String("qthelp"), HelpManager::instance(), "handleHelpRequest");
connect(ModeManager::instance(), &ModeManager::currentModeChanged, connect(ModeManager::instance(), &ModeManager::currentModeChanged,
...@@ -318,14 +318,14 @@ HelpWidget *HelpPlugin::createHelpWidget(const Context &context, HelpWidget::Wid ...@@ -318,14 +318,14 @@ HelpWidget *HelpPlugin::createHelpWidget(const Context &context, HelpWidget::Wid
{ {
HelpWidget *widget = new HelpWidget(context, style); HelpWidget *widget = new HelpWidget(context, style);
connect(widget->currentViewer(), SIGNAL(loadFinished()), connect(widget->currentViewer(), &HelpViewer::loadFinished,
this, SLOT(highlightSearchTermsInContextHelp())); this, &HelpPlugin::highlightSearchTermsInContextHelp);
connect(widget, SIGNAL(openHelpMode(QUrl)), connect(widget, &HelpWidget::openHelpMode,
this, SLOT(showLinkInHelpMode(QUrl))); this, &HelpPlugin::showLinkInHelpMode);
connect(widget, SIGNAL(closeButtonClicked()), connect(widget, &HelpWidget::closeButtonClicked,
this, SLOT(slotHideRightPane())); this, &HelpPlugin::slotHideRightPane);
connect(widget, SIGNAL(aboutToClose()), connect(widget, &HelpWidget::aboutToClose,
this, SLOT(saveExternalWindowSettings())); this, &HelpPlugin::saveExternalWindowSettings);
// 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
...@@ -455,15 +455,6 @@ void HelpPlugin::modeChanged(Core::Id mode, Core::Id old) ...@@ -455,15 +455,6 @@ void HelpPlugin::modeChanged(Core::Id mode, Core::Id old)
} }
} }
void HelpPlugin::updateSideBarSource()
{
if (HelpViewer *viewer = m_centralWidget->currentViewer()) {
const QUrl &url = viewer->source();
if (url.isValid())
updateSideBarSource(url);
}
}
void HelpPlugin::updateSideBarSource(const QUrl &newUrl) void HelpPlugin::updateSideBarSource(const QUrl &newUrl)
{ {
if (m_rightPaneSideBarWidget) { if (m_rightPaneSideBarWidget) {
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
static HelpViewer *createHelpViewer(qreal zoom); static HelpViewer *createHelpViewer(qreal zoom);
private slots: private:
void modeChanged(Core::Id mode, Core::Id old); void modeChanged(Core::Id mode, Core::Id old);
void showContextHelp(); void showContextHelp();
...@@ -89,7 +89,6 @@ private slots: ...@@ -89,7 +89,6 @@ private slots:
void showLinksInHelpMode(const QMap<QString, QUrl> &links, const QString &key); void showLinksInHelpMode(const QMap<QString, QUrl> &links, const QString &key);
void slotHideRightPane(); void slotHideRightPane();
void updateSideBarSource();
void updateSideBarSource(const QUrl &newUrl); void updateSideBarSource(const QUrl &newUrl);
void setupHelpEngineIfNeeded(); void setupHelpEngineIfNeeded();
...@@ -100,7 +99,6 @@ private slots: ...@@ -100,7 +99,6 @@ private slots:
void slotOpenSupportPage(); void slotOpenSupportPage();
void slotReportBug(); void slotReportBug();
private:
void resetFilter(); void resetFilter();
void activateHelpMode(); void activateHelpMode();
bool canShowHelpSideBySide() const; bool canShowHelpSideBySide() const;
...@@ -112,7 +110,6 @@ private: ...@@ -112,7 +110,6 @@ private:
void doSetupIfNeeded(); void doSetupIfNeeded();
private:
HelpMode *m_mode; HelpMode *m_mode;
CentralWidget *m_centralWidget; CentralWidget *m_centralWidget;
HelpWidget *m_rightPaneSideBarWidget; HelpWidget *m_rightPaneSideBarWidget;
......
...@@ -77,7 +77,6 @@ public: ...@@ -77,7 +77,6 @@ public:
static QString mimeFromUrl(const QUrl &url); static QString mimeFromUrl(const QUrl &url);
static bool launchWithExternalApp(const QUrl &url); static bool launchWithExternalApp(const QUrl &url);
public slots:
void home(); void home();
virtual void scaleUp() = 0; virtual void scaleUp() = 0;
...@@ -97,7 +96,7 @@ signals: ...@@ -97,7 +96,7 @@ signals:
void backwardAvailable(bool); void backwardAvailable(bool);
void loadFinished(); void loadFinished();
protected slots: protected:
void slotLoadStarted(); void slotLoadStarted();
void slotLoadFinished(); void slotLoadFinished();
}; };
......
...@@ -246,7 +246,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget ...@@ -246,7 +246,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
if (style != ExternalWindow) { if (style != ExternalWindow) {
m_closeAction = new QAction(Core::Icons::CLOSE_TOOLBAR.icon(), QString(), toolBar); m_closeAction = new QAction(Core::Icons::CLOSE_TOOLBAR.icon(), QString(), toolBar);
connect(m_closeAction, SIGNAL(triggered()), this, SIGNAL(closeButtonClicked())); connect(m_closeAction, &QAction::triggered, this, &HelpWidget::closeButtonClicked);
button = new QToolButton; button = new QToolButton;
button->setDefaultAction(m_closeAction); button->setDefaultAction(m_closeAction);
layout->addWidget(button); layout->addWidget(button);
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
bool newPage = false); bool newPage = false);
void activateSideBarItem(const QString &id); void activateSideBarItem(const QString &id);
public slots: public:
void setSource(const QUrl &url); void setSource(const QUrl &url);
void updateCloseButton(); void updateCloseButton();
...@@ -92,13 +92,12 @@ signals: ...@@ -92,13 +92,12 @@ signals:
void sourceChanged(const QUrl &url); void sourceChanged(const QUrl &url);
void filterActivated(const QString &name); void filterActivated(const QString &name);
private slots: private:
void updateBackMenu(); void updateBackMenu();
void updateForwardMenu(); void updateForwardMenu();
void updateWindowTitle(); void updateWindowTitle();
void helpModeButtonClicked(); void helpModeButtonClicked();
private:
void goHome(); void goHome();
void addBookmark(); void addBookmark();
void copy(); void copy();
......
...@@ -47,7 +47,7 @@ class MacResponderHack : public QObject ...@@ -47,7 +47,7 @@ class MacResponderHack : public QObject
public: public:
MacResponderHack(QObject *parent); MacResponderHack(QObject *parent);
private slots: private:
void responderHack(QWidget *old, QWidget *now); void responderHack(QWidget *old, QWidget *now);
}; };
...@@ -109,7 +109,7 @@ public: ...@@ -109,7 +109,7 @@ public:
MacWebKitHelpWidget *widget() const { return m_widget; } MacWebKitHelpWidget *widget() const { return m_widget; }
public slots: public:
void scaleUp(); void scaleUp();
void scaleDown(); void scaleDown();
void resetScale(); void resetScale();
...@@ -119,14 +119,12 @@ public slots: ...@@ -119,14 +119,12 @@ public slots:
void backward(); void backward();
void print(QPrinter *printer); void print(QPrinter *printer);
public slots:
void slotLoadStarted(); void slotLoadStarted();
void slotLoadFinished(); void slotLoadFinished();
private slots: private:
void goToHistoryItem(); void goToHistoryItem();
private:
DOMRange *findText(NSString *text, bool forward, bool caseSensitive, DOMNode *startNode, DOMRange *findText(NSString *text, bool forward, bool caseSensitive, DOMNode *startNode,
int startOffset); int startOffset);
MacWebKitHelpWidget *m_widget; MacWebKitHelpWidget *m_widget;
......
...@@ -657,7 +657,7 @@ void MacWebKitHelpViewer::addBackHistoryItems(QMenu *backMenu) ...@@ -657,7 +657,7 @@ void MacWebKitHelpViewer::addBackHistoryItems(QMenu *backMenu)
QAction *action = new QAction(backMenu); QAction *action = new QAction(backMenu);
action->setText(QString::fromNSString([list itemAtIndex:historyIndex].title)); action->setText(QString::fromNSString([list itemAtIndex:historyIndex].title));
action->setData(historyIndex); action->setData(historyIndex);
connect(action, SIGNAL(triggered()), this, SLOT(goToHistoryItem())); connect(action, &QAction::triggered, this, &MacWebKitHelpViewer::goToHistoryItem);
backMenu->addAction(action); backMenu->addAction(action);
} }
} }
...@@ -673,7 +673,7 @@ void MacWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu) ...@@ -673,7 +673,7 @@ void MacWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
QAction *action = new QAction(forwardMenu); QAction *action = new QAction(forwardMenu);
action->setText(QString::fromNSString([list itemAtIndex:historyIndex].title)); action->setText(QString::fromNSString([list itemAtIndex:historyIndex].title));
action->setData(historyIndex); action->setData(historyIndex);
connect(action, SIGNAL(triggered()), this, SLOT(goToHistoryItem())); connect(action, &QAction::triggered, this, &MacWebKitHelpViewer::goToHistoryItem);
forwardMenu->addAction(action); forwardMenu->addAction(action);
} }
} }
...@@ -878,8 +878,8 @@ void MacWebKitHelpViewer::goToHistoryItem() ...@@ -878,8 +878,8 @@ void MacWebKitHelpViewer::goToHistoryItem()
MacResponderHack::MacResponderHack(QObject *parent) MacResponderHack::MacResponderHack(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), connect(qApp, &QApplication::focusChanged,
this, SLOT(responderHack(QWidget*,QWidget*))); this, &MacResponderHack::responderHack);
} }
void MacResponderHack::responderHack(QWidget *old, QWidget *now) void MacResponderHack::responderHack(QWidget *old, QWidget *now)
......
...@@ -65,15 +65,16 @@ OpenPagesManager::OpenPagesManager(QObject *parent) ...@@ -65,15 +65,16 @@ OpenPagesManager::OpenPagesManager(QObject *parent)
m_comboBox = new QComboBox; m_comboBox = new QComboBox;
m_comboBox->setModel(m_model); m_comboBox->setModel(m_model);
m_comboBox->setContextMenuPolicy(Qt::CustomContextMenu); m_comboBox->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_comboBox, SIGNAL(activated(int)), this, SLOT(setCurrentPage(int))); connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
connect(m_comboBox, SIGNAL(customContextMenuRequested(QPoint)), this, this, &OpenPagesManager::setCurrentPageByRow);
SLOT(openPagesContextMenu(QPoint))); connect(m_comboBox, &QWidget::customContextMenuRequested, this,
&OpenPagesManager::openPagesContextMenu);
m_openPagesSwitcher = new OpenPagesSwitcher(m_model); m_openPagesSwitcher = new OpenPagesSwitcher(m_model);
connect(m_openPagesSwitcher, SIGNAL(closePage(QModelIndex)), this, connect(m_openPagesSwitcher, &OpenPagesSwitcher::closePage, this,
SLOT(closePage(QModelIndex))); &OpenPagesManager::closePage);
connect(m_openPagesSwitcher, SIGNAL(setCurrentPage(QModelIndex)), this, connect(m_openPagesSwitcher, &OpenPagesSwitcher::setCurrentPage,
SLOT(setCurrentPage(QModelIndex))); this, &OpenPagesManager::setCurrentPage);
} }
OpenPagesManager ::~OpenPagesManager() OpenPagesManager ::~OpenPagesManager()
...@@ -92,12 +93,12 @@ QWidget *OpenPagesManager::openPagesWidget() const ...@@ -92,12 +93,12 @@ QWidget *OpenPagesManager::openPagesWidget() const
{ {
if (!m_openPagesWidget) { if (!m_openPagesWidget) {
m_openPagesWidget = new OpenPagesWidget(m_model); m_openPagesWidget = new OpenPagesWidget(m_model);
connect(m_openPagesWidget, SIGNAL(setCurrentPage(QModelIndex)), this, connect(m_openPagesWidget, &OpenPagesWidget::setCurrentPage,
SLOT(setCurrentPage(QModelIndex))); this, &OpenPagesManager::setCurrentPage);
connect(m_openPagesWidget, SIGNAL(closePage(QModelIndex)), this, connect(m_openPagesWidget, &OpenPagesWidget::closePage,
SLOT(closePage(QModelIndex))); this, &OpenPagesManager::closePage);
connect(m_openPagesWidget, SIGNAL(closePagesExcept(QModelIndex)), this, connect(m_openPagesWidget, &OpenPagesWidget::closePagesExcept,
SLOT(closePagesExcept(QModelIndex))); this, &OpenPagesManager::closePagesExcept);
} }
return m_openPagesWidget; return m_openPagesWidget;
} }
...@@ -166,13 +167,11 @@ void OpenPagesManager::setupInitialPages() ...@@ -166,13 +167,11 @@ void OpenPagesManager::setupInitialPages()
CentralWidget::instance()->addViewer(m_model->pageAt(i)); CentralWidget::instance()->addViewer(m_model->pageAt(i));
emit pagesChanged(); emit pagesChanged();
setCurrentPage((initialPage >= m_model->rowCount()) setCurrentPageByRow((initialPage >= m_model->rowCount())
? m_model->rowCount() - 1 : initialPage); ? m_model->rowCount() - 1 : initialPage);
m_openPagesSwitcher->selectCurrentPage(); m_openPagesSwitcher->selectCurrentPage();
} }
// -- public slots
HelpViewer *OpenPagesManager::createPage() HelpViewer *OpenPagesManager::createPage()
{ {
return createPage(QUrl(Help::Constants::AboutBlank)); return createPage(QUrl(Help::Constants::AboutBlank));
...@@ -190,12 +189,12 @@ HelpViewer *OpenPagesManager::createPage(const QUrl &url) ...@@ -190,12 +189,12 @@ HelpViewer *OpenPagesManager::createPage(const QUrl &url)
CentralWidget::instance()->addViewer(page); CentralWidget::instance()->addViewer(page);
emit pagesChanged(); emit pagesChanged();
setCurrentPage(index); setCurrentPageByRow(index);
return page; return page;
} }
void OpenPagesManager::setCurrentPage(int index) void OpenPagesManager::setCurrentPageByRow(int index)
{ {
CentralWidget::instance()->setCurrentViewer(m_model->pageAt(index)); CentralWidget::instance()->setCurrentViewer(m_model->pageAt(index));
...@@ -207,7 +206,7 @@ void OpenPagesManager::setCurrentPage(int index) ...@@ -207,7 +206,7 @@ void OpenPagesManager::setCurrentPage(int index)
void OpenPagesManager::setCurrentPage(const QModelIndex &index) void OpenPagesManager::setCurrentPage(const QModelIndex &index)
{ {
if (index.isValid()) if (index.isValid())
setCurrentPage(index.row()); setCurrentPageByRow(index.row());
} }
void OpenPagesManager::closeCurrentPage() void OpenPagesManager::closeCurrentPage()
...@@ -299,8 +298,6 @@ void OpenPagesManager::showTwicherOrSelectPage() const ...@@ -299,8 +298,6 @@ void OpenPagesManager::showTwicherOrSelectPage() const
} }
} }
// -- private slots
void OpenPagesManager::openPagesContextMenu(const QPoint &point) void OpenPagesManager::openPagesContextMenu(const QPoint &point)
{ {
const QModelIndex &index = m_model->index(m_comboBox->currentIndex(), 0); const QModelIndex &index = m_model->index(m_comboBox->currentIndex(), 0);
......
...@@ -58,11 +58,10 @@ public: ...@@ -58,11 +58,10 @@ public:
int pageCount() const; int pageCount() const;
void setupInitialPages(); void setupInitialPages();
public slots:
HelpViewer *createPage(); HelpViewer *createPage();
HelpViewer *createPage(const QUrl &url); HelpViewer *createPage(const QUrl &url);