Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt Update dialogs to the new modal widget experience
Fixes: #11593
- Loading branch information
Showing
8 changed files
with
320 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (C) 2023 by Erik Verbruggen <erik@verbruggen.consulting> | ||
* | ||
* 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 "nourlwidget.h" | ||
#include "theme.h" | ||
#include "ui_nourlwidget.h" | ||
|
||
#include <QDialogButtonBox> | ||
#include <QPushButton> | ||
|
||
namespace OCC { | ||
|
||
NoUrlWidget::NoUrlWidget(QWidget *parent, const QString &statusMessage) | ||
: QWidget(parent) | ||
, _ui(new ::Ui::Ui_NoUrlWidget) | ||
{ | ||
_ui->setupUi(this); | ||
|
||
_ui->icon->setPixmap(Theme::instance()->applicationIcon().pixmap(128, 128)); | ||
_ui->label->setText(statusMessage); | ||
|
||
QPushButton *skipButton = _ui->buttonBox->addButton(tr("Skip this version"), QDialogButtonBox::ResetRole); | ||
QPushButton *getUpdateButton = _ui->buttonBox->addButton(tr("Get update"), QDialogButtonBox::AcceptRole); | ||
QPushButton *rejectButton = _ui->buttonBox->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole); | ||
|
||
connect(skipButton, &QAbstractButton::clicked, this, &NoUrlWidget::skipVersion); | ||
connect(rejectButton, &QAbstractButton::clicked, this, &NoUrlWidget::notNow); | ||
connect(getUpdateButton, &QAbstractButton::clicked, this, &NoUrlWidget::getUpdate); | ||
} | ||
|
||
void NoUrlWidget::skipVersion() | ||
{ | ||
close(); | ||
Q_EMIT versionSkipped(); | ||
} | ||
|
||
void NoUrlWidget::notNow() | ||
{ | ||
close(); | ||
Q_EMIT noUpdateNow(); | ||
} | ||
|
||
void NoUrlWidget::getUpdate() | ||
{ | ||
close(); | ||
Q_EMIT updateNow(); | ||
} | ||
|
||
} // OCC namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2023 by Fabian Müller <fmueller@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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <QScopedPointer> | ||
#include <QWidget> | ||
|
||
namespace Ui { | ||
class Ui_NoUrlWidget; | ||
} | ||
|
||
namespace OCC { | ||
|
||
class NoUrlWidget : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit NoUrlWidget(QWidget *parent, const QString &statusMessage); | ||
|
||
private Q_SLOTS: | ||
void skipVersion(); | ||
void notNow(); | ||
void getUpdate(); | ||
|
||
Q_SIGNALS: | ||
void versionSkipped(); | ||
void noUpdateNow(); | ||
void updateNow(); | ||
|
||
private: | ||
QScopedPointer<::Ui::Ui_NoUrlWidget> _ui; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Ui::NoUrlWidget</class> | ||
<widget class="QWidget" name="Ui::NoUrlWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<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> | ||
<item> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="icon"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>128</width> | ||
<height>128</height> | ||
</size> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>128</width> | ||
<height>128</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
<property name="scaledContents"> | ||
<bool>true</bool> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QLabel" name="label"> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<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="QDialogButtonBox" name="buttonBox"> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::NoButton</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.