Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ GPSBABEL_EMBED_TRANSLATIONS:BOOL:ON|OFF
GPSBABEL_ENABLE_PCH:BOOL
Enable precompiled headers when building the target gpsbabel.

GPSBABEL_UPGRADE_CHECK:BOOL
Enable the graphical user interface upgrade check and usage statistic reporting.

GPSBABEL_EXTRA_COMPILE_OPTIONS:STRING
Extra compile options when building the target gpsbabel.

Expand Down
12 changes: 10 additions & 2 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ if(UNIX AND NOT APPLE)
set_target_properties(gpsbabelfe PROPERTIES RUNTIME_OUTPUT_DIRECTORY GPSBabelFE)
endif()

option(GPSBABEL_UPGRADE_CHECK "upgrade check and usage statistic reporting." ON)
if(NOT GPSBABEL_UPGRADE_CHECK)
target_compile_definitions(gpsbabelfe PRIVATE DISABLE_UPGRADE_CHECK)
endif()
# RESOURCES
list(APPEND RESOURCES app.qrc)
if(WIN32)
Expand Down Expand Up @@ -91,7 +95,9 @@ list(APPEND SOURCES optionsdlg.cc)
list(APPEND SOURCES preferences.cc)
list(APPEND SOURCES processwait.cc)
list(APPEND SOURCES runmachine.cc)
list(APPEND SOURCES upgrade.cc)
if(GPSBABEL_UPGRADE_CHECK)
list(APPEND SOURCES upgrade.cc)
endif()
list(APPEND SOURCES version_mismatch.cc)

if(UNIX)
Expand Down Expand Up @@ -125,7 +131,9 @@ list(APPEND HEADERS preferences.h)
list(APPEND HEADERS processwait.h)
list(APPEND HEADERS runmachine.h)
list(APPEND HEADERS setting.h)
list(APPEND HEADERS upgrade.h)
if(GPSBABEL_UPGRADE_CHECK)
list(APPEND HEADERS upgrade.h)
endif()
list(APPEND HEADERS version_mismatch.h)

if(UNIX AND NOT APPLE)
Expand Down
6 changes: 6 additions & 0 deletions gui/aboutdlg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <QTextDocument> // for QTextDocument
#include <QTextEdit> // for QTextEdit
#include "appname.h" // for appName
#ifndef DISABLE_UPGRADE_CHECK
#include "upgrade.h" // for UpgradeCheck
#endif


AboutDlg::AboutDlg(QWidget* parent, const QString& ver1,
Expand Down Expand Up @@ -53,8 +55,12 @@ AboutDlg::AboutDlg(QWidget* parent, const QString& ver1,
tt.replace("$installationId$", installationId);

// Not localized as it should never be seen.
#ifndef DISABLE_UPGRADE_CHECK
tt.replace("$upgradetestmode$",
UpgradeCheck::isTestMode() ? "**Upgrade test mode**" : "");
#else
tt.remove("$upgradetestmode$");
#endif

doc->setHtml(tt);
QTextCursor cur(doc);
Expand Down
16 changes: 16 additions & 0 deletions gui/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@
#include "optionsdlg.h" // for OptionsDlg
#include "preferences.h" // for Preferences
#include "runmachine.h" // for RunMachine
#ifndef DISABLE_UPGRADE_CHECK
#include "upgrade.h" // for UpgradeCheck
#endif
#include "version_mismatch.h" // for VersionMismatch


Expand All @@ -98,6 +100,7 @@ QString MainWindow::findBabelVersion()
return str;
}

#ifndef DISABLE_UPGRADE_CHECK
//------------------------------------------------------------------------
// Decides whether available beta upgrades are suggested to user for download.
bool MainWindow::allowBetaUpgrades()
Expand All @@ -107,6 +110,7 @@ bool MainWindow::allowBetaUpgrades()
// 'suggest beta upgrade' box, allow betas to be suggested for installation.
return isBeta_ || babelData_.allowBetaUpgrades_;
}
#endif

//------------------------------------------------------------------------
static QString MakeOptions(const QList<FormatOption>& options)
Expand Down Expand Up @@ -170,7 +174,11 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
connect(ui_.actionAbout, &QAction::triggered, this, &MainWindow::aboutActionX);
connect(ui_.actionVisit_Website, &QAction::triggered, this, &MainWindow::visitWebsiteActionX);
connect(ui_.actionMake_a_Donation, &QAction::triggered, this, &MainWindow::donateActionX);
#ifndef DISABLE_UPGRADE_CHECK
connect(ui_.actionUpgradeCheck, &QAction::triggered, this, &MainWindow::upgradeCheckActionX);
#else
ui_.menuHelp->removeAction(ui_.actionUpgradeCheck);
#endif
connect(ui_.actionPreferences, &QAction::triggered, this, &MainWindow::preferencesActionX);

connect(ui_.inputFormatCombo, &QComboBox::currentIndexChanged,
Expand Down Expand Up @@ -222,11 +230,13 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent)
//--- Restore from registry
restoreSettings();

#ifndef DISABLE_UPGRADE_CHECK
upgrade = new UpgradeCheck(this, formatList_, babelData_);
if (babelData_.startupVersionCheck_) {
upgrade->checkForUpgrade(babelVersion_, babelData_.upgradeCheckTime_,
allowBetaUpgrades());
}
#endif

if (!babelData_.ignoreVersionMismatch_ && babelVersion_ != VERSION) {
VersionMismatch vm(nullptr, babelVersion_, QString(VERSION));
Expand Down Expand Up @@ -1000,10 +1010,12 @@ void MainWindow::applyActionX()
//------------------------------------------------------------------------
void MainWindow::closeActionX()
{
#ifndef DISABLE_UPGRADE_CHECK
QDateTime wt= upgrade->getUpgradeWarningTime();
if (wt.isValid()) {
babelData_.upgradeCheckTime_ = wt;
}
#endif
babelData_.runCount_++;

QDateTime now = QDateTime::currentDateTime();
Expand Down Expand Up @@ -1148,13 +1160,15 @@ void MainWindow::aboutActionX()
aboutDlg.exec();
}

#ifndef DISABLE_UPGRADE_CHECK
//------------------------------------------------------------------------
void MainWindow::upgradeCheckActionX()
{
upgrade->checkForUpgrade(babelVersion_,
QDateTime(QDate(2000, 1, 1), QTime(0, 0)),
allowBetaUpgrades());
}
#endif

//------------------------------------------------------------------------
void MainWindow::preferencesActionX()
Expand Down Expand Up @@ -1198,7 +1212,9 @@ void MainWindow::updateFilterStatus()
//------------------------------------------------------------------------
void MainWindow::setWidgetValues()
{
#ifndef DISABLE_UPGRADE_CHECK
ui_.actionUpgradeCheck->setEnabled(babelData_.upgradeMenuEnabled_);
#endif
if (babelData_.inputType_ == BabelData::fileType_) {
ui_.inputFileOptBtn->setChecked(true);
inputFileOptBtnClicked();
Expand Down
6 changes: 6 additions & 0 deletions gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
#include "filterdata.h" // for AllFiltersData
#include "format.h" // for Format
#include "ui_mainwinui.h" // for Ui_MainWindow
#ifndef DISABLE_UPGRADE_CHECK
#include "upgrade.h" // for UpgradeCheck
#endif


class MainWindow: public QMainWindow
Expand Down Expand Up @@ -101,8 +103,10 @@ class MainWindow: public QMainWindow
void updateFilterStatus();
void setWidgetValues();
void getWidgetValues();
#ifndef DISABLE_UPGRADE_CHECK
UpgradeCheck* upgrade;
bool allowBetaUpgrades();
#endif
void osLoadDeviceNameCombos(QComboBox*);
QString getFormatNameForExtension(const QString& ext);

Expand Down Expand Up @@ -135,7 +139,9 @@ private slots:
void preferencesActionX();
void visitWebsiteActionX();
void resetFormatDefaults();
#ifndef DISABLE_UPGRADE_CHECK
void upgradeCheckActionX();
#endif


};
Expand Down
21 changes: 21 additions & 0 deletions gui/preferences.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,29 @@ Preferences::Preferences(QWidget* parent, QList<Format>& formatList,
ui_.mapPreviewCheck->setChecked(babelData_.mapPreviewEnabled_);
ui_.ignoreVersionMismatchCheck->setChecked(babelData_.ignoreVersionMismatch_);

#ifdef DISABLE_UPGRADE_CHECK
ui_.startupCheck->hide();
ui_.reportStatisticsCheck->hide();
ui_.upgradeMenuCheck->hide();

QLabel* noStartupCheckLabel = new QLabel(tr("This version never checks for a newer version on start."), ui_.privacy_tab);
noStartupCheckLabel->setObjectName("noStartupCheckLabel");
ui_.verticalLayout_5->insertWidget(0, noStartupCheckLabel);

QLabel* noReportStatisticsLabel = new QLabel(tr("This version never reports usage data."), ui_.privacy_tab);
noReportStatisticsLabel->setObjectName("noReportStatisticsLabel");
ui_.verticalLayout_5->insertWidget(1, noReportStatisticsLabel);

QLabel* noUpgradeMenuLabel = new QLabel(tr("This version does not include the ability to check for an upgrade."), ui_.privacy_tab);
noUpgradeMenuLabel->setObjectName("noUpgradeMenuLabel");
ui_.verticalLayout_5->insertWidget(2, noUpgradeMenuLabel);
#endif
#ifdef DISABLE_MAPPREVIEW
ui_.mapPreviewCheck->hide();

QLabel* noPreviewLabel = new QLabel(tr("The version does not include the map preview feature."), ui_.privacy_tab);
noPreviewLabel->setObjectName("noPreviewLabel");
ui_.verticalLayout_5->insertWidget(3, noPreviewLabel);
#endif

connect(ui_.buttonBox, &QDialogButtonBox::accepted, this, &Preferences::acceptClicked);
Expand Down
6 changes: 6 additions & 0 deletions xmldoc/chapters/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ distributed. The Qt provided translations still need to be distributed.
<para>Enable precompiled headers when building the target gpsbabel.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>GPSBABEL_UPGRADE_CHECK</term>
<listitem>
<para>Enable the graphical user interface upgrade check and usage statistic reporting.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>GPSBABEL_EXTRA_COMPILE_OPTIONS</term>
<listitem>
Expand Down