X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=b4461305c0077a038a9b495e44151eef5949fde3;hp=b5de36ab011aa83a13717632a98ebb4c625744b1;hb=4e51500401db3c85dbe5e92e5e5c15b6e3c87787;hpb=4a5f59de4b332d16ff8942051e29d9354b5bbac3 diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index b5de36ab..b4461305 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2019 by the Quassel Project * + * Copyright (C) 2005-2020 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -91,6 +91,7 @@ #include "resourcetreedlg.h" #include "settingsdlg.h" #include "settingspagedlg.h" +#include "sslinfodlg.h" #include "statusnotifieritem.h" #include "toolbaractionprovider.h" #include "topicwidget.h" @@ -112,10 +113,6 @@ # include "snorenotificationbackend.h" #endif -#ifdef HAVE_SSL -# include "sslinfodlg.h" -#endif - #ifdef HAVE_NOTIFICATION_CENTER # include "osxnotificationbackend.h" #endif @@ -124,8 +121,6 @@ # include "dockmanagernotificationbackend.h" #endif -#include - #include "settingspages/aliasessettingspage.h" #include "settingspages/appearancesettingspage.h" #include "settingspages/backlogsettingspage.h" @@ -136,6 +131,7 @@ #include "settingspages/connectionsettingspage.h" #include "settingspages/coreaccountsettingspage.h" #include "settingspages/coreconnectionsettingspage.h" +#include "settingspages/corehighlightsettingspage.h" #include "settingspages/dccsettingspage.h" #include "settingspages/highlightsettingspage.h" #include "settingspages/identitiessettingspage.h" @@ -202,9 +198,7 @@ void MainWin::init() connect(Client::coreConnection(), &CoreConnection::userAuthenticationRequired, this, &MainWin::userAuthenticationRequired); connect(Client::coreConnection(), &CoreConnection::handleNoSslInClient, this, &MainWin::handleNoSslInClient); connect(Client::coreConnection(), &CoreConnection::handleNoSslInCore, this, &MainWin::handleNoSslInCore); -#ifdef HAVE_SSL connect(Client::coreConnection(), &CoreConnection::handleSslErrors, this, &MainWin::handleSslErrors); -#endif // Setup Dock Areas setDockNestingEnabled(true); @@ -413,7 +407,7 @@ void MainWin::setupActions() // Help coll->addAction("AboutQuassel", new Action(icon::get("quassel"), tr("&About Quassel"), coll, this, &MainWin::showAboutDlg)) ->setMenuRole(QAction::AboutRole); - coll->addAction("AboutQt", new Action(QIcon(":/pics/qt-logo.png"), tr("About &Qt"), coll, qApp, &QApplication::aboutQt)) + coll->addAction("AboutQt", new Action(QIcon(":/pics/qt-logo-32.png"), tr("About &Qt"), coll, qApp, &QApplication::aboutQt)) ->setMenuRole(QAction::AboutQtRole); coll->addActions( {{"DebugNetworkModel", @@ -472,7 +466,14 @@ void MainWin::setupActions() coll, this, &MainWin::onFormatUnderlineTriggered, - QKeySequence::Underline)}}); + QKeySequence::Underline)}, + {"FormatStrikethrough", + new Action(icon::get("format-text-strikethrough"), + tr("Toggle strikethrough"), + coll, + this, + &MainWin::onFormatStrikethroughTriggered, + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S))}}); // Navigation coll = QtUi::actionCollection("Navigation", tr("Navigation")); @@ -808,7 +809,7 @@ void MainWin::changeActiveBufferView(int bufferViewId) void MainWin::showPasswordChangeDlg() { if (Client::isCoreFeatureEnabled(Quassel::Feature::PasswordChange)) { - PasswordChangeDlg{}.exec(); + PasswordChangeDlg{this}.exec(); } else { QMessageBox box(QMessageBox::Warning, @@ -917,17 +918,17 @@ void MainWin::hideCurrentBuffer() void MainWin::showNotificationsDlg() { - SettingsPageDlg{new NotificationsSettingsPage{}}.exec(); + SettingsPageDlg{new NotificationsSettingsPage{}, this}.exec(); } void MainWin::onConfigureNetworksTriggered() { - SettingsPageDlg{new NetworksSettingsPage{}}.exec(); + SettingsPageDlg{new NetworksSettingsPage{}, this}.exec(); } void MainWin::onConfigureViewsTriggered() { - SettingsPageDlg{new BufferViewSettingsPage{}}.exec(); + SettingsPageDlg{new BufferViewSettingsPage{}, this}.exec(); } void MainWin::onLockLayoutToggled(bool lock) @@ -1195,7 +1196,8 @@ void MainWin::saveMainToolBarStatus(bool enabled) void MainWin::doAutoConnect() { - if (!Client::coreConnection()->connectToCore()) { + int accountId = Quassel::optionValue("account").toInt(); + if (!Client::coreConnection()->connectToCore(accountId)) { // No autoconnect selected (or no accounts) showCoreConnectionDlg(); } @@ -1353,7 +1355,7 @@ void MainWin::setDisconnectedState() void MainWin::userAuthenticationRequired(CoreAccount* account, bool* valid, const QString& errorMessage) { Q_UNUSED(errorMessage) - CoreConnectAuthDlg dlg(account); + CoreConnectAuthDlg dlg(account, this); *valid = (dlg.exec() == QDialog::Accepted); } @@ -1379,13 +1381,17 @@ void MainWin::handleNoSslInCore(bool* accepted) *accepted = (box.exec() == QMessageBox::Ignore); } -#ifdef HAVE_SSL - void MainWin::handleSslErrors(const QSslSocket* socket, bool* accepted, bool* permanently) { QString errorString = ""; QMessageBox box(QMessageBox::Warning, @@ -1401,7 +1407,7 @@ void MainWin::handleSslErrors(const QSslSocket* socket, bool* accepted, bool* pe box.exec(); role = box.buttonRole(box.clickedButton()); if (role == QMessageBox::HelpRole) { - SslInfoDlg dlg(socket); + SslInfoDlg dlg(socket, this); dlg.exec(); } } while (role == QMessageBox::HelpRole); @@ -1419,8 +1425,6 @@ void MainWin::handleSslErrors(const QSslSocket* socket, bool* accepted, bool* pe } } -#endif /* HAVE_SSL */ - void MainWin::handleCoreConnectionError(const QString& error) { QMessageBox::critical(this, tr("Core Connection Error"), error, QMessageBox::Ok); @@ -1428,7 +1432,7 @@ void MainWin::handleCoreConnectionError(const QString& error) void MainWin::showCoreConnectionDlg() { - CoreConnectDlg dlg; + CoreConnectDlg dlg{this}; if (dlg.exec() == QDialog::Accepted) { AccountId accId = dlg.selectedAccount(); if (accId.isValid()) @@ -1476,7 +1480,7 @@ void MainWin::showChannelList(NetworkId netId, const QString& channelFilters, bo void MainWin::showNetworkConfig(NetworkId netId) { - SettingsPageDlg dlg{new NetworksSettingsPage{}}; + SettingsPageDlg dlg{new NetworksSettingsPage{}, this}; if (netId.isValid()) qobject_cast(dlg.currentPage())->bufferList_Open(netId); dlg.exec(); @@ -1484,7 +1488,7 @@ void MainWin::showNetworkConfig(NetworkId netId) void MainWin::showIgnoreList(QString newRule) { - SettingsPageDlg dlg{new IgnoreListSettingsPage{}}; + SettingsPageDlg dlg{new IgnoreListSettingsPage{}, this}; // prepare config dialog for new rule if (!newRule.isEmpty()) qobject_cast(dlg.currentPage())->editIgnoreRule(newRule); @@ -1493,7 +1497,7 @@ void MainWin::showIgnoreList(QString newRule) void MainWin::showCoreInfoDlg() { - CoreInfoDlg{}.exec(); + CoreInfoDlg{this}.exec(); } void MainWin::showAwayLog() @@ -1515,7 +1519,7 @@ void MainWin::awayLogDestroyed() void MainWin::showSettingsDlg() { - auto dlg = new SettingsDlg(); + auto dlg = new SettingsDlg(this); // Category: Interface dlg->registerSettingsPage(new AppearanceSettingsPage(dlg)); @@ -1529,8 +1533,15 @@ void MainWin::showSettingsDlg() #ifdef HAVE_SONNET dlg->registerSettingsPage(new SonnetSettingsPage(dlg)); #endif - dlg->registerSettingsPage(new HighlightSettingsPage(dlg)); - dlg->registerSettingsPage(new CoreHighlightSettingsPage(dlg)); + auto coreHighlightsPage = new CoreHighlightSettingsPage(dlg); + auto localHighlightsPage = new HighlightSettingsPage(dlg); + // Let CoreHighlightSettingsPage reload HighlightSettingsPage after doing an import with + // cleaning up. Otherwise, HighlightSettingsPage won't show that the local rules were deleted. + connect(coreHighlightsPage, &CoreHighlightSettingsPage::localHighlightsChanged, + localHighlightsPage, &HighlightSettingsPage::load); + // Put core-side highlights before local/legacy highlights + dlg->registerSettingsPage(coreHighlightsPage); + dlg->registerSettingsPage(localHighlightsPage); dlg->registerSettingsPage(new NotificationsSettingsPage(dlg)); dlg->registerSettingsPage(new BacklogSettingsPage(dlg)); @@ -1553,7 +1564,7 @@ void MainWin::showSettingsDlg() void MainWin::showAboutDlg() { - AboutDlg{}.exec(); + AboutDlg{this}.exec(); } void MainWin::showShortcutsDlg() @@ -1565,7 +1576,7 @@ void MainWin::showShortcutsDlg() } dlg.configure(true); #else - SettingsPageDlg{new ShortcutsSettingsPage{QtUi::actionCollections()}}.exec(); + SettingsPageDlg{new ShortcutsSettingsPage{QtUi::actionCollections()}, this}.exec(); #endif } @@ -1724,7 +1735,7 @@ void MainWin::clientNetworkCreated(NetworkId id) const Network* net = Client::network(id); auto* act = new QAction(net->networkName(), this); act->setObjectName(QString("NetworkAction-%1").arg(id.toInt())); - act->setData(QVariant::fromValue(id)); + act->setData(QVariant::fromValue(id)); connect(net, &SyncableObject::updatedRemotely, this, &MainWin::clientNetworkUpdated); connect(act, &QAction::triggered, this, &MainWin::connectOrDisconnectFromNet); @@ -1843,6 +1854,15 @@ void MainWin::onFormatUnderlineTriggered() _inputWidget->toggleFormatUnderline(); } +void MainWin::onFormatStrikethroughTriggered() +{ + if (!_inputWidget) + return; + + _inputWidget->toggleFormatStrikethrough(); +} + + void MainWin::onJumpHotBufferTriggered() { if (!_bufferHotList->rowCount())