summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtChatTabs.cpp13
-rw-r--r--Swift/QtUI/QtChatTabs.h5
-rw-r--r--Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp108
-rw-r--r--Swift/QtUI/QtChatTabsShortcutOnlySubstitute.h40
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp22
-rw-r--r--Swift/QtUI/QtChatWindowFactory.h8
-rw-r--r--Swift/QtUI/QtSwift.cpp16
-rw-r--r--Swift/QtUI/QtSwift.h6
-rw-r--r--Swift/QtUI/QtUIFactory.cpp20
-rw-r--r--Swift/QtUI/QtUIFactory.h4
-rw-r--r--Swift/QtUI/SConscript1
11 files changed, 32 insertions, 211 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index bdbbe01..edd0b87 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2017 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -36,3 +36,3 @@
namespace Swift {
-QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bool trellisMode) : QWidget(), singleWindow_(singleWindow), settingsProvider_(settingsProvider), trellisMode_(trellisMode), dynamicGrid_(nullptr), gridSelectionDialog_(nullptr) {
+QtChatTabs::QtChatTabs(SettingsProvider* settingsProvider, bool trellisMode) : QWidget(), settingsProvider_(settingsProvider), trellisMode_(trellisMode), dynamicGrid_(nullptr), gridSelectionDialog_(nullptr) {
#ifndef Q_OS_MAC
@@ -202,9 +202,4 @@ void QtChatTabs::handleTabClosing() {
if (dynamicGrid_->count() == 0) {
- if (!singleWindow_) {
- hide();
- }
- else {
- setWindowTitle("");
- onTitleChanged("");
- }
+ setWindowTitle("");
+ onTitleChanged("");
}
diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h
index 3e36ebf..6a758ca 100644
--- a/Swift/QtUI/QtChatTabs.h
+++ b/Swift/QtUI/QtChatTabs.h
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -28,3 +28,3 @@ namespace Swift {
public:
- QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bool trellisMode);
+ QtChatTabs(SettingsProvider* settingsProvider, bool trellisMode);
virtual ~QtChatTabs();
@@ -68,3 +68,2 @@ namespace Swift {
private:
- bool singleWindow_;
SettingsProvider* settingsProvider_;
diff --git a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp b/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
deleted file mode 100644
index 40ab17f..0000000
--- a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Isode Limited.
- * All rights reserved.
- * See the COPYING file for more information.
- */
-
-#include <Swift/QtUI/QtChatTabsShortcutOnlySubstitute.h>
-
-#include <cassert>
-
-#include <QApplication>
-#include <QShortcut>
-
-#include <Swiften/Base/Log.h>
-
-#include <Swift/QtUI/QtTabbable.h>
-
-namespace Swift {
-
-QtChatTabsShortcutOnlySubstitute::QtChatTabsShortcutOnlySubstitute() : QWidget() {
-
-}
-
-QtChatTabsShortcutOnlySubstitute::~QtChatTabsShortcutOnlySubstitute() {
-
-}
-
-void QtChatTabsShortcutOnlySubstitute::addTab(QtTabbable* tab) {
- connect(tab, SIGNAL(requestNextTab()), this, SLOT(handleRequestedNextTab()), Qt::UniqueConnection);
- connect(tab, SIGNAL(requestActiveTab()), this, SLOT(handleRequestedActiveTab()), Qt::UniqueConnection);
- connect(tab, SIGNAL(requestPreviousTab()), this, SLOT(handleRequestedPreviousTab()), Qt::UniqueConnection);
-
- connect(new QShortcut(QKeySequence(tr("CTRL+W", "Close chat tab.")), tab), SIGNAL(activated()), this, SLOT(handleCloseTabShortcut()));
- connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageUp), tab), SIGNAL(activated()), tab, SIGNAL(requestPreviousTab()));
- connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageDown), tab), SIGNAL(activated()), tab, SIGNAL(requestNextTab()));
- connect(new QShortcut(QKeySequence(Qt::ALT + Qt::Key_A), tab), SIGNAL(activated()), tab, SIGNAL(requestActiveTab()));
-}
-
-void QtChatTabsShortcutOnlySubstitute::handleCloseTabShortcut() {
- QtTabbable* senderTab = dynamic_cast<QtTabbable*>(sender()->parent());
- SWIFT_LOG_ASSERT(senderTab, debug) << "No window to close." << std::endl;
- if (senderTab) {
- senderTab->close();
- }
-}
-
-void QtChatTabsShortcutOnlySubstitute::handleRequestedNextTab() {
- QtTabbable* senderTab = dynamic_cast<QtTabbable*>(sender());
-
- QList<QtTabbable*> tabs = tabbableWindows();
-
- int currentIndex = tabs.indexOf(senderTab);
- assert(currentIndex >= 0);
-
- QtTabbable* nextTab = tabs.at((currentIndex + 1) % tabs.size());
- nextTab->activateWindow();
-}
-
-void QtChatTabsShortcutOnlySubstitute::handleRequestedActiveTab() {
- QtTabbable* senderTab = dynamic_cast<QtTabbable*>(sender());
-
- QtTabbable::AlertType types[] = {QtTabbable::WaitingActivity, QtTabbable::ImpendingActivity};
-
- QList<QtTabbable*> tabs = tabbableWindows();
-
- for (auto& type : types) {
- int startIndex = tabs.indexOf(senderTab);
- int currentIndex = startIndex;
-
- do {
- currentIndex = (currentIndex + 1) % tabs.size();
- QtTabbable* currentTab = tabs.at(currentIndex);
- if (currentTab->getWidgetAlertState() == type) {
- currentTab->activateWindow();
- return;
- }
- } while (startIndex != currentIndex);
- }
-}
-
-void QtChatTabsShortcutOnlySubstitute::handleRequestedPreviousTab() {
- QtTabbable* senderTab = dynamic_cast<QtTabbable*>(sender());
-
- QList<QtTabbable*> tabs = tabbableWindows();
-
- int currentIndex = tabs.indexOf(senderTab);
- assert(currentIndex >= 0);
-
- QtTabbable* previousTab = tabs.at((currentIndex + tabs.size() - 1) % tabs.size());
- previousTab->activateWindow();
-}
-
-QList<QtTabbable*> QtChatTabsShortcutOnlySubstitute::tabbableWindows() const {
- QList<QWidget*> windows = qApp->topLevelWidgets();
-
- QList<QtTabbable*> tabbables;
- for (auto topLevelWidget : windows) {
- QtTabbable* tabbable = dynamic_cast<QtTabbable*>(topLevelWidget);
- if (tabbable) {
- tabbables << tabbable;
- }
- }
-
- return tabbables;
-}
-
-}
-
diff --git a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.h b/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.h
deleted file mode 100644
index b330fe7..0000000
--- a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Isode Limited.
- * All rights reserved.
- * See the COPYING file for more information.
- */
-
-#pragma once
-
-#include <QList>
-#include <QWidget>
-
-#include <Swift/QtUI/QtChatTabsBase.h>
-
-class QShortcut;
-
-namespace Swift {
-
-class QtChatTabsShortcutOnlySubstitute : public QWidget, public QtChatTabsBase {
- Q_OBJECT
-
- public:
- QtChatTabsShortcutOnlySubstitute();
- virtual ~QtChatTabsShortcutOnlySubstitute();
-
- virtual void addTab(QtTabbable* tab);
-
- private slots:
- void handleCloseTabShortcut();
- void handleRequestedNextTab();
- void handleRequestedActiveTab();
- void handleRequestedPreviousTab();
-
- private:
- QList<QtTabbable*> tabbableWindows() const;
-
- private:
- QList<QShortcut*> shortcuts_;
-};
-
-}
diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp
index 49cfe4d..33c8b94 100644
--- a/Swift/QtUI/QtChatWindowFactory.cpp
+++ b/Swift/QtUI/QtChatWindowFactory.cpp
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2017 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -13,3 +13,2 @@
#include <Swift/QtUI/QtChatTabs.h>
-#include <Swift/QtUI/QtChatTabsBase.h>
#include <Swift/QtUI/QtChatTheme.h>
@@ -25,3 +24,3 @@ static const QString CHAT_TABS_GEOMETRY = "chatTabsGeometry";
-QtChatWindowFactory::QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvider* settings, QtSettingsProvider* qtSettings, QtChatTabsBase* tabs, const QString& themePath, const std::map<std::string, std::string>& emoticonsMap) : themePath_(themePath), emoticonsMap_(emoticonsMap) {
+QtChatWindowFactory::QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvider* settings, QtSettingsProvider* qtSettings, QtChatTabs* tabs, const QString& themePath, const std::map<std::string, std::string>& emoticonsMap) : themePath_(themePath), emoticonsMap_(emoticonsMap) {
qtOnlySettings_ = qtSettings;
@@ -30,13 +29,8 @@ QtChatWindowFactory::QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvi
theme_ = nullptr;
- QtChatTabs* fullTabs = dynamic_cast<QtChatTabs*>(tabs_);
- if (splitter) {
- assert(fullTabs && "Netbook mode and no-tabs interface is not supported!");
- splitter->addWidget(fullTabs);
- } else if (fullTabs) {
- QVariant chatTabsGeometryVariant = qtOnlySettings_->getQSettings()->value(CHAT_TABS_GEOMETRY);
- if (chatTabsGeometryVariant.isValid()) {
- fullTabs->restoreGeometry(chatTabsGeometryVariant.toByteArray());
- }
- connect(fullTabs, SIGNAL(geometryChanged()), this, SLOT(handleWindowGeometryChanged()));
+ splitter->addWidget(tabs_);
+ QVariant chatTabsGeometryVariant = qtOnlySettings_->getQSettings()->value(CHAT_TABS_GEOMETRY);
+ if (chatTabsGeometryVariant.isValid()) {
+ tabs_->restoreGeometry(chatTabsGeometryVariant.toByteArray());
}
+ connect(tabs_, SIGNAL(geometryChanged()), this, SLOT(handleWindowGeometryChanged()));
}
@@ -62,3 +56,3 @@ ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact,UIEventStre
QVariant splitterState = qtOnlySettings_->getQSettings()->value(SPLITTER_STATE);
- if(splitterState.isValid()) {
+ if (splitterState.isValid()) {
chatWindow->handleChangeSplitterState(splitterState.toByteArray());
diff --git a/Swift/QtUI/QtChatWindowFactory.h b/Swift/QtUI/QtChatWindowFactory.h
index 2bb6a90..3e4dca3 100644
--- a/Swift/QtUI/QtChatWindowFactory.h
+++ b/Swift/QtUI/QtChatWindowFactory.h
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2017 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -26,3 +26,3 @@
namespace Swift {
- class QtChatTabsBase;
+ class QtChatTabs;
class QtChatTheme;
@@ -34,3 +34,3 @@ namespace Swift {
public:
- QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvider* settings, QtSettingsProvider* qtSettings, QtChatTabsBase* tabs, const QString& themePath, const std::map<std::string, std::string>& emoticonsMap);
+ QtChatWindowFactory(QtSingleWindow* splitter, SettingsProvider* settings, QtSettingsProvider* qtSettings, QtChatTabs* tabs, const QString& themePath, const std::map<std::string, std::string>& emoticonsMap);
~QtChatWindowFactory();
@@ -46,3 +46,3 @@ namespace Swift {
QtSettingsProvider* qtOnlySettings_;
- QtChatTabsBase* tabs_;
+ QtChatTabs* tabs_;
QtChatTheme* theme_;
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 2d75565..2aa8492 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2017 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -44,4 +44,2 @@
#include <Swift/QtUI/QtChatTabs.h>
-#include <Swift/QtUI/QtChatTabsBase.h>
-#include <Swift/QtUI/QtChatTabsShortcutOnlySubstitute.h>
#include <Swift/QtUI/QtChatWindowFactory.h>
@@ -245,9 +243,3 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
bool enableAdHocCommandOnJID = options.count("enable-jid-adhocs") > 0;
- tabs_ = nullptr;
- if (options.count("no-tabs") && !splitter_) {
- tabs_ = new QtChatTabsShortcutOnlySubstitute();
- }
- else {
- tabs_ = new QtChatTabs(splitter_ != nullptr, settingsHierachy_, true);
- }
+ tabs_ = new QtChatTabs(settingsHierachy_, true);
bool startMinimized = options.count("start-minimized") > 0;
@@ -292,5 +284,3 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
- if (splitter_) {
- splitter_->show();
- }
+ splitter_->show();
diff --git a/Swift/QtUI/QtSwift.h b/Swift/QtUI/QtSwift.h
index a7dc3cf..1d5c5ed 100644
--- a/Swift/QtUI/QtSwift.h
+++ b/Swift/QtUI/QtSwift.h
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2017 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
@@ -47,3 +47,3 @@ namespace Swift {
class QtSystemTray;
- class QtChatTabsBase;
+ class QtChatTabs;
class QtChatWindowFactory;
@@ -90,3 +90,3 @@ namespace Swift {
URIHandler* uriHandler_;
- QtChatTabsBase* tabs_;
+ QtChatTabs* tabs_;
ApplicationPathProvider* applicationPathProvider_;
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index 15619c7..0b19f63 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -21,3 +21,2 @@
#include <Swift/QtUI/QtChatTabs.h>
-#include <Swift/QtUI/QtChatTabsBase.h>
#include <Swift/QtUI/QtChatWindow.h>
@@ -43,6 +42,5 @@ namespace Swift {
-QtUIFactory::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) : settings_(settings), qtOnlySettings_(qtOnlySettings), tabsBase_(tabs), netbookSplitter_(netbookSplitter), systemTray_(systemTray), chatWindowFactory_(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow_(nullptr), loginWindow_(nullptr), statusCache_(statusCache), autoUpdater_(autoUpdater), startMinimized_(startMinimized), emoticonsExist_(emoticonsExist), enableAdHocCommandOnJID_(enableAdHocCommandOnJID) {
+QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, AutoUpdater* autoUpdater, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID) : settings_(settings), qtOnlySettings_(qtOnlySettings), tabs_(tabs), netbookSplitter_(netbookSplitter), systemTray_(systemTray), chatWindowFactory_(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow_(nullptr), loginWindow_(nullptr), statusCache_(statusCache), autoUpdater_(autoUpdater), startMinimized_(startMinimized), emoticonsExist_(emoticonsExist), enableAdHocCommandOnJID_(enableAdHocCommandOnJID) {
chatFontSize_ = settings_->getSetting(QtUISettingConstants::CHATWINDOW_FONT_SIZE);
historyFontSize_ = settings_->getSetting(QtUISettingConstants::HISTORYWINDOW_FONT_SIZE);
- this->tabs_ = dynamic_cast<QtChatTabs*>(tabsBase_);
}
@@ -58,3 +56,3 @@ XMLConsoleWidget* QtUIFactory::createXMLConsoleWidget() {
QtXMLConsoleWidget* widget = new QtXMLConsoleWidget();
- tabsBase_->addTab(widget);
+ tabs_->addTab(widget);
showTabs();
@@ -66,3 +64,3 @@ HistoryWindow* QtUIFactory::createHistoryWindow(UIEventStream* uiEventStream) {
QtHistoryWindow* window = new QtHistoryWindow(settings_, uiEventStream);
- tabsBase_->addTab(window);
+ tabs_->addTab(window);
showTabs();
@@ -82,3 +80,3 @@ FileTransferListWidget* QtUIFactory::createFileTransferListWidget() {
QtFileTransferListWidget* widget = new QtFileTransferListWidget();
- tabsBase_->addTab(widget);
+ tabs_->addTab(widget);
showTabs();
@@ -90,5 +88,3 @@ MainWindow* QtUIFactory::createMainWindow(Chattables& chattables, UIEventStream*
lastMainWindow_ = new QtMainWindow(chattables, settings_, eventStream, loginWindow_->getMenus(), statusCache_, emoticonsExist_, enableAdHocCommandOnJID_);
- if (tabs_) {
- tabs_->setViewMenu(lastMainWindow_->getMenus()[0]);
- }
+ tabs_->setViewMenu(lastMainWindow_->getMenus()[0]);
return lastMainWindow_;
@@ -179,6 +175,4 @@ AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(std::shared_ptr<Outgoi
void QtUIFactory::showTabs() {
- if (tabs_) {
- if (!tabs_->isVisible()) {
- tabs_->show();
- }
+ if (!tabs_->isVisible()) {
+ tabs_->show();
}
diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h
index 0b9ee3c..4013668 100644
--- a/Swift/QtUI/QtUIFactory.h
+++ b/Swift/QtUI/QtUIFactory.h
@@ -21,3 +21,2 @@ namespace Swift {
class QtChatTabs;
- class QtChatTabsBase;
class QtChatTheme;
@@ -38,3 +37,3 @@ namespace Swift {
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(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QtSingleWindow* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, StatusCache* statusCache, AutoUpdater* autoUpdater, bool startMinimized, bool emoticonsExist, bool enableAdHocCommandOnJID);
~QtUIFactory();
@@ -68,3 +67,2 @@ namespace Swift {
QtSettingsProvider* qtOnlySettings_;
- QtChatTabsBase* tabsBase_;
QtChatTabs* tabs_;
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 09860ed..3cd3228 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -153,3 +153,2 @@ sources = [
"QtChatTabsBase.cpp",
- "QtChatTabsShortcutOnlySubstitute.cpp",
"QtChatTheme.cpp",