diff options
author | Peter Burgess <pete.burgess@isode.com> | 2018-05-16 16:41:43 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2018-05-18 10:04:40 (GMT) |
commit | 0d9beaad4811a84b4bf553e17bba862320624882 (patch) | |
tree | f162efa4486051421d1dc378c7a5b58e4c08e007 | |
parent | 39ff091cddf8fd5e01047d80c7ed60c150537705 (diff) | |
download | swift-0d9beaad4811a84b4bf553e17bba862320624882.zip swift-0d9beaad4811a84b4bf553e17bba862320624882.tar.bz2 |
Open swift with sensible geometry in netbook mode the first time
If swift has never been run in netbook mode before, then netbook
mode geometry is set by some hard coded default value during
construction of QtSingleWindow. The code to set and utilize the
original non-netbook mode geometry has been removed.
Test-information:
No unit tests as all changes at Qt specific.
Tested after deleting config file.
Tested after replacing config file with one that has no
SINGLE_WINDOW_XXX settings (so a config file you would find
if swift had never been opened in netbook mode).
Tested with one or other of the SINGLE_WINDOW_XXX settings
missing Tested with config file that contains all SINGLE_WINDOW_XXX
settings
Change-Id: I0075456796bd830b855629fbd03d601df7f2891c
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtSingleWindow.cpp | 17 | ||||
-rw-r--r-- | Swift/QtUI/QtSingleWindow.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.cpp | 20 | ||||
-rw-r--r-- | Swift/QtUI/QtUIFactory.h | 3 |
8 files changed, 29 insertions, 25 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 7b81567..bdbbe01 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -426,4 +426,8 @@ void QtChatTabs::checkForFirstShow() { } } +QSize QtChatTabs::sizeHint() const { + return QSize(600, 600); +} + } diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h index 0c12d96..3e36ebf 100644 --- a/Swift/QtUI/QtChatTabs.h +++ b/Swift/QtUI/QtChatTabs.h @@ -33,6 +33,7 @@ namespace Swift { void minimise(); QtTabbable* getCurrentTab(); void setViewMenu(QMenu* viewMenu); + QSize sizeHint() const; signals: void geometryChanged(); diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 654e921..8fdce4d 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -573,4 +573,8 @@ void QtLoginWindow::handleOpenConnectionOptions() { } } +QSize QtLoginWindow::sizeHint() const { + return QSize(250, 600); +} + } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index 674e1e3..6920903 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -54,6 +54,7 @@ namespace Swift { void hide(); QtMenus getMenus() const; virtual void quit(); + QSize sizeHint() const; signals: void geometryChanged(); diff --git a/Swift/QtUI/QtSingleWindow.cpp b/Swift/QtUI/QtSingleWindow.cpp index 2e88968..d53f247 100644 --- a/Swift/QtUI/QtSingleWindow.cpp +++ b/Swift/QtUI/QtSingleWindow.cpp @@ -18,12 +18,11 @@ static const QString SINGLE_WINDOW_SPLITS = QString("SINGLE_WINDOW_SPLITS"); QtSingleWindow::QtSingleWindow(QtSettingsProvider* settings) : QSplitter() { settings_ = settings; - QVariant geometryVariant = settings_->getQSettings()->value(SINGLE_WINDOW_GEOMETRY); + auto geometryVariant = settings_->getQSettings()->value(SINGLE_WINDOW_GEOMETRY); if (geometryVariant.isValid()) { restoreGeometry(geometryVariant.toByteArray()); } - connect(this, SIGNAL(splitterMoved(int, int)), this, SLOT(handleSplitterMoved(int, int))); - restoreSplitters(); + connect(this, SIGNAL(splitterMoved(int, int)), this, SLOT(handleSplitterMoved(/*int, int*/))); setChildrenCollapsible(false); #ifdef SWIFTEN_PLATFORM_MACOSX setHandleWidth(0); @@ -46,7 +45,7 @@ void QtSingleWindow::handleTabsTitleChanged(const QString& title) { setWindowTitle(title); } -void QtSingleWindow::handleSplitterMoved(int, int) { +void QtSingleWindow::handleSplitterMoved() { QList<QVariant> variantValues; QList<int> intValues = sizes(); for (const auto& value : intValues) { @@ -66,7 +65,15 @@ void QtSingleWindow::restoreSplitters() { void QtSingleWindow::insertAtFront(QWidget* widget) { insertWidget(0, widget); - restoreSplitters(); + auto splitsVariant = settings_->getQSettings()->value(SINGLE_WINDOW_SPLITS); + if (splitsVariant.isValid()) { + restoreSplitters(); + } + else { + handleSplitterMoved(); + } + setStretchFactor(0, 0); + setStretchFactor(1, 1); } void QtSingleWindow::handleGeometryChanged() { diff --git a/Swift/QtUI/QtSingleWindow.h b/Swift/QtUI/QtSingleWindow.h index 804be65..c6f22cf 100644 --- a/Swift/QtUI/QtSingleWindow.h +++ b/Swift/QtUI/QtSingleWindow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,7 +22,7 @@ namespace Swift { void resizeEvent(QResizeEvent*); void moveEvent(QMoveEvent*); private slots: - void handleSplitterMoved(int, int); + void handleSplitterMoved(); void handleTabsTitleChanged(const QString& title); private: void handleGeometryChanged(); diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 7840b1b..0def5fa 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -96,26 +96,14 @@ MainWindow* QtUIFactory::createMainWindow(Chattables& chattables, UIEventStream* LoginWindow* QtUIFactory::createLoginWindow(UIEventStream* eventStream) { loginWindow = new QtLoginWindow(eventStream, settings, timerFactory_, autoUpdater); - if (netbookSplitter) { - netbookSplitter->insertAtFront(loginWindow); - } + netbookSplitter->insertAtFront(loginWindow); connect(systemTray, SIGNAL(clicked()), loginWindow, SLOT(toggleBringToFront())); - -#ifndef SWIFT_MOBILE - QVariant loginWindowGeometryVariant = qtOnlySettings->getQSettings()->value("loginWindowGeometry"); - if (loginWindowGeometryVariant.isValid()) { - loginWindow->restoreGeometry(loginWindowGeometryVariant.toByteArray()); + if (startMinimized) { + loginWindow->hide(); } - connect(loginWindow, SIGNAL(geometryChanged()), this, SLOT(handleLoginWindowGeometryChanged())); - if (startMinimized) loginWindow->hide(); -#endif return loginWindow; } -void QtUIFactory::handleLoginWindowGeometryChanged() { - qtOnlySettings->getQSettings()->setValue("loginWindowGeometry", loginWindow->saveGeometry()); -} - EventWindow* QtUIFactory::createEventWindow() { return lastMainWindow->getEventWindow(); } diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index 9eeaa68..74c7bf5 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2017 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -57,7 +57,6 @@ namespace Swift { virtual AdHocCommandWindow* createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command); private slots: - void handleLoginWindowGeometryChanged(); void handleChatWindowFontResized(int); void handleHistoryWindowFontResized(int); |