Skip to content

Commit

Permalink
Merge pull request #525 from nextcloud/feature/132/about_dialog
Browse files Browse the repository at this point in the history
Add legal notice button to about dialog
  • Loading branch information
Camila Ayres authored Aug 2, 2018
2 parents 30fc87d + c4d7f97 commit e0f4997
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 42 deletions.
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(client_UI_SRCS
folderwizardsourcepage.ui
folderwizardtargetpage.ui
generalsettings.ui
legalnotice.ui
ignorelisteditor.ui
networksettings.ui
activitywidget.ui
Expand Down Expand Up @@ -56,6 +57,7 @@ set(client_SRCS
folderwatcher.cpp
folderwizard.cpp
generalsettings.cpp
legalnotice.cpp
ignorelisteditor.cpp
lockwatcher.cpp
logbrowser.cpp
Expand Down
24 changes: 16 additions & 8 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include "config.h"

#include "legalnotice.h"

#include <QNetworkProxy>
#include <QDir>
#include <QScopedValueRollback>
Expand All @@ -53,14 +55,13 @@ GeneralSettings::GeneralSettings(QWidget *parent)

// setup about section
QString about = Theme::instance()->about();
if (about.isEmpty()) {
_ui->aboutGroupBox->hide();
} else {
_ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
_ui->aboutLabel->setText(about);
_ui->aboutLabel->setWordWrap(true);
_ui->aboutLabel->setOpenExternalLinks(true);
}
_ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
_ui->aboutLabel->setText(about);
_ui->aboutLabel->setWordWrap(true);
_ui->aboutLabel->setOpenExternalLinks(true);

// About legal notice
connect(_ui->legalNoticeButton, &QPushButton::clicked, this, &GeneralSettings::slotShowLegalNotice);

loadMiscSettings();
slotUpdateInfo();
Expand Down Expand Up @@ -192,4 +193,11 @@ void GeneralSettings::slotIgnoreFilesEditor()
}
}

void GeneralSettings::slotShowLegalNotice()
{
auto notice = new LegalNotice();
notice->exec();
delete notice;
}

} // namespace OCC
1 change: 1 addition & 0 deletions src/gui/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private slots:
void slotUpdateInfo();
void slotIgnoreFilesEditor();
void loadMiscSettings();
void slotShowLegalNotice();

private:
Ui::GeneralSettings *_ui;
Expand Down
76 changes: 50 additions & 26 deletions src/gui/generalsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,52 @@
<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">
Expand Down Expand Up @@ -47,28 +93,6 @@
</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>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="updatesGroupBox">
<property name="title">
Expand Down Expand Up @@ -270,12 +294,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>225</x>
<y>231</y>
<x>247</x>
<y>188</y>
</hint>
<hint type="destinationlabel">
<x>587</x>
<y>230</y>
<x>497</x>
<y>190</y>
</hint>
</hints>
</connection>
Expand Down
44 changes: 44 additions & 0 deletions src/gui/legalnotice.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) by Roeland Jago Douma <[email protected]>
*
* 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 "legalnotice.h"
#include "ui_legalnotice.h"

namespace OCC {


LegalNotice::LegalNotice(QDialog *parent)
: QDialog(parent)
, _ui(new Ui::LegalNotice)
{
_ui->setupUi(this);

QString notice = tr("<p>Copyright 2017-2018 Nextcloud GmbH<br />"
"Copyright 2012-2018 ownCloud GmbH</p>");

notice += tr("<p>Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.</p>");

_ui->notice->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
_ui->notice->setText(notice);
_ui->notice->setWordWrap(true);

connect(_ui->closeButton, &QPushButton::clicked, this, &LegalNotice::accept);
}

LegalNotice::~LegalNotice()
{
delete _ui;
}

}
45 changes: 45 additions & 0 deletions src/gui/legalnotice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) by Roeland Jago Douma <[email protected]>
*
* 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 LEGALNOTICE_H
#define LEGALNOTICE_H

#include <QDialog>

namespace OCC {
class IgnoreListEditor;
class SyncLogDialog;

namespace Ui {
class LegalNotice;
}

/**
* @brief The LegalNotice class
* @ingroup gui
*/
class LegalNotice : public QDialog
{
Q_OBJECT

public:
explicit LegalNotice(QDialog *parent = 0);
~LegalNotice();

private:
Ui::LegalNotice *_ui;
};

} // namespace OCC
#endif // LEGALNOTICE_H
68 changes: 68 additions & 0 deletions src/gui/legalnotice.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OCC::LegalNotice</class>
<widget class="QDialog" name="OCC::LegalNotice">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>291</width>
<height>260</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="header">
<property name="font">
<font>
<family>Arabic Newspaper</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="text">
<string>Legal notice</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="notice">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
9 changes: 1 addition & 8 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,7 @@ QString Theme::about() const
.arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN))
.arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN));

devString += tr("<p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, "
"Olivier Goffart, Markus Götz and others.</small></p>");

devString += tr("<p>This release was supplied by the Nextcloud GmbH<br />"
"Copyright 2017-2018 Nextcloud GmbH<br />"
"Copyright 2012-2018 ownCloud GmbH</p>");

devString += tr("<p>Licensed under the GNU General Public License (GPL) Version 2.0 or any later version.</p>");
devString += tr("<p>This release was supplied by the Nextcloud GmbH</p>");

devString += gitSHA1();

Expand Down

0 comments on commit e0f4997

Please sign in to comment.