diff options
author | Markus Goetz <markus@woboq.com> | 2018-06-19 18:18:17 +0300 |
---|---|---|
committer | Camila San <hello@camila.codes> | 2018-09-09 22:21:05 +0300 |
commit | a10b1bb320b3a5f922ef689059b4ba7f8b6f3c7f (patch) | |
tree | 620f7d8a863ea5c8f11ffcaaee49edd2128b2a98 | |
parent | cb69944b5c09a26f86ec38d7ce9a589cac950f7a (diff) |
Introduce an about dialogupstream/pr/6596
Every proper application has that!
For decreasing window height in #6075
-rw-r--r-- | src/gui/generalsettings.ui | 275 | ||||
-rw-r--r-- | src/gui/owncloudgui.cpp | 39 | ||||
-rw-r--r-- | src/gui/owncloudgui.h | 2 |
3 files changed, 172 insertions, 144 deletions
diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui index 34aa03510..e07a8d95a 100644 --- a/src/gui/generalsettings.ui +++ b/src/gui/generalsettings.ui @@ -7,156 +7,13 @@ <x>0</x> <y>0</y> <width>785</width> - <height>523</height> + <height>513</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="2" column="0"> - <widget class="QGroupBox" name="aboutGroupBox"> - <property name="title"> - <string>About</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QLabel" name="aboutLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>About</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QPushButton" name="legalNoticeButton"> - <property name="text"> - <string>Legal notice</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item row="0" column="0"> - <widget class="QGroupBox" name="generalGroupBox"> - <property name="title"> - <string>General Settings</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="1" column="0"> - <widget class="QCheckBox" name="monoIconsCheckBox"> - <property name="toolTip"> - <string>For System Tray</string> - </property> - <property name="text"> - <string>Use &Monochrome Icons</string> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QCheckBox" name="autostartCheckBox"> - <property name="text"> - <string>&Launch on System Startup</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="serverNotificationsCheckBox"> - <property name="text"> - <string>Show Server &Notifications</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="3" column="0"> - <widget class="QGroupBox" name="updatesGroupBox"> - <property name="title"> - <string>Updates</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="updateStateLabel"> - <property name="text"> - <string/> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="restartButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>&Restart && Update</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Preferred</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item row="4" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> <item row="1" column="0"> <widget class="QGroupBox" name="groupBox"> <property name="title"> @@ -273,6 +130,136 @@ </layout> </widget> </item> + <item row="0" column="0"> + <widget class="QGroupBox" name="generalGroupBox"> + <property name="title"> + <string>General Settings</string> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="0"> + <widget class="QCheckBox" name="monoIconsCheckBox"> + <property name="toolTip"> + <string>For System Tray</string> + </property> + <property name="text"> + <string>Use &Monochrome Icons</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QCheckBox" name="autostartCheckBox"> + <property name="text"> + <string>&Launch on System Startup</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="serverNotificationsCheckBox"> + <property name="text"> + <string>Show Server &Notifications</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="aboutGroupBox"> + <property name="title"> + <string>About</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QLabel" name="aboutLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>About</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <item> + <widget class="QPushButton" name="legalNoticeButton"> + <property name="text"> + <string>Legal notice</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="updatesGroupBox"> + <property name="title"> + <string>Updates</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="updateStateLabel"> + <property name="text"> + <string/> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="restartButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Restart && Update</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Preferred</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> </layout> </widget> <tabstops> diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index f7d27346a..daad79f81 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -41,12 +41,16 @@ #include <QDesktopServices> #include <QDir> #include <QMessageBox> + #include <QSignalMapper> #ifdef WITH_LIBCLOUDPROVIDERS #include <QtDBus/QDBusConnection> #include <QtDBus/QDBusInterface> #endif +#include <QDialog> +#include <QHBoxLayout> + #if defined(Q_OS_X11) #include <QX11Info> #endif @@ -508,6 +512,10 @@ void ownCloudGui::setupContextMenu() // The tray menu is surprisingly problematic. Being able to switch to // a minimal version of it is a useful workaround and testing tool. if (minimalTrayMenu()) { + if (! Theme::instance()->about().isEmpty()) { + _contextMenu->addSeparator(); + _contextMenu->addAction(_actionAbout); + } _contextMenu->addAction(_actionQuit); return; } @@ -665,6 +673,12 @@ void ownCloudGui::updateContextMenu() QAction *action = _contextMenu->addAction(text); connect(action, &QAction::triggered, this, &ownCloudGui::slotPauseAllFolders); } + + if (! Theme::instance()->about().isEmpty()) { + _contextMenu->addSeparator(); + _contextMenu->addAction(_actionAbout); + } + _contextMenu->addAction(_actionQuit); if (_qdbusmenuWorkaround) { @@ -749,6 +763,8 @@ void ownCloudGui::setupActions() QObject::connect(_actionNewAccountWizard, &QAction::triggered, this, &ownCloudGui::slotNewAccountWizard); _actionHelp = new QAction(tr("Help"), this); QObject::connect(_actionHelp, &QAction::triggered, this, &ownCloudGui::slotHelp); + _actionAbout = new QAction(tr("About %1").arg(Theme::instance()->appNameGUI()), this); + QObject::connect(_actionAbout, &QAction::triggered, this, &ownCloudGui::slotAbout); _actionQuit = new QAction(tr("Quit %1").arg(Theme::instance()->appNameGUI()), this); QObject::connect(_actionQuit, SIGNAL(triggered(bool)), _app, SLOT(quit())); @@ -1191,5 +1207,28 @@ void ownCloudGui::slotRemoveDestroyedShareDialogs() } } +void ownCloudGui::slotAbout() +{ + QString title = tr("About %1").arg(Theme::instance()->appNameGUI()); + QString about = Theme::instance()->about(); + QMessageBox *msgBox = new QMessageBox(this->_settingsDialog); +#ifdef Q_OS_MAC + // From Qt doc: "On macOS, the window title is ignored (as required by the macOS Guidelines)." + msgBox->setText(title); +#else + msgBox->setWindowTitle(title); +#endif + msgBox->setAttribute(Qt::WA_DeleteOnClose, true); + msgBox->setTextFormat(Qt::RichText); + msgBox->setTextInteractionFlags(Qt::TextBrowserInteraction); + msgBox->setInformativeText("<qt>"+about+"</qt>"); + msgBox->setStandardButtons(QMessageBox::Ok); + QIcon appIcon = Theme::instance()->applicationIcon(); + // Assume icon is always small enough to fit an about dialog? + qDebug() << appIcon.availableSizes().last(); + msgBox->setIconPixmap(appIcon.pixmap(appIcon.availableSizes().last())); + msgBox->show(); +} + } // end namespace diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h index c7e4c1272..679c91334 100644 --- a/src/gui/owncloudgui.h +++ b/src/gui/owncloudgui.h @@ -122,6 +122,7 @@ private slots: void slotUnpauseAllFolders(); void slotPauseAllFolders(); void slotNewAccountWizard(); + void slotAbout(); private: void setPauseOnAllFoldersHelper(bool pause); @@ -160,6 +161,7 @@ private: QAction *_actionEstimate; QAction *_actionRecent; QAction *_actionHelp; + QAction *_actionAbout; QAction *_actionQuit; QAction *_actionCrash; |