mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-10-05 14:37:31 +03:00
enable updater dialog again and add a donate button
This commit is contained in:
parent
2652b7f9d2
commit
6c50891a5a
2
rsrc/Liberapay_Icon_Readme.md
Normal file
2
rsrc/Liberapay_Icon_Readme.md
Normal file
@ -0,0 +1,2 @@
|
||||
source: https://icon-icons.com/icon/liberapay/130890
|
||||
License: CC Atribution
|
BIN
rsrc/liberapay_icon_130890.png
Normal file
BIN
rsrc/liberapay_icon_130890.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
@ -66,5 +66,6 @@
|
||||
<file>misc.png</file>
|
||||
<file>misc@2x.png</file>
|
||||
<file>logo-type_light@2x.png</file>
|
||||
<file>liberapay_icon_130890.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -63,10 +63,10 @@ void openCloneDialog(CloneDialog::Kind kind)
|
||||
dialog->open();
|
||||
}
|
||||
|
||||
const QString donationUrlLiberapay = QStringLiteral("https://liberapay.com/Gittyup/donate");
|
||||
|
||||
} // anon. namespace
|
||||
|
||||
const QString MenuBar::donationUrlLiberapay = QStringLiteral("https://liberapay.com/Gittyup/donate");
|
||||
|
||||
bool MenuBar::sDebugMenuVisible = false;
|
||||
|
||||
static Hotkey newFileHotkey = HotkeyManager::registerHotkey(
|
||||
|
@ -48,6 +48,8 @@ public:
|
||||
*/
|
||||
bool isMaximized();
|
||||
|
||||
static const QString donationUrlLiberapay;
|
||||
|
||||
private:
|
||||
QWidget *window() const;
|
||||
/*!
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "UpdateDialog.h"
|
||||
#include "DownloadDialog.h"
|
||||
#include "Updater.h"
|
||||
#include "ui/MenuBar.h"
|
||||
#include "conf/Settings.h"
|
||||
#include "dialogs/IconLabel.h"
|
||||
#include <QCheckBox>
|
||||
@ -21,6 +22,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QTextBrowser>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDesktopServices>
|
||||
|
||||
namespace {
|
||||
|
||||
@ -87,10 +89,20 @@ UpdateDialog::UpdateDialog(
|
||||
reject();
|
||||
});
|
||||
|
||||
QHBoxLayout* l = new QHBoxLayout();
|
||||
QPushButton* supportButton = new QPushButton(QIcon(":/liberapay_icon_130890.png"), tr("Donate"), this);
|
||||
QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
l->addWidget(download);
|
||||
l->addItem(spacer);
|
||||
l->addWidget(supportButton);
|
||||
connect(supportButton, &QPushButton::pressed, [] () {
|
||||
QDesktopServices::openUrl(QUrl(MenuBar::donationUrlLiberapay));
|
||||
});
|
||||
|
||||
QVBoxLayout *content = new QVBoxLayout;
|
||||
content->addWidget(new QLabel(label, this));
|
||||
content->addWidget(browser);
|
||||
content->addWidget(download);
|
||||
content->addLayout(l);
|
||||
content->addWidget(buttons);
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
|
@ -75,24 +75,23 @@ Updater::Updater(QObject *parent)
|
||||
|
||||
connect(this, &Updater::updateAvailable,
|
||||
[this](const QString &version, const QString &log, const QString &link) {
|
||||
// For now the update dialog is disabled.
|
||||
// // Show the update dialog.
|
||||
// QVersionNumber appVersion =
|
||||
// QVersionNumber::fromString(QCoreApplication::applicationVersion());
|
||||
// QVersionNumber newVersion = QVersionNumber::fromString(version);
|
||||
// if (newVersion.majorVersion() > appVersion.majorVersion() ||
|
||||
// !Settings::instance()->value("update/download").toBool()) {
|
||||
// UpdateDialog *dialog = new UpdateDialog(version, log, link);
|
||||
// connect(dialog, &UpdateDialog::rejected, this, &Updater::updateCanceled);
|
||||
// dialog->show();
|
||||
// return;
|
||||
// }
|
||||
// Show the update dialog.
|
||||
QVersionNumber appVersion =
|
||||
QVersionNumber::fromString(QCoreApplication::applicationVersion());
|
||||
QVersionNumber newVersion = QVersionNumber::fromString(version);
|
||||
if (newVersion.majorVersion() > appVersion.majorVersion() ||
|
||||
!Settings::instance()->value("update/download").toBool()) {
|
||||
UpdateDialog *dialog = new UpdateDialog(version, log, link);
|
||||
connect(dialog, &UpdateDialog::rejected, this, &Updater::updateCanceled);
|
||||
dialog->show();
|
||||
return;
|
||||
}
|
||||
|
||||
// // Skip the update dialog and just start downloading.
|
||||
// if (Updater::DownloadRef download = this->download(link)) {
|
||||
// DownloadDialog *dialog = new DownloadDialog(download);
|
||||
// dialog->show();
|
||||
// }
|
||||
// Skip the update dialog and just start downloading.
|
||||
if (Updater::DownloadRef download = this->download(link)) {
|
||||
DownloadDialog *dialog = new DownloadDialog(download);
|
||||
dialog->show();
|
||||
}
|
||||
});
|
||||
|
||||
connect(this, &Updater::updateError,
|
||||
|
Loading…
Reference in New Issue
Block a user