forked from gridcoin-community/Gridcoin-Research
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement custom upgrade notification dialog box
- Loading branch information
1 parent
2c39fb9
commit 8949735
Showing
14 changed files
with
227 additions
and
31 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
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
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
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,85 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>UpdateDialog</class> | ||
<widget class="QDialog" name="UpdateDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>609</width> | ||
<height>430</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QFormLayout" name="formLayout"> | ||
<item row="0" column="1"> | ||
<widget class="QLabel" name="versionData"> | ||
<property name="text"> | ||
<string>version</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="infoIcon"> | ||
<property name="text"> | ||
<string>icon</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QTextBrowser" name="versionDetails"/> | ||
</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/> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>UpdateDialog</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>UpdateDialog</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> |
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,55 @@ | ||
// Copyright (c) 2014-2024 The Gridcoin developers | ||
// Distributed under the MIT/X11 software license, see the accompanying | ||
// file COPYING or https://opensource.org/licenses/mit-license.php. | ||
|
||
#include "updatedialog.h" | ||
#include "qicon.h" | ||
#include "qstyle.h" | ||
#include "qt/decoration.h" | ||
|
||
#include "ui_updatedialog.h" | ||
|
||
UpdateDialog::UpdateDialog(QWidget* parent) | ||
: QDialog(parent) | ||
, ui(new Ui::UpdateDialog) | ||
{ | ||
ui->setupUi(this); | ||
|
||
resize(GRC::ScaleSize(this, width(), height())); | ||
} | ||
|
||
UpdateDialog::~UpdateDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void UpdateDialog::setVersion(QString version) | ||
{ | ||
ui->versionData->setText(version); | ||
} | ||
|
||
void UpdateDialog::setDetails(QString message) | ||
{ | ||
ui->versionDetails->setText(message); | ||
} | ||
|
||
void UpdateDialog::setUpgradeType(GRC::Upgrade::UpgradeType upgrade_type) | ||
{ | ||
QIcon info_icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation); | ||
QIcon warning_icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning); | ||
QIcon unkown_icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion); | ||
|
||
switch (upgrade_type) { | ||
case GRC::Upgrade::UpgradeType::Mandatory: | ||
ui->infoIcon->setPixmap(GRC::ScaleIcon(this, warning_icon, 48)); | ||
break; | ||
case GRC::Upgrade::UpgradeType::Leisure: | ||
[[fallthrough]]; | ||
case GRC::Upgrade::UpgradeType::Testnet: | ||
ui->infoIcon->setPixmap(GRC::ScaleIcon(this, info_icon, 48)); | ||
break; | ||
case GRC::Upgrade::Unknown: | ||
ui->infoIcon->setPixmap(GRC::ScaleIcon(this, unkown_icon, 48)); | ||
break; | ||
} | ||
} |
Oops, something went wrong.