Removed code related to 'Check for Update' functionality. This won't be part of this port.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 2 years ago
parent a80a494efe
commit a92640a3d9
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -158,7 +158,6 @@ HEADERS += src/AboutDialog.h \
src/UiGuiSettingsDialog.h \ src/UiGuiSettingsDialog.h \
src/UiGuiSystemInfo.h \ src/UiGuiSystemInfo.h \
src/UiGuiVersion.h \ src/UiGuiVersion.h \
src/UpdateCheckDialog.h \
src/debugging/TSLogger.h src/debugging/TSLogger.h
@ -166,7 +165,6 @@ FORMS += src/MainWindow.ui \
src/ToolBarWidget.ui \ src/ToolBarWidget.ui \
src/UiGuiSettingsDialog.ui \ src/UiGuiSettingsDialog.ui \
src/AboutDialog.ui \ src/AboutDialog.ui \
src/UpdateCheckDialog.ui \
src/debugging/TSLoggerDialog.ui src/debugging/TSLoggerDialog.ui
SOURCES += src/AboutDialog.cpp \ SOURCES += src/AboutDialog.cpp \
@ -184,7 +182,6 @@ SOURCES += src/AboutDialog.cpp \
src/UiGuiSettingsDialog.cpp \ src/UiGuiSettingsDialog.cpp \
src/UiGuiSystemInfo.cpp \ src/UiGuiSystemInfo.cpp \
src/UiGuiVersion.cpp \ src/UiGuiVersion.cpp \
src/UpdateCheckDialog.cpp \
src/debugging/TSLogger.cpp src/debugging/TSLogger.cpp
RESOURCES += resources/Icons.qrc RESOURCES += resources/Icons.qrc

@ -1,48 +0,0 @@
<RCC>
<qresource prefix="/aboutDialog">
<file>qt_logo.png</file>
<file>banner.png</file>
</qresource>
<qresource prefix="/language">
<file>language-de.png</file>
<file>language-en.png</file>
<file>language-fr.png</file>
<file>language-ru.png</file>
<file>language-uk.png</file>
<file>language-zh_CN.png</file>
<file>language-zh_TW.png</file>
<file>language-ja.png</file>
</qresource>
<qresource prefix="/mainWindow">
<file>document-properties.png</file>
<file>Icon1.png</file>
<file>universalIndentGUI.svg</file>
<file>document-open.png</file>
<file>document-save-as.png</file>
<file>document-save.png</file>
<file>edit-clear.png</file>
<file>exporthtml.png</file>
<file>exportpdf.png</file>
<file>format-justify-left.png</file>
<file>help.png</file>
<file>icon2.png</file>
<file>icon3.png</file>
<file>info.png</file>
<file>live-preview.png</file>
<file>load_indent_cfg.png</file>
<file>preferences-system.png</file>
<file>save_indent_cfg.png</file>
<file>shell.png</file>
<file>syntax-highlight.png</file>
<file>system-log-out.png</file>
<file>system-software-update.png</file>
<file>tooltip.png</file>
<file>view-refresh.png</file>
</qresource>
<qresource prefix="/settingsDialog">
<file>accessories-text-editor.png</file>
<file>applications-system.png</file>
<file>icon3.png</file>
<file>syntax-highlight.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

@ -31,7 +31,6 @@
///-- #include "UiGuiSettingsDialog.h" ///-- #include "UiGuiSettingsDialog.h"
///-- #include "UiGuiHighlighter.h" ///-- #include "UiGuiHighlighter.h"
///-- #include "IndentHandler.h" ///-- #include "IndentHandler.h"
///-- #include "UpdateCheckDialog.h"
///-- ///--
#include <tqpixmap.h> #include <tqpixmap.h>
#include <tqaction.h> #include <tqaction.h>
@ -83,7 +82,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
///- _highlighter(NULL), _textEditVScrollBar(NULL), _aboutDialog(NULL), _aboutDialogGraphicsView( ///- _highlighter(NULL), _textEditVScrollBar(NULL), _aboutDialog(NULL), _aboutDialogGraphicsView(
///- NULL), _settingsDialog(NULL), _encodingActionGroup(NULL), _saveEncodedActionGroup(NULL), ///- NULL), _settingsDialog(NULL), _encodingActionGroup(NULL), _saveEncodedActionGroup(NULL),
///- _highlighterActionGroup(NULL), _uiGuiTranslator(NULL), _qTTranslator(NULL), _toolBarWidget( ///- _highlighterActionGroup(NULL), _uiGuiTranslator(NULL), _qTTranslator(NULL), _toolBarWidget(
///- NULL), _indentHandler(NULL), _updateCheckDialog(NULL), _textEditLineColumnInfoLabel(NULL) ///- NULL), _indentHandler(NULL), _textEditLineColumnInfoLabel(NULL)
{ {
///-- // Init of some variables. ///-- // Init of some variables.
///-- _sourceCodeChanged = false; ///-- _sourceCodeChanged = false;
@ -140,14 +139,6 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
///-- ///--
///-- updateSourceView(); ///-- updateSourceView();
///-- ///--
///-- // Check if a newer version is available but only if the setting for that is enabled and today not
///-- // already a check has been done.
///-- if (_settings->getValueByName("CheckForUpdate").toBool() &&
///-- TQDate::currentDate() != _settings->getValueByName("LastUpdateCheck").toDate())
///-- {
///-- _updateCheckDialog->checkForUpdate();
///-- }
///--
///-- // Enable accept dropping of files. ///-- // Enable accept dropping of files.
///-- setAcceptDrops(true); ///-- setAcceptDrops(true);
} }
@ -218,8 +209,6 @@ void MainWindow::initMainWindow()
///-- // ------------------------------- ///-- // -------------------------------
///-- _currentEncoding = _settings->getValueByName("encoding").toString(); ///-- _currentEncoding = _settings->getValueByName("encoding").toString();
///-- ///--
///-- _updateCheckDialog = new UpdateCheckDialog(_settings, this);
///--
///-- // Register the load last file setting in the menu to the _settings object. ///-- // Register the load last file setting in the menu to the _settings object.
///-- _settings->registerObjectProperty(actionLoadLastOpenedFileOnStartup, "checked", ///-- _settings->registerObjectProperty(actionLoadLastOpenedFileOnStartup, "checked",
///-- "loadLastSourceCodeFileOnStartup"); ///-- "loadLastSourceCodeFileOnStartup");
@ -237,8 +226,6 @@ void MainWindow::initMainWindow()
connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog())); connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog()));
connect(actionExportPDF, SIGNAL(activated()), this, SLOT(exportToPDF())); connect(actionExportPDF, SIGNAL(activated()), this, SLOT(exportToPDF()));
connect(actionExportHTML, SIGNAL(activated()), this, SLOT(exportToHTML())); connect(actionExportHTML, SIGNAL(activated()), this, SLOT(exportToHTML()));
///-- connect(_mainWindowForm->actionCheck_for_update, SIGNAL(triggered()), _updateCheckDialog,
///-- SLOT(checkForUpdateAndShowDialog()));
///-- connect(actionShowLog, SIGNAL(activated()), ///-- connect(actionShowLog, SIGNAL(activated()),
///-- debugging::TSLogger::getInstance(), SLOT(show())); ///-- debugging::TSLogger::getInstance(), SLOT(show()));
///-- ///--

@ -30,7 +30,6 @@
/// class AboutDialogGraphicsView; /// class AboutDialogGraphicsView;
/// class UiGuiHighlighter; /// class UiGuiHighlighter;
/// class IndentHandler; /// class IndentHandler;
/// class UpdateCheckDialog;
/// namespace Ui /// namespace Ui
/// { /// {
/// class ToolBarWidget; /// class ToolBarWidget;
@ -138,7 +137,6 @@ class MainWindow : public MainWindowBase
///-- ///--
///-- Ui::ToolBarWidget *_toolBarWidget; ///-- Ui::ToolBarWidget *_toolBarWidget;
///-- IndentHandler *_indentHandler; ///-- IndentHandler *_indentHandler;
///-- UpdateCheckDialog *_updateCheckDialog;
///-- TQLabel *_textEditLineColumnInfoLabel; ///-- TQLabel *_textEditLineColumnInfoLabel;
}; };

@ -115,21 +115,6 @@
<string>Ctrl+Shift+S</string> <string>Ctrl+Shift+S</string>
</property> </property>
</action> </action>
<action name="actionCheck_for_update">
<property name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/system-software-update.png</normaloff>:/mainWindow/system-software-update.png</iconset>
</property>
<property name="text">
<string>Check for update</string>
</property>
<property name="toolTip">
<string>Checks online whether a new version of UniversalIndentGUI is available.</string>
</property>
<property name="statusTip">
<string>Checks online whether a new version of UniversalIndentGUI is available.</string>
</property>
</action>
<action name="actionClear_Recently_Opened_List"> <action name="actionClear_Recently_Opened_List">
</action> </action>
</widget> </widget>

@ -204,12 +204,6 @@ bool UiGuiSettings::initSettings()
_availableTranslations.indexOf(_qsettings->value("UniversalIndentGUI/language", _availableTranslations.indexOf(_qsettings->value("UniversalIndentGUI/language",
"").toString())); "").toString()));
// Read the update check settings from the settings file.
_qsettings->setValue("UniversalIndentGUI/CheckForUpdate",
_qsettings->value("UniversalIndentGUI/CheckForUpdate", false));
_qsettings->setValue("UniversalIndentGUI/LastUpdateCheck",
_qsettings->value("UniversalIndentGUI/LastUpdateCheck", TQDate(1900, 1, 1)));
// Read the main window state. // Read the main window state.
_qsettings->setValue("UniversalIndentGUI/MainWindowState", _qsettings->setValue("UniversalIndentGUI/MainWindowState",
_qsettings->value("UniversalIndentGUI/MainWindowState", TQByteArray())); _qsettings->value("UniversalIndentGUI/MainWindowState", TQByteArray()));

@ -284,171 +284,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="TQWidget" name="tab_4">
<attribute name="icon">
<iconset resource="../resources/Icons.qrc">
<normaloff>:/mainWindow/system-software-update.png</normaloff>:/mainWindow/system-software-update.png</iconset>
</attribute>
<attribute name="title">
<string>Network</string>
</attribute>
<layout class="TQVBoxLayout" name="verticalLayout">
<item>
<widget class="TQCheckBox" name="checkForUpdateCheckBox">
<property name="toolTip">
<string>Checks whether a new version of UniversalIndentGUI exists on program start, but only once a day.</string>
</property>
<property name="text">
<string>Check online for update on program start</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">CheckForUpdate</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<widget class="TQGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="TQVBoxLayout" name="verticalLayout_5">
<item>
<widget class="TQCheckBox" name="enableProxyCheckBox">
<property name="toolTip">
<string>If checked, the made proxy settings will be applied for all network connections. Type of the used proxy is SOCKS5.</string>
</property>
<property name="text">
<string>Enable proxy</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyEnabled</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">checked</string>
</property>
</widget>
</item>
<item>
<widget class="TQWidget" name="widget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="TQGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="TQLabel" name="label_2">
<property name="text">
<string>Host name:</string>
</property>
<property name="buddy">
<cstring>proxyHostNameLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="TQLineEdit" name="proxyHostNameLineEdit">
<property name="toolTip">
<string>Host name of the to be used proxy. E.g.: proxy.example.com</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyHostName</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="TQLabel" name="label_3">
<property name="text">
<string>Port:</string>
</property>
<property name="buddy">
<cstring>proxyPortSpinBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="TQSpinBox" name="proxyPortSpinBox">
<property name="toolTip">
<string>Port number to connect to the before named proxy.</string>
</property>
<property name="alignment">
<set>TQt::AlignRight|TQt::AlignTrailing|TQt::AlignVCenter</set>
</property>
<property name="buttonSymbols">
<enum>TQAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyPort</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="TQLabel" name="label_4">
<property name="text">
<string>User name:</string>
</property>
<property name="buddy">
<cstring>proxyUserNameLineEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="TQLineEdit" name="proxyUserNameLineEdit">
<property name="toolTip">
<string>If the proxy needs authentification, enter the login name here.</string>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyUserName</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="TQLabel" name="label_6">
<property name="text">
<string>Password:</string>
</property>
<property name="buddy">
<cstring>proxyPasswordLineEdit</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="TQLineEdit" name="proxyPasswordLineEdit">
<property name="toolTip">
<string>If the proxy needs authentification, enter the password here.</string>
</property>
<property name="echoMode">
<enum>TQLineEdit::Password</enum>
</property>
<property name="connectedSettingName" stdset="0">
<string notr="true">ProxyPassword</string>
</property>
<property name="connectedPropertyName" stdset="0">
<string notr="true">text</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="TQWidget" name="tab_3"> <widget class="TQWidget" name="tab_3">
<attribute name="icon"> <attribute name="icon">
<iconset resource="../resources/Icons.qrc"> <iconset resource="../resources/Icons.qrc">

@ -1,356 +0,0 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UpdateCheckDialog.h"
#include "ui_UpdateCheckDialog.h"
#include "UiGuiSettings.h"
#include "UiGuiVersion.h"
#include <tntqmessagebox.h>
#include <tqdesktopservices.h>
#include <tqnetworkaccessmanager.h>
#include <tntqtimer.h>
#include <tqdate.h>
#include <tntqurl.h>
#include <tqregexpvalidator.h>
#include <tqnetworkrequest.h>
#include <tqnetworkreply.h>
#include <tqnetworkproxy.h>
/*!
\class UpdateCheckDialog
\ingroup grp_MainWindow
\brief UpdateCheckDialog is a dialog widget that contains functions
for online checking for a new version of UniversalIndentGUI.
*/
/*!
\brief Initializes member variables and stores the version of UiGui and a pointer to the _settings object.
*/
UpdateCheckDialog::UpdateCheckDialog(TQSharedPointer<UiGuiSettings> settings, TQWidget *parent) :
TQDialog(parent), _manualUpdateRequested(false), _currentNetworkReply(NULL),
_roleOfClickedButton(TQDialogButtonBox::InvalidRole)
{
_updateCheckDialogForm = new Ui::UpdateCheckDialog();
_updateCheckDialogForm->setupUi(this);
// Create object for _networkAccessManager request and connect it with the request return handler.
_networkAccessManager = new TQNetworkAccessManager(this);
connect(_networkAccessManager, SIGNAL(finished(TQNetworkReply*)), this,
SLOT(checkResultsOfFetchedPadXMLFile(TQNetworkReply*)));
// Create a timer object used for the progress bar.
_updateCheckProgressTimer = new TQTimer(this);
_updateCheckProgressTimer->setInterval(5);
connect(_updateCheckProgressTimer, SIGNAL(timeout()), this, SLOT(updateUpdateCheckProgressBar()));
_updateCheckProgressCounter = 0;
// Connect the dialogs buttonbox with a button click handler.
connect(_updateCheckDialogForm->buttonBox, SIGNAL(clicked(TQAbstractButton*)), this,
SLOT(handleUpdateCheckDialogButtonClicked(TQAbstractButton*)));
settings->registerObjectSlot(this, "initProxySettings()", "ProxyEnabled");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyHostName");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyPort");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyUserName");
settings->registerObjectSlot(this, "initProxySettings()", "ProxyPassword");
_settings = settings;
initProxySettings();
// This dialog is always modal.
setModal(true);
}
/*!
\brief On destroy cancels any currently running network request.
*/
UpdateCheckDialog::~UpdateCheckDialog()
{
disconnect(_networkAccessManager, SIGNAL(finished(TQNetworkReply*)), this,
SLOT(checkResultsOfFetchedPadXMLFile(TQNetworkReply*)));
if (_currentNetworkReply != NULL)
{
_currentNetworkReply->abort();
}
}
/*!
\brief This slot should be called, if an update check is manually invoked.
In difference to the automatic update check, during manual update check request
a modal progress indicator dialog will be shown.
*/
void UpdateCheckDialog::checkForUpdateAndShowDialog()
{
_manualUpdateRequested = true;
getPadXMLFile();
showCheckingForUpdateDialog();
}
/*!
\brief This slot should be called, if an update check is automatically invoked.
An automatic invoked update check should run in background, so the user
gets not interrupted by a dialog box.
*/
void UpdateCheckDialog::checkForUpdate()
{
_manualUpdateRequested = false;
getPadXMLFile();
}
/*!
\brief This function tries to download the UniversalIndentGui pad file from the SourceForge server.
*/
void UpdateCheckDialog::getPadXMLFile()
{
//_networkAccessManager->setHost("universalindent.sourceforge.net");
//_networkAccessManager->get("/universalindentgui_pad.xml");
_currentNetworkReply = _networkAccessManager->get(TQNetworkRequest(TQUrl(
"http://universalindent.sourceforge.net/universalindentgui_pad.xml")));
}
/*!
\brief This slot is called after the update check has returned, either by successfully
retrieving the pad file, or on any kind of network error.
Shows a message if check was successful or not. Offers the user to go to the
download page if a newer version exists. In case of an error during update
check, a message box with the error will be displayed.
*/
void UpdateCheckDialog::checkResultsOfFetchedPadXMLFile(TQNetworkReply *networkReply)
{
Q_ASSERT(_currentNetworkReply == networkReply);
// Stop the progress bar timer.
_updateCheckProgressTimer->stop();
if (networkReply->error() == TQNetworkReply::NoError)
{
// Try to find the version string.
TQString returnedString = networkReply->readAll();
int leftPosition = returnedString.indexOf("<Program_Version>");
int rightPosition = returnedString.indexOf("</Program_Version>");
// If the version string could be found in the returned string, show an update dialog and set
// last update check date.
if (leftPosition != -1 && rightPosition != -1)
{
// Get the pure version string from returned string.
returnedString = returnedString.mid(leftPosition + 17, rightPosition - (leftPosition + 17));
// Create integer values from the version strings.
int versionOnServerInt = convertVersionStringToNumber(returnedString);
int currentVersionInt = convertVersionStringToNumber(PROGRAM_VERSION_STRING);
// Only show update dialog, if the current version number is lower than the one received from
// the server.
if (versionOnServerInt > currentVersionInt && currentVersionInt >= 0 &&
versionOnServerInt >= 0)
{
// Show message box whether to download the new version.
showNewVersionAvailableDialog(returnedString);
// If yes clicked, open the download url in the default browser.
if (_roleOfClickedButton == TQDialogButtonBox::YesRole)
{
TQDesktopServices::openUrl(TQUrl(
"_networkAccessManager://sourceforge.net/project/showfiles.php?group_id=167482"));
}
}
else if (_manualUpdateRequested)
{
showNoNewVersionAvailableDialog();
}
// Set last update check date.
_settings->setValueByName("LastUpdateCheck", TQDate::currentDate());
}
// In the returned string, the version string could not be found.
else
{
TQMessageBox::warning(this, tr("Update check error"), tr(
"There was an error while trying to check for an update! The retrieved file did not contain expected content."));
}
}
// If there was some error while trying to retrieve the update info from server and not cancel was
// pressed.
else if (_roleOfClickedButton != TQDialogButtonBox::RejectRole)
{
TQMessageBox::warning(this, tr("Update check error"),
tr("There was an error while trying to check for an update! Error was : %1").arg(
networkReply->errorString()));
hide();
}
_manualUpdateRequested = false;
networkReply->deleteLater();
_currentNetworkReply = NULL;
}
/*!
\brief Displays the progress bar during update check.
For displaying activity during update check, a timer is started to
updated the progress bar. The user can press a cancel button to
stop the update check.
*/
void UpdateCheckDialog::showCheckingForUpdateDialog()
{
// Reset the progress bar.
_updateCheckProgressCounter = 0;
_updateCheckDialogForm->progressBar->setValue(_updateCheckProgressCounter);
_updateCheckDialogForm->progressBar->setInvertedAppearance(false);
_updateCheckProgressTimer->start();
_updateCheckDialogForm->progressBar->show();
setWindowTitle(tr("Checking for update..."));
_updateCheckDialogForm->label->setText(tr("Checking whether a newer version is available"));
_updateCheckDialogForm->buttonBox->setStandardButtons(TQDialogButtonBox::Cancel);
show();
}
/*!
\brief Displays the dialog with info about the new available version.
*/
void UpdateCheckDialog::showNewVersionAvailableDialog(TQString newVersion)
{
_updateCheckDialogForm->progressBar->hide();
setWindowTitle(tr("Update available"));
_updateCheckDialogForm->label->setText(tr(
"A newer version of UniversalIndentGUI is available.\nYour version is %1. New version is %2.\nDo you want to go to the download website?").arg(
PROGRAM_VERSION_STRING).arg(newVersion));
_updateCheckDialogForm->buttonBox->setStandardButtons(
TQDialogButtonBox::No | TQDialogButtonBox::NoButton | TQDialogButtonBox::Yes);
exec();
}
/*!
\brief Displays the dialog, that no new version is available.
*/
void UpdateCheckDialog::showNoNewVersionAvailableDialog()
{
_updateCheckDialogForm->progressBar->hide();
setWindowTitle(tr("No new update available"));
_updateCheckDialogForm->label->setText(tr(
"You already have the latest version of UniversalIndentGUI."));
_updateCheckDialogForm->buttonBox->setStandardButtons(TQDialogButtonBox::Ok);
exec();
}
/*!
\brief This slot is called, when a button in the dialog is clicked.
If the clicked button was the cancel button, the user wants to cancel
the update check. So the _networkAccessManager request is aborted and the timer for the
progress bar animation is stopped.
In any case if a button is clicked, the dialog box will be closed.
*/
void UpdateCheckDialog::handleUpdateCheckDialogButtonClicked(TQAbstractButton *clickedButton)
{
_roleOfClickedButton = _updateCheckDialogForm->buttonBox->buttonRole(clickedButton);
if (_roleOfClickedButton == TQDialogButtonBox::RejectRole)
{
// Abort the _networkAccessManager request.
_currentNetworkReply->abort();
// Stop the progress bar timer.
_updateCheckProgressTimer->stop();
}
accept();
}
/*!
\brief This slot is responsible for the animation of the update check progress bar.
*/
void UpdateCheckDialog::updateUpdateCheckProgressBar()
{
// Depending on the progress bar direction, decrease or increase the progressbar value.
if (_updateCheckDialogForm->progressBar->invertedAppearance())
{
_updateCheckProgressCounter--;
}
else
{
_updateCheckProgressCounter++;
}
// If the progress bar reaches 0 or 100 as value, swap the animation direction.
if (_updateCheckProgressCounter == 0 || _updateCheckProgressCounter == 100)
{
_updateCheckDialogForm->progressBar->setInvertedAppearance(
!_updateCheckDialogForm->progressBar->invertedAppearance());
}
// Update the progress bar value.
_updateCheckDialogForm->progressBar->setValue(_updateCheckProgressCounter);
}
/*!
\brief Converts the as string given version \a versionString to an integer number.
The \a versionString must have the format x.x.x where each x represents a number
of a maximum of 999. If the input format is wrong, -1 will be returned.The first
number will be multiplied by 1000000 the second by 1000 and then all three will
be summarized.
Thus for example 12.5.170 will result in 12005170.
*/
int UpdateCheckDialog::convertVersionStringToNumber(TQString versionString)
{
int versionInteger = 0;
int pos = 0;
TQRegExp regEx("\\d{1,3}.\\d{1,3}.\\d{1,3}");
TQRegExpValidator validator(regEx, NULL);
if (validator.validate(versionString, pos) == TQValidator::Acceptable)
{
TQStringList versionNumberStringList = versionString.split(".");
versionInteger = versionNumberStringList.at(0).toInt() * 1000000;
versionInteger += versionNumberStringList.at(1).toInt() * 1000;
versionInteger += versionNumberStringList.at(2).toInt();
}
else
{
versionInteger = -1;
}
return versionInteger;
}
void UpdateCheckDialog::initProxySettings()
{
if (_settings->getValueByName("ProxyEnabled") == true)
{
TQString proxyHostName = _settings->getValueByName("ProxyHostName").toString();
int proxyPort = _settings->getValueByName("ProxyPort").toInt();
TQString proxyUserName = _settings->getValueByName("ProxyUserName").toString();
TQString proxyPassword = _settings->getValueByName("ProxyPassword").toString();
_networkAccessManager->setProxy(TQNetworkProxy(TQNetworkProxy::Socks5Proxy, proxyHostName,
proxyPort, proxyUserName, proxyPassword));
}
else
{
_networkAccessManager->setProxy(TQNetworkProxy());
}
}

@ -1,74 +0,0 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UPDATECHECKDIALOG_H
#define UPDATECHECKDIALOG_H
#include <tntqdialog.h>
#include <tqdialogbuttonbox.h>
class UiGuiSettings;
namespace Ui
{
class UpdateCheckDialog;
}
class TQTimer;
class TQDesktopServices;
class TQNetworkAccessManager;
class TQNetworkReply;
class UpdateCheckDialog : public TQDialog
{
Q_OBJECT
public:
UpdateCheckDialog(TQSharedPointer<UiGuiSettings> settings, TQWidget *parent = NULL);
~UpdateCheckDialog();
public slots:
void checkForUpdateAndShowDialog();
void checkForUpdate();
private slots:
void checkResultsOfFetchedPadXMLFile(TQNetworkReply *networkReply);
void handleUpdateCheckDialogButtonClicked(TQAbstractButton *clickedButton);
void updateUpdateCheckProgressBar();
void initProxySettings();
private:
Ui::UpdateCheckDialog *_updateCheckDialogForm;
void getPadXMLFile();
void showCheckingForUpdateDialog();
void showNewVersionAvailableDialog(TQString newVersion);
void showNoNewVersionAvailableDialog();
int convertVersionStringToNumber(TQString versionString);
TQSharedPointer<UiGuiSettings> _settings;
bool _manualUpdateRequested;
TQNetworkAccessManager *_networkAccessManager;
TQNetworkReply *_currentNetworkReply;
TQDialogButtonBox::ButtonRole _roleOfClickedButton;
TQTimer *_updateCheckProgressTimer;
int _updateCheckProgressCounter;
};
#endif // UPDATECHECKDIALOG_H

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UpdateCheckDialog</class>
<widget class="TQDialog" name="UpdateCheckDialog">
<property name="windowModality">
<enum>TQt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>323</width>
<height>108</height>
</rect>
</property>
<property name="windowTitle">
<string>Checking for update...</string>
</property>
<layout class="TQVBoxLayout">
<item>
<widget class="TQLabel" name="label">
<property name="text">
<string>Checking whether a newer version is available</string>
</property>
</widget>
</item>
<item>
<widget class="TQProgressBar" name="progressBar">
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="TQDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>TQDialogButtonBox::Cancel</set>
</property>
<property name="centerButtons">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Loading…
Cancel
Save