diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/CAPICertificateSelector.cpp | 23 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtColorToolButton.cpp | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtSoundSelectionStyledItemDelegate.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtStrings.h | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtSwift.cpp | 13 | ||||
-rw-r--r-- | Swift/QtUI/QtTabWidget.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 2 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 13 | ||||
-rw-r--r-- | Swift/QtUI/Trellis/QtDynamicGridLayout.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.cpp | 1 | ||||
-rw-r--r-- | Swift/QtUI/main.cpp | 2 |
15 files changed, 71 insertions, 25 deletions
diff --git a/Swift/QtUI/CAPICertificateSelector.cpp b/Swift/QtUI/CAPICertificateSelector.cpp index 36d8c54..e47121b 100644 --- a/Swift/QtUI/CAPICertificateSelector.cpp +++ b/Swift/QtUI/CAPICertificateSelector.cpp @@ -18,7 +18,9 @@ #include <boost/algorithm/string.hpp> #include <Swift/Controllers/Intl.h> #include <Swift/QtUI/QtSwiftUtil.h> + #include <Swiften/Base/Log.h> +#include <Swiften/TLS/Schannel/SchannelUtil.h> namespace Swift { @@ -87,23 +89,22 @@ std::string selectCAPICertificate() { } } - - + std::string result; /* Call Windows dialog to select a suitable certificate */ - PCCERT_CONTEXT cert = CryptUIDlgSelectCertificateFromStore(hstore, hwnd, titleChars, promptChars, exclude_columns, 0, NULL); + { + ScopedCertContext cert(CryptUIDlgSelectCertificateFromStore(hstore, hwnd, titleChars, promptChars, exclude_columns, 0, NULL)); + if (cert) { + result = getCertUri(cert, certStoreName); + } + } delete[] titleChars; delete[] promptChars; if (hstore) { - CertCloseStore(hstore, 0); - } - - std::string result; - - if (cert) { - result = getCertUri(cert, certStoreName); - CertFreeCertificateContext(cert); + if (CertCloseStore(hstore, 0) == FALSE) { + SWIFT_LOG(debug) << "Failed to close the certificate store handle." << std::endl; + } } return result; diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index ad95a07..f4d0d46 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -18,8 +18,8 @@ #include <QMenu> #include <QTabBar> #include <QTabWidget> -#include <QtGlobal> #include <QWindow> +#include <QtGlobal> #include <Swiften/Base/Log.h> @@ -112,8 +112,6 @@ void QtChatTabs::setViewMenu(QMenu* viewMenu) { if (trellisMode_) { viewMenu->addSeparator(); QAction* action = new QAction(tr("Change &layout"), this); - action->setShortcutContext(Qt::ApplicationShortcut); - action->setShortcut(QKeySequence(tr("Ctrl+Alt+L"))); connect(action, SIGNAL(triggered()), this, SLOT(handleOpenLayoutChangeDialog())); viewMenu->addAction(action); diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 96162ba..5981f9c 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -707,9 +707,9 @@ void QtChatWindow::handleEmojiClicked(QString emoji) { if (isVisible()) { input_->textCursor().insertText(emoji); input_->setFocus(); - // The next line also deletes the emojisGrid_, as it was added to the - // layout of the emojisMenu_. - emojisMenu_.reset(); + // We cannot delete the emojisGrid_ + // Grid may not close yet and we should not try to destroy it. + emojisMenu_->setVisible(false); } } diff --git a/Swift/QtUI/QtColorToolButton.cpp b/Swift/QtUI/QtColorToolButton.cpp index b349a47..6452cf4 100644 --- a/Swift/QtUI/QtColorToolButton.cpp +++ b/Swift/QtUI/QtColorToolButton.cpp @@ -36,6 +36,7 @@ void QtColorToolButton::setColor(const QColor& color) void QtColorToolButton::onClicked() { QColor c = QColorDialog::getColor(color_, this); + window()->raise(); if (c.isValid()) { setColor(c); } diff --git a/Swift/QtUI/QtSoundSelectionStyledItemDelegate.h b/Swift/QtUI/QtSoundSelectionStyledItemDelegate.h index fabf668..f03cacc 100644 --- a/Swift/QtUI/QtSoundSelectionStyledItemDelegate.h +++ b/Swift/QtUI/QtSoundSelectionStyledItemDelegate.h @@ -11,6 +11,7 @@ namespace Swift { class QtSoundSelectionStyledItemDelegate : public QStyledItemDelegate { + Q_OBJECT public: QtSoundSelectionStyledItemDelegate(QObject* parent = nullptr); diff --git a/Swift/QtUI/QtStrings.h b/Swift/QtUI/QtStrings.h index d0cd421..84bc7f9 100644 --- a/Swift/QtUI/QtStrings.h +++ b/Swift/QtUI/QtStrings.h @@ -26,6 +26,14 @@ QT_TRANSLATE_NOOP("QLineEdit", "&Copy"); QT_TRANSLATE_NOOP("QLineEdit", "&Paste"); QT_TRANSLATE_NOOP("QLineEdit", "Delete"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "Select All"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "&Undo"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "&Redo"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "Cu&t"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "&Copy"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "&Paste"); +QT_TRANSLATE_NOOP("QWidgetTextControl", "Delete"); + QT_TRANSLATE_NOOP("QScrollBar", "Scroll here"); QT_TRANSLATE_NOOP("QScrollBar", "Top"); QT_TRANSLATE_NOOP("QScrollBar", "Bottom"); @@ -76,6 +84,10 @@ QT_TRANSLATE_NOOP("QDialogButtonBox", "Cancel"); QT_TRANSLATE_NOOP("QMessageBox", "Show Details..."); QT_TRANSLATE_NOOP("QMessageBox", "Hide Details..."); +QT_TRANSLATE_NOOP("QPlatformTheme", "OK"); +QT_TRANSLATE_NOOP("QPlatformTheme", "Cancel"); +QT_TRANSLATE_NOOP("QPlatformTheme", "Restore Defaults"); + QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU", "Services"); QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU", "Hide %1"); QT_TRANSLATE_NOOP("MAC_APPLICATION_MENU", "Hide Others"); diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp index 7b4e2c3..7daa5ce 100644 --- a/Swift/QtUI/QtSwift.cpp +++ b/Swift/QtUI/QtSwift.cpp @@ -101,6 +101,7 @@ po::options_description QtSwift::getOptionsDescription() { #if QT_VERSION >= 0x040800 ("language", po::value<std::string>(), "Use a specific language, instead of the system-wide one") #endif + ("logfile", po::value<std::string>()->implicit_value(""), "Save all logging information to a file") ; return result; } @@ -189,6 +190,16 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa Log::setLogLevel(Swift::Log::debug); } + if (options.count("logfile")) { + try { + std::string fileName = options["logfile"].as<std::string>(); + Log::setLogFile(fileName); + } + catch (...) { + SWIFT_LOG(error) << "Error while retrieving the specified log file name from the command line" << std::endl; + } + } + // Load fonts std::vector<std::string> fontNames = { "themes/Default/Lato2OFL/Lato-Black.ttf", @@ -214,7 +225,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa for (auto&& fontName : fontNames) { std::string fontPath = std::string(":/") + fontName; int error = QFontDatabase::addApplicationFont(P2QSTRING(fontPath)); - assert((error != -1) && "Failed to load font."); + SWIFT_LOG_ASSERT(error != -1, error) << "Failed to load font " << fontPath << std::endl; } bool enableAdHocCommandOnJID = options.count("enable-jid-adhocs") > 0; diff --git a/Swift/QtUI/QtTabWidget.cpp b/Swift/QtUI/QtTabWidget.cpp index 67e3ae9..99ef6ee 100644 --- a/Swift/QtUI/QtTabWidget.cpp +++ b/Swift/QtUI/QtTabWidget.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -57,7 +57,7 @@ void QtTabWidget::paintEvent(QPaintEvent * event) { label.setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); label.setGeometry(QRect(QPoint(0,0), size()) - QMargins(10,10,10,10)); label.setWordWrap(true); - label.setText(tr("This empty cell is a placeholder for chat windows. You can move existing chats to this cell by dragging the tab over here. You can change the number of cells via the 'Change layout' dialog under the 'View' menu or by using the %1 shortcut.").arg(QKeySequence(tr("Ctrl+Alt+L")).toString(QKeySequence::NativeText))); + label.setText(tr("This empty cell is a placeholder for chat windows. You can move existing chats to this cell by dragging the tab over here. You can change the number of cells via the 'Change layout' dialog under the 'View' menu.")); QPainter painter(this); painter.drawPixmap(label.geometry().topLeft(), label.grab()); } diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index ece29ec..583c477 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -10,6 +10,7 @@ #include <QSplitter> +#include <Swiften/Base/Log.h> #include <Swiften/Whiteboard/WhiteboardSession.h> #include <Swift/Controllers/Settings/SettingsProviderHierachy.h> @@ -46,6 +47,13 @@ QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* this->tabs = dynamic_cast<QtChatTabs*>(tabsBase); } +QtUIFactory::~QtUIFactory() { + SWIFT_LOG(debug) << "Entering QtUIFactory destructor. chatWindows size:" << chatWindows.size() << std::endl; + for (auto chat : chatWindows) { + SWIFT_LOG_ASSERT(chat.isNull(), debug) << "QtUIFactory has active chat windows and has not been reset properly" << std::endl; + } +} + XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() { QtXMLConsoleWidget* widget = new QtXMLConsoleWidget(); tabsBase->addTab(widget); diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index 18bf9fe..9989101 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -36,7 +36,7 @@ namespace Swift { Q_OBJECT public: QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabsBase* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, AutoUpdater* autoUpdater, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID); - + ~QtUIFactory(); virtual XMLConsoleWidget* createXMLConsoleWidget(); virtual HistoryWindow* createHistoryWindow(UIEventStream*); virtual MainWindow* createMainWindow(UIEventStream* eventStream); diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 77731df..3755187 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -501,7 +501,18 @@ if env["PLATFORM"] == "win32" : lightTask = myenv.WiX_Light('#/Packages/Swift/Swift-' + myenv["SWIFT_VERSION"] + '.msi', ['..\\Packaging\\WiX\\gen_files.wixobj','..\\Packaging\\WiX\\Swift.wixobj']) if myenv.get("SIGNTOOL_KEY_PFX", None) and myenv.get("SIGNTOOL_TIMESTAMP_URL", None) : def signToolAction(target = None, source = None, env = None): - env.Execute('signtool.exe sign /fd SHA256 /f "${SIGNTOOL_KEY_PFX}" /t "${SIGNTOOL_TIMESTAMP_URL}" ' + str(target[0])) + signresult = 0 + for x in range (1, 4) : + print "Attemping to sign the packages [%s]" % x + signresult = env.Execute('signtool.exe sign /fd SHA256 /f "${SIGNTOOL_KEY_PFX}" /t "${SIGNTOOL_TIMESTAMP_URL}" /d "Swift Installer" ' + str(target[0])) + if signresult != 1 : + break + #If all 3 attemps to sign the package failed, stop the build. + if signresult == 1 : + print "Error: The build has failed to sign the installer package" + Exit(1) + if signresult == 2 : + print "Signing was completed with warnings." myenv.AddPostAction(lightTask, signToolAction) diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp index b753ffa..2509b3f 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.cpp @@ -144,7 +144,9 @@ void QtDynamicGridLayout::removeTab(int index) { int tabIndex = -1; QtTabWidget* tabWidget = indexToTabWidget(index, tabIndex); if (tabWidget) { + QWidget* tab = tabWidget->widget(tabIndex); tabWidget->removeTab(tabIndex); + tab->setParent(nullptr); } } diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp index 8c46e38..e55ee80 100644 --- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp +++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp @@ -205,7 +205,7 @@ void QtSuggestingJIDInput::hidePopup() { // Give focus back to input widget because the hide() call passes the focus to the wrong widget. setFocus(); -#if defined(Q_WS_MAC) +#if defined(Q_OS_MAC) // This workaround is needed on OS X, to bring the dialog containing this widget back to the front after // the popup is hidden. Ubuntu 16.04 and Windows 8 do not have this issue. window()->raise(); diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index 8d15739..4489bc0 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -606,6 +606,7 @@ void QtUserSearchWindow::clear() { howText = QString(tr("Who do you want to invite to the chat?")); } firstMultiJIDPage_->howLabel_->setText(howText); + firstMultiJIDPage_->groupBox->setEnabled(true); } clearForm(); resultsPage_->results_->setModel(nullptr); diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp index 81dc670..3e20e23 100644 --- a/Swift/QtUI/main.cpp +++ b/Swift/QtUI/main.cpp @@ -100,7 +100,7 @@ int main(int argc, char* argv[]) { qtTranslator.load(QString(SWIFT_APPLICATION_NAME).toLower() + "_" + P2QSTRING(language), P2QSTRING(Swift::pathToString(someTranslationPath.parent_path()))); } else { - qtTranslator.load(QLocale::system(), QString(SWIFT_APPLICATION_NAME).toLower(), "_", P2QSTRING(Swift::pathToString(someTranslationPath))); + qtTranslator.load(QLocale::system(), QString(SWIFT_APPLICATION_NAME).toLower(), "_", P2QSTRING(Swift::pathToString(someTranslationPath.parent_path()))); } #else //std::cout << "Loading " << std::string(QLocale::system().name().toUtf8()) << std::endl; |