Skip to content

Commit

Permalink
[Gui]Redesign AboutDialog and unify version info
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Oct 2, 2020
1 parent 59a10bf commit 8daef3f
Show file tree
Hide file tree
Showing 10 changed files with 341 additions and 79 deletions.
8 changes: 8 additions & 0 deletions changelog/unreleased/7749
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Change: Redesign the About dialog

We redesigned the way the About information is displayed and unified it
with the "--version" switch.

https://github.com/owncloud/client/issues/7749
https://github.com/owncloud/enterprise/issues/3787
https://github.com/owncloud/client/issues/7704
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ find_package(Qt5 REQUIRED COMPONENTS Widgets)
add_subdirectory(updater)

set(client_UI_SRCS
aboutdialog.ui
accountsettings.ui
folderwizardsourcepage.ui
folderwizardtargetpage.ui
Expand Down Expand Up @@ -32,6 +33,7 @@ set(client_UI_SRCS
)

set(client_SRCS
aboutdialog.cpp
accountmanager.cpp
accountsettings.cpp
application.cpp
Expand Down
52 changes: 52 additions & 0 deletions src/gui/aboutdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "aboutdialog.h"
#include "ui_aboutdialog.h"

#include "theme.h"
#include "guiutility.h"

namespace OCC {

AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::AboutDialog)
{
ui->setupUi(this);
setWindowTitle(tr("About %1").arg(Theme::instance()->appNameGUI()));
ui->aboutText->setText(Theme::instance()->about());
ui->icon->setPixmap(Theme::instance()->applicationIcon().pixmap(256));
ui->versionInfo->setText(Theme::instance()->aboutVersions(Theme::VersionFormat::RichText));

connect(ui->versionInfo, &QTextBrowser::anchorClicked, this, &AboutDialog::openBrowserFromUrl);
connect(ui->aboutText, &QLabel::linkActivated, this, &AboutDialog::openBrowser);
setAttribute(Qt::WA_DeleteOnClose);
}

AboutDialog::~AboutDialog()
{
delete ui;
}

void AboutDialog::openBrowser(const QString &s)
{
Utility::openBrowser(s, this);
}

void AboutDialog::openBrowserFromUrl(const QUrl &s)
{
return openBrowser(s.toString());
}

}
43 changes: 43 additions & 0 deletions src/gui/aboutdialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H

#include <QDialog>


namespace OCC {

namespace Ui {
class AboutDialog;
}

class AboutDialog : public QDialog
{
Q_OBJECT

public:
explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog();

private:
void openBrowser(const QString &s);
void openBrowserFromUrl(const QUrl &s);

private:
Ui::AboutDialog *ui;
};

}
#endif // ABOUTDIALOG_H
162 changes: 162 additions & 0 deletions src/gui/aboutdialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OCC::AboutDialog</class>
<widget class="QDialog" name="OCC::AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>751</width>
<height>391</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">About</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>About</string>
</attribute>
<layout class="QHBoxLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>256</width>
<height>256</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../../theme.qrc">:/client/theme/colored/owncloud-icon-256.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="aboutText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Versions</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTextBrowser" name="versionInfo">
<property name="openExternalLinks">
<bool>false</bool>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../theme.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>OCC::AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>OCC::AboutDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
5 changes: 1 addition & 4 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,9 @@ GeneralSettings::GeneralSettings(QWidget *parent)
_ui->updateChannel->hide();
#endif
}

_ui->versionLabel->setText(QStringLiteral("<a href='%1'>%1</a>").arg(MIRALL_VERSION_STRING));
QObject::connect(_ui->versionLabel, &QLabel::linkActivated, this, &GeneralSettings::showAbout);
connect(_ui->about_pushButton, &QPushButton::clicked, this, &GeneralSettings::showAbout);

if (!theme->aboutShowCopyright()) {
_ui->copyrightLabelDotBefore->hide();
_ui->copyrightLabel->hide();
}
}
Expand Down
18 changes: 6 additions & 12 deletions src/gui/generalsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<x>0</x>
<y>0</y>
<width>771</width>
<height>640</height>
<height>637</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
Expand Down Expand Up @@ -311,36 +311,30 @@
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string notr="true">Version 3.1.3 (build 37)</string>
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="copyrightLabelDotBefore">
<widget class="QLabel" name="copyrightLabel">
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<property name="text">
<string>•</string>
<string notr="true">Copyright ownCloud GmbH</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="copyrightLabel">
<property name="cursor">
<cursorShape>ArrowCursor</cursorShape>
</property>
<widget class="QPushButton" name="about_pushButton">
<property name="text">
<string notr="true">Copyright ownCloud GmbH</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
<string>About</string>
</property>
</widget>
</item>
Expand Down
18 changes: 3 additions & 15 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "accountstate.h"
#include "openfilemanager.h"
#include "accountmanager.h"
#include "aboutdialog.h"
#include "common/syncjournalfilerecord.h"
#include "creds/abstractcredentials.h"

Expand Down Expand Up @@ -1141,21 +1142,8 @@ void ownCloudGui::slotRemoveDestroyedShareDialogs()

void ownCloudGui::slotAbout()
{
const QString title = tr("About %1").arg(Theme::instance()->appNameGUI());
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(QStringLiteral("<qt>%1</qt>").arg(Theme::instance()->about()));
msgBox->setStandardButtons(QMessageBox::Ok);
msgBox->setIconPixmap(Theme::instance()->applicationIcon().pixmap(qApp->primaryScreen()->availableSize().width() / 4));
msgBox->show();
auto about = new AboutDialog(_settingsDialog);
about->open();
}


Expand Down

0 comments on commit 8daef3f

Please sign in to comment.