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 Mar 9, 2020
1 parent e48faae commit ec1b1e3
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 129 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/7749
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ else()
endif()

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

set(client_SRCS
aboutdialog.cpp
accountmanager.cpp
accountsettings.cpp
application.cpp
Expand Down
51 changes: 51 additions & 0 deletions src/gui/aboutdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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);
}

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>
3 changes: 1 addition & 2 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ GeneralSettings::GeneralSettings(QWidget *parent)
_ui->experimentalGroupBox->hide();
}

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

if (!theme->aboutShowCopyright()) {
_ui->copyrightLabelDotBefore->hide();
Expand Down
Loading

0 comments on commit ec1b1e3

Please sign in to comment.