Show button "Check For Updates" in dialogs about Valentina and Tape. Move
settings to common file. --HG-- branch : feature
This commit is contained in:
parent
d61c1c13bf
commit
faae90363e
|
@ -30,6 +30,7 @@
|
|||
#include "ui_dialogabouttape.h"
|
||||
#include "../version.h"
|
||||
#include "../vmisc/def.h"
|
||||
#include "../fervor/fvupdater.h"
|
||||
|
||||
#include <QDate>
|
||||
#include <QDesktopServices>
|
||||
|
@ -49,8 +50,16 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
|
|||
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||
|
||||
RetranslateUi();
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, &DialogAboutTape::WebButtonClicked);
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, [this](){
|
||||
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||
{
|
||||
qWarning() << tr("Cannot open your default browser");
|
||||
}
|
||||
});
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
|
||||
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, [](){
|
||||
FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent();
|
||||
});
|
||||
|
||||
// By default on Windows font point size 8 points we need 11 like on Linux.
|
||||
FontPointSize(ui->label_Legal_Stuff, 11);
|
||||
|
@ -99,15 +108,6 @@ void DialogAboutTape::showEvent(QShowEvent *event)
|
|||
isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAboutTape::WebButtonClicked()
|
||||
{
|
||||
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||
{
|
||||
qWarning() << tr("Cannot open your default browser");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogAboutTape::FontPointSize(QWidget *w, int pointSize)
|
||||
{
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class DialogAboutTape;
|
||||
namespace Ui
|
||||
{
|
||||
class DialogAboutTape;
|
||||
}
|
||||
|
||||
class DialogAboutTape : public QDialog
|
||||
|
@ -40,16 +41,13 @@ class DialogAboutTape : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogAboutTape(QWidget *parent = 0);
|
||||
explicit DialogAboutTape(QWidget *parent = nullptr);
|
||||
virtual ~DialogAboutTape();
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private slots:
|
||||
void WebButtonClicked();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogAboutTape)
|
||||
Ui::DialogAboutTape *ui;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>559</width>
|
||||
<width>376</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -247,6 +247,15 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonCheckUpdate">
|
||||
<property name="text">
|
||||
<string>Check For Updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="autoFillBackground">
|
||||
|
@ -259,11 +268,13 @@
|
|||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../share/resources/tapeicon.qrc"/>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "tmainwindow.h"
|
||||
#include "mapplication.h"
|
||||
#include "../fervor/fvupdater.h"
|
||||
|
||||
#include <QMessageBox> // For QT_REQUIRE_VERSION
|
||||
#include <QTimer>
|
||||
|
@ -51,6 +52,9 @@ int main(int argc, char *argv[])
|
|||
MApplication app(argc, argv);
|
||||
app.InitOptions();
|
||||
|
||||
// Set feed URL before doing anything else
|
||||
FvUpdater::sharedUpdater()->SetFeedURL(defaultFeedURL);
|
||||
|
||||
QTimer::singleShot(0, &app, SLOT(ProcessCMD()));
|
||||
|
||||
return app.exec();
|
||||
|
|
|
@ -401,6 +401,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb
|
|||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
|
||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
|
||||
|
||||
# Fervor static library (depend on VMisc, IFC)
|
||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/fervor/$${DESTDIR}/ -lfervor
|
||||
|
||||
INCLUDEPATH += $$PWD/../../libs/fervor
|
||||
DEPENDPATH += $$PWD/../../libs/fervor
|
||||
|
||||
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/fervor.lib
|
||||
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/libfervor.a
|
||||
|
||||
#VMisc static library
|
||||
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <QtDebug>
|
||||
#include "../options.h"
|
||||
#include "../core/vapplication.h"
|
||||
#include "../fervor/fvupdater.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||
|
@ -60,7 +61,16 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
|||
|
||||
|
||||
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR));
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, &DialogAboutApp::webButtonClicked );
|
||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, [this](){
|
||||
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||
{
|
||||
qWarning() << tr("Cannot open your default browser");
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, [](){
|
||||
FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent();
|
||||
});
|
||||
|
||||
// By default on Windows font point size 8 points we need 11 like on Linux.
|
||||
FontPointSize(ui->label_Legal_Stuff, 11);
|
||||
|
@ -105,16 +115,3 @@ void DialogAboutApp::FontPointSize(QWidget *w, int pointSize)
|
|||
font.setPointSize(pointSize);
|
||||
w->setFont(font);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Fake button clicked
|
||||
*/
|
||||
void DialogAboutApp::webButtonClicked()
|
||||
{
|
||||
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
|
||||
{
|
||||
qWarning() << tr("Cannot open your default browser");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ class DialogAboutApp : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogAboutApp(QWidget *parent = 0);
|
||||
~DialogAboutApp();
|
||||
explicit DialogAboutApp(QWidget *parent = nullptr);
|
||||
virtual ~DialogAboutApp();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||
|
@ -53,9 +53,6 @@ private:
|
|||
Q_DISABLE_COPY(DialogAboutApp)
|
||||
|
||||
void FontPointSize(QWidget *w, int pointSize);
|
||||
|
||||
private slots:
|
||||
void webButtonClicked();
|
||||
};
|
||||
|
||||
#endif // DIALOGABOUTAPP_H
|
||||
|
|
|
@ -293,6 +293,15 @@ Bettina Gatzlaff </string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonCheckUpdate">
|
||||
<property name="text">
|
||||
<string>Check For Updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="autoFillBackground">
|
||||
|
@ -305,11 +314,13 @@ Bettina Gatzlaff </string>
|
|||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../../libs/vmisc/share/resources/icon.qrc"/>
|
||||
|
|
|
@ -57,11 +57,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
app.InitOptions();
|
||||
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
// Set feed URL before doing anything else
|
||||
FvUpdater::sharedUpdater()->SetFeedURL("http://localhost/updateapp/Appcast.xml");
|
||||
FvUpdater::sharedUpdater()->SetFeedURL(defaultFeedURL);
|
||||
|
||||
// Check for updates automatically
|
||||
FvUpdater::sharedUpdater()->CheckForUpdatesSilent();
|
||||
}
|
||||
|
||||
MainWindow w;
|
||||
#if !defined(Q_OS_MAC)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <QDesktopServices>
|
||||
#include <QDebug>
|
||||
|
||||
const QString defaultFeedURL = QStringLiteral("http://localhost/updateapp/Appcast.xml");
|
||||
|
||||
QPointer<FvUpdater> FvUpdater::m_Instance;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -177,7 +179,7 @@ void FvUpdater::UpdateInstallationConfirmed()
|
|||
// Open a link
|
||||
if (not QDesktopServices::openUrl(proposedUpdate->GetEnclosureUrl()))
|
||||
{
|
||||
showErrorDialog(tr("Unable to open a browser."), true);
|
||||
showErrorDialog(tr("Cannot open your default browser."), true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "fvupdatewindow.h"
|
||||
#include "fvavailableupdate.h"
|
||||
|
||||
extern const QString defaultFeedURL;
|
||||
|
||||
class FvUpdater : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -436,23 +436,29 @@ void VCommonSettings::SetPreferenceDialogSize(const QSize& sz)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VCommonSettings::GetLatestSkippedVersion() const
|
||||
{
|
||||
return value(SettingLatestSkippedVersion, 0x0).toInt();
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||
return settings.value(SettingLatestSkippedVersion, 0x0).toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetLatestSkippedVersion(int value)
|
||||
{
|
||||
setValue(SettingLatestSkippedVersion, value);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||
settings.setValue(SettingLatestSkippedVersion, value);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QDate VCommonSettings::GetDateOfLastRemind() const
|
||||
{
|
||||
return value(SettingDateOfLastRemind, QDate(1900, 1, 1)).toDate();
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||
return settings.value(SettingDateOfLastRemind, QDate(1900, 1, 1)).toDate();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VCommonSettings::SetDateOfLastRemind(const QDate &date)
|
||||
{
|
||||
setValue(SettingDateOfLastRemind, date);
|
||||
QSettings settings(this->format(), this->scope(), this->organizationName(), commonIniFilename);
|
||||
settings.setValue(SettingDateOfLastRemind, date);
|
||||
settings.sync();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user