diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-07-16 15:44:05 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-07-16 15:44:05 +0900 |
commit | a30a266067d9d952edc91305bef757557c03717e (patch) | |
tree | 7bcabd84594f751001c66b16f3c42a8d459b7773 /src/UpdateCheckDialog.cpp | |
parent | d017bd37253ae35b29d82e3277b9adcbb4517dd0 (diff) | |
download | universal-indent-gui-tqt-a30a266067d9d952edc91305bef757557c03717e.tar.gz universal-indent-gui-tqt-a30a266067d9d952edc91305bef757557c03717e.zip |
Raw Qt->TQt conversion using tde/scripts/conversions/qt3-tqt3/convert_existing_qt3_app_to_tqt3.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/UpdateCheckDialog.cpp')
-rwxr-xr-x | src/UpdateCheckDialog.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/UpdateCheckDialog.cpp b/src/UpdateCheckDialog.cpp index 9a352a7..51f34d4 100755 --- a/src/UpdateCheckDialog.cpp +++ b/src/UpdateCheckDialog.cpp @@ -23,12 +23,12 @@ #include "UiGuiSettings.h" #include "UiGuiVersion.h" -#include <tqmessagebox.h> +#include <tntqmessagebox.h> #include <tqdesktopservices.h> #include <tqnetworkaccessmanager.h> -#include <tqtimer.h> +#include <tntqtimer.h> #include <tqdate.h> -#include <tqurl.h> +#include <tntqurl.h> #include <tqregexpvalidator.h> #include <tqnetworkrequest.h> #include <tqnetworkreply.h> @@ -44,26 +44,26 @@ /*! \brief Initializes member variables and stores the version of UiGui and a pointer to the _settings object. */ -UpdateCheckDialog::UpdateCheckDialog(QSharedPointer<UiGuiSettings> settings, QWidget *parent) : QDialog(parent), +UpdateCheckDialog::UpdateCheckDialog(TQSharedPointer<UiGuiSettings> settings, TQWidget *parent) : TQDialog(parent), _manualUpdateRequested(false), _currentNetworkReply(NULL), - _roleOfClickedButton(QDialogButtonBox::InvalidRole) + _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 QNetworkAccessManager(this); - connect( _networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(QNetworkReply*)) ); + _networkAccessManager = new TQNetworkAccessManager(this); + connect( _networkAccessManager, SIGNAL(finished(TQNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(TQNetworkReply*)) ); // Create a timer object used for the progress bar. - _updateCheckProgressTimer = new QTimer(this); + _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(QAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(QAbstractButton*)) ); + connect( _updateCheckDialogForm->buttonBox, SIGNAL(clicked(TQAbstractButton*)), this, SLOT(handleUpdateCheckDialogButtonClicked(TQAbstractButton*)) ); settings->registerObjectSlot(this, "initProxySettings()", "ProxyEnabled"); settings->registerObjectSlot(this, "initProxySettings()", "ProxyHostName"); @@ -84,7 +84,7 @@ UpdateCheckDialog::UpdateCheckDialog(QSharedPointer<UiGuiSettings> settings, QWi \brief On destroy cancels any currently running network request. */ UpdateCheckDialog::~UpdateCheckDialog() { - disconnect( _networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(QNetworkReply*)) ); + disconnect( _networkAccessManager, SIGNAL(finished(TQNetworkReply*)), this, SLOT(checkResultsOfFetchedPadXMLFile(TQNetworkReply*)) ); if (_currentNetworkReply != NULL) _currentNetworkReply->abort(); } @@ -121,7 +121,7 @@ void UpdateCheckDialog::checkForUpdate() { void UpdateCheckDialog::getPadXMLFile() { //_networkAccessManager->setHost("universalindent.sourceforge.net"); //_networkAccessManager->get("/universalindentgui_pad.xml"); - _currentNetworkReply = _networkAccessManager->get(QNetworkRequest(QUrl("http://universalindent.sourceforge.net/universalindentgui_pad.xml"))); + _currentNetworkReply = _networkAccessManager->get(TQNetworkRequest(TQUrl("http://universalindent.sourceforge.net/universalindentgui_pad.xml"))); } @@ -133,15 +133,15 @@ void UpdateCheckDialog::getPadXMLFile() { 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(QNetworkReply *networkReply) { +void UpdateCheckDialog::checkResultsOfFetchedPadXMLFile(TQNetworkReply *networkReply) { Q_ASSERT(_currentNetworkReply == networkReply); // Stop the progress bar timer. _updateCheckProgressTimer->stop(); - if ( networkReply->error() == QNetworkReply::NoError ) { + if ( networkReply->error() == TQNetworkReply::NoError ) { // Try to find the version string. - QString returnedString = networkReply->readAll(); + TQString returnedString = networkReply->readAll(); int leftPosition = returnedString.indexOf("<Program_Version>"); int rightPosition = returnedString.indexOf("</Program_Version>"); @@ -160,24 +160,24 @@ void UpdateCheckDialog::checkResultsOfFetchedPadXMLFile(QNetworkReply *networkRe showNewVersionAvailableDialog(returnedString); // If yes clicked, open the download url in the default browser. - if ( _roleOfClickedButton == QDialogButtonBox::YesRole ) { - QDesktopServices::openUrl( QUrl("_networkAccessManager://sourceforge.net/project/showfiles.php?group_id=167482") ); + 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", QDate::currentDate()); + _settings->setValueByName("LastUpdateCheck", TQDate::currentDate()); } // In the returned string, the version string could not be found. else { - QMessageBox::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.") ); + 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 != QDialogButtonBox::RejectRole ) { - QMessageBox::warning(this, tr("Update check error"), tr("There was an error while trying to check for an update! Error was : %1").arg(networkReply->errorString()) ); + 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; @@ -203,7 +203,7 @@ void UpdateCheckDialog::showCheckingForUpdateDialog() { _updateCheckDialogForm->progressBar->show(); setWindowTitle( tr("Checking for update...") ); _updateCheckDialogForm->label->setText( tr("Checking whether a newer version is available") ); - _updateCheckDialogForm->buttonBox->setStandardButtons(QDialogButtonBox::Cancel); + _updateCheckDialogForm->buttonBox->setStandardButtons(TQDialogButtonBox::Cancel); show(); } @@ -211,11 +211,11 @@ void UpdateCheckDialog::showCheckingForUpdateDialog() { /*! \brief Displays the dialog with info about the new available version. */ -void UpdateCheckDialog::showNewVersionAvailableDialog(QString newVersion) { +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(QDialogButtonBox::No|QDialogButtonBox::NoButton|QDialogButtonBox::Yes); + _updateCheckDialogForm->buttonBox->setStandardButtons(TQDialogButtonBox::No|TQDialogButtonBox::NoButton|TQDialogButtonBox::Yes); exec(); } @@ -227,7 +227,7 @@ 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(QDialogButtonBox::Ok); + _updateCheckDialogForm->buttonBox->setStandardButtons(TQDialogButtonBox::Ok); exec(); } @@ -241,10 +241,10 @@ void UpdateCheckDialog::showNoNewVersionAvailableDialog() { In any case if a button is clicked, the dialog box will be closed. */ -void UpdateCheckDialog::handleUpdateCheckDialogButtonClicked(QAbstractButton *clickedButton) { +void UpdateCheckDialog::handleUpdateCheckDialogButtonClicked(TQAbstractButton *clickedButton) { _roleOfClickedButton = _updateCheckDialogForm->buttonBox->buttonRole(clickedButton); - if ( _roleOfClickedButton == QDialogButtonBox::RejectRole ) { + if ( _roleOfClickedButton == TQDialogButtonBox::RejectRole ) { // Abort the _networkAccessManager request. _currentNetworkReply->abort(); // Stop the progress bar timer. @@ -287,15 +287,15 @@ void UpdateCheckDialog::updateUpdateCheckProgressBar() { Thus for example 12.5.170 will result in 12005170. */ -int UpdateCheckDialog::convertVersionStringToNumber(QString versionString) { +int UpdateCheckDialog::convertVersionStringToNumber(TQString versionString) { int versionInteger = 0; int pos = 0; - QRegExp regEx("\\d{1,3}.\\d{1,3}.\\d{1,3}"); - QRegExpValidator validator(regEx, NULL); + TQRegExp regEx("\\d{1,3}.\\d{1,3}.\\d{1,3}"); + TQRegExpValidator validator(regEx, NULL); - if ( validator.validate(versionString, pos) == QValidator::Acceptable ) { - QStringList versionNumberStringList = versionString.split("."); + 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(); @@ -310,13 +310,13 @@ int UpdateCheckDialog::convertVersionStringToNumber(QString versionString) { void UpdateCheckDialog::initProxySettings() { if ( _settings->getValueByName("ProxyEnabled") == true ) { - QString proxyHostName = _settings->getValueByName("ProxyHostName").toString(); + TQString proxyHostName = _settings->getValueByName("ProxyHostName").toString(); int proxyPort = _settings->getValueByName("ProxyPort").toInt(); - QString proxyUserName = _settings->getValueByName("ProxyUserName").toString(); - QString proxyPassword = _settings->getValueByName("ProxyPassword").toString(); - _networkAccessManager->setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyHostName, proxyPort, proxyUserName, proxyPassword)); + TQString proxyUserName = _settings->getValueByName("ProxyUserName").toString(); + TQString proxyPassword = _settings->getValueByName("ProxyPassword").toString(); + _networkAccessManager->setProxy(TQNetworkProxy(TQNetworkProxy::Socks5Proxy, proxyHostName, proxyPort, proxyUserName, proxyPassword)); } else { - _networkAccessManager->setProxy(QNetworkProxy()); + _networkAccessManager->setProxy(TQNetworkProxy()); } } |