mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-17 13:37:18 +03:00
WIP
This commit is contained in:
parent
a465cafbf1
commit
aed4e67a0c
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@ -87,6 +87,11 @@ jobs:
|
||||
if: github.ref_type != 'tag'
|
||||
run: >
|
||||
sed -i 's@desktop-file-name-suffix: ""@desktop-file-name-suffix: " (Development)"@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml
|
||||
|
||||
- name: Enable automatic update
|
||||
if: github.ref_type != 'tag'
|
||||
run: >
|
||||
sed -i 's@-DENABLE_UPDATE_OVER_GUI=OFF@-DENABLE_UPDATE_OVER_GUI=ON@' com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml
|
||||
|
||||
- name: Show Flatpak manifest
|
||||
run: cat com.github.Murmele.Gittyup/com.github.Murmele.Gittyup.yml
|
||||
|
@ -50,12 +50,7 @@ set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
option(FLATPAK "Building for flatpak" OFF)
|
||||
option(DEBUG_FLATPAK "Building but using flatpak urls for testing" OFF)
|
||||
option(DISABLE_AUTOMATIC_UPDATE "Disable automatically updating Gittyup from the Gui instead of the package manager" OFF)
|
||||
if (${DISABLE_AUTOMATIC_UPDATE})
|
||||
message(FATAL_ERROR "Automatic update disabled")
|
||||
else()
|
||||
message(FATAL_ERROR ${DISABLE_AUTOMATIC_UPDATE})
|
||||
endif()
|
||||
option(ENABLE_UPDATE_OVER_GUI "Enable updating from the Gittyup gui" ON)
|
||||
option(USE_SYSTEM_OPENSSL "Use the system-wide OpenSSL installation" OFF)
|
||||
option(
|
||||
USE_SYSTEM_LIBGIT2
|
||||
@ -114,6 +109,10 @@ if(FLATPAK)
|
||||
add_compile_definitions(FLATPAK)
|
||||
endif()
|
||||
|
||||
if(ENABLE_UPDATE_OVER_GUI)
|
||||
add_compile_definitions(ENABLE_UPDATE_OVER_GUI)
|
||||
endif()
|
||||
|
||||
if(DEBUG_FLATPAK)
|
||||
add_compile_definitions(DEBUG_FLATPAK)
|
||||
endif()
|
||||
|
@ -25,6 +25,12 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
|
||||
#if ((!defined(Q_OS_LINUX) || defined(FLATPAK) || defined(DEBUG_FLATPAK)) && \
|
||||
defined(ENABLE_UPDATE_OVER_GUI))
|
||||
#define ENABLE_UPDATE 1
|
||||
#else
|
||||
#define ENABLE_UPDATE 0
|
||||
#endif
|
||||
namespace {
|
||||
|
||||
const QString kStyleSheet = "h3 {"
|
||||
@ -51,7 +57,14 @@ UpdateDialog::UpdateDialog(const QString &platform, const QString &version,
|
||||
iconLayout->addWidget(iconLabel);
|
||||
iconLayout->addStretch();
|
||||
|
||||
#ifndef Q_OS_LINUX
|
||||
#if !ENABLE_UPDATE
|
||||
QString label = tr("<h3>A new version of %1 is available!</h3>"
|
||||
"<p>%1 %2 is now available - you have %3. "
|
||||
"The new version will be soon available in your package "
|
||||
"manager. Just update your system.</p>"
|
||||
"<b>Release Notes:</b>")
|
||||
.arg(appName, version, appVersion);
|
||||
#elif !defined(Q_OS_LINUX)
|
||||
QString label = tr("<h3>A new version of %1 is available!</h3>"
|
||||
"<p>%1 %2 is now available - you have %3. "
|
||||
"Would you like to download it now?</p>"
|
||||
@ -82,7 +95,7 @@ UpdateDialog::UpdateDialog(const QString &platform, const QString &version,
|
||||
browser->document()->setDefaultStyleSheet(kStyleSheet);
|
||||
browser->setHtml(changelog);
|
||||
|
||||
#if !defined(Q_OS_LINUX) || defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
||||
#if ENABLE_UPDATE
|
||||
QCheckBox *download =
|
||||
new QCheckBox(tr("Automatically download and install updates"), this);
|
||||
download->setChecked(Settings::instance()
|
||||
@ -95,9 +108,8 @@ UpdateDialog::UpdateDialog(const QString &platform, const QString &version,
|
||||
#endif
|
||||
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(this);
|
||||
#if !defined(Q_OS_LINUX) || defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
||||
#if ENABLE_UPDATE
|
||||
buttons->addButton(tr("Install Update"), QDialogButtonBox::AcceptRole);
|
||||
#endif
|
||||
|
||||
buttons->addButton(tr("Remind Me Later"), QDialogButtonBox::RejectRole);
|
||||
connect(buttons, &QDialogButtonBox::accepted, this, &UpdateDialog::accept);
|
||||
@ -115,13 +127,14 @@ UpdateDialog::UpdateDialog(const QString &platform, const QString &version,
|
||||
});
|
||||
|
||||
connect(buttons, &QDialogButtonBox::rejected, this, &UpdateDialog::reject);
|
||||
#endif
|
||||
|
||||
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);
|
||||
#if !defined(Q_OS_LINUX) || defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
||||
#if ENABLE_UPDATE
|
||||
l->addWidget(download);
|
||||
#endif
|
||||
l->addItem(spacer);
|
||||
|
Loading…
Reference in New Issue
Block a user