From bcf0b2fc1d9e238553a4d10e4fd6d84a6b68b5f3 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Mon, 22 Jun 2026 15:50:12 +0800 Subject: [PATCH] cleaning\ncorrections of code --- RsyncUI.pro | 20 +- RsyncUI.pro.user | 537 +++++++++++++++++++---------------------------- RsyncUI.spec | 2 +- downloadfile.cpp | 12 -- downloadfile.h | 3 - main.cpp | 1 - mainwindow.cpp | 54 ++--- mainwindow.h | 49 +---- password.h | 8 +- tools.cpp | 41 +--- tools.h | 7 - version.h | 2 +- 12 files changed, 280 insertions(+), 456 deletions(-) diff --git a/RsyncUI.pro b/RsyncUI.pro index 4fbde2a..5d36f13 100644 --- a/RsyncUI.pro +++ b/RsyncUI.pro @@ -2,9 +2,9 @@ QT += core gui QT += widgets QT += network -LIBS += -lqt6keychain -LIBS += -lKF6ItemViews -LIBS += -lKF6Completion +LIBS += -lqt5keychain +LIBS += -lKF5ItemViews +LIBS += -lKF5Completion CONFIG += c++17 @@ -18,15 +18,15 @@ SOURCES += \ downloadfile.cpp \ main.cpp \ mainwindow.cpp \ - password.cpp \ - tools.cpp +password.cpp \ +tools.cpp HEADERS += \ version.h\ downloadfile.h \ mainwindow.h \ - password.h \ - tools.h +password.h \ +tools.h FORMS += \ about.ui \ @@ -37,8 +37,10 @@ TRANSLATIONS += \ RsyncUI_fr_FR.ts INCLUDEPATH += \ -/usr/include/KF6 \ -/usr/include/qt6keychain \ +/usr/include/KF5 \ +/usr/include/KF5/KCompletion \ +/usr/include/KF5/KItemViews \ +/usr/include/qt5keychain \ # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/RsyncUI.pro.user b/RsyncUI.pro.user index 8e0ad4b..7bd54c1 100755 --- a/RsyncUI.pro.user +++ b/RsyncUI.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -13,8 +13,8 @@ ProjectExplorer.Project.EditorSettings - true true + false true Cpp @@ -33,12 +33,10 @@ false 4 false - 0 80 true true 1 - 0 false true false @@ -80,7 +78,6 @@ true Builtin.DefaultTidyAndClazy 1 - false @@ -95,17 +92,16 @@ ProjectExplorer.Project.Target.0 Desktop - true - Qt 6.10 (Système) - Qt 6.10 (Système) - {162ab574-2a54-4c2d-8618-e1a907b81ecc} + Replacement for "Qt 5.15.7 in PATH (qt5)" + Replacement for "Qt 5.15.7 in PATH (qt5)" + {7fe200c1-f5ad-4deb-a8be-7d9bd4e961d5} 0 0 0 - 1 - /home/daniel/develop/RsyncUI/build/Qt_6_10-Debug - /home/daniel/develop/RsyncUI/build/Qt_6_10-Debug + 0 + /home/daniel/develop/rsyncui/../build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Debug + /home/daniel/develop/build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Debug true @@ -118,8 +114,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -129,8 +125,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -140,43 +136,174 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy + 2 + + + /home/daniel/develop/rsyncui/../build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Release + /home/daniel/develop/build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Release + + + true + QtProjectManager.QMakeBuildStep + false + - 1 - - false - ProjectExplorer.DefaultDeployConfiguration + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build - 1 - - true - true - 0 - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - Qt4ProjectManager.Qt4RunConfiguration: - /home/daniel/develop/RsyncUI/RsyncUI.pro - false - true - true - true - /home/daniel/develop/RsyncUI/build/Qt_6_10-Debug + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean - 1 + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + /home/daniel/develop/rsyncui/../build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Profile + /home/daniel/develop/build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:/home/daniel/develop/rsyncui/RsyncUI.pro + /home/daniel/develop/rsyncui/RsyncUI.pro + false + true + true + false + true + /home/daniel/develop/build-RsyncUI-Replacement_for_Qt_5_15_7_in_PATH_qt5-Debug + + 1 + + + + ProjectExplorer.Project.Target.1 + + Desktop + Qt 6.10 (Système) + Qt 6.10 (Système) + {162ab574-2a54-4c2d-8618-e1a907b81ecc} + 0 + 0 + 0 + + 1 + /home/daniel/develop/rsyncui/build/Qt_6_10-Debug + /home/daniel/develop/rsyncui/build/Qt_6_10-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration 2 1 + 0 0 @@ -194,8 +321,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -205,8 +332,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -216,39 +343,6 @@ Debug2 Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - Qt4ProjectManager.Qt4RunConfiguration: - /home/daniel/develop/RsyncUI/RsyncUI.pro - false - true - true - true - - 1 2 @@ -258,7 +352,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -266,8 +360,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -277,8 +371,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -288,39 +382,6 @@ Release Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - Qt4ProjectManager.Qt4RunConfiguration: - /home/daniel/develop/RsyncUI/RsyncUI.pro - false - true - true - true - - 1 0 0 @@ -332,7 +393,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -340,8 +401,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -351,8 +412,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -362,39 +423,6 @@ Profile Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - Qt4ProjectManager.Qt4RunConfiguration: - /home/daniel/develop/RsyncUI/RsyncUI.pro - false - true - true - true - - 1 0 0 0 @@ -406,7 +434,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -414,8 +442,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -425,8 +453,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -436,38 +464,6 @@ Release2 Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - ProjectExplorer.CustomExecutableRunConfiguration - - false - true - true - - 1 0 @@ -478,7 +474,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -486,8 +482,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -497,8 +493,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -508,38 +504,6 @@ Debug3 Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - ProjectExplorer.CustomExecutableRunConfiguration - - false - true - true - - 1 2 @@ -549,7 +513,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -557,8 +521,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -568,8 +532,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -579,38 +543,6 @@ Release3 Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - ProjectExplorer.CustomExecutableRunConfiguration - - false - true - true - - 1 0 0 @@ -622,7 +554,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -630,8 +562,8 @@ Qt4ProjectManager.MakeStep 2 - Compiler - Compiler + Build + Build ProjectExplorer.BuildSteps.Build @@ -641,8 +573,8 @@ clean 1 - Nettoyer - Nettoyer + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -652,38 +584,6 @@ Profile2 Qt4ProjectManager.Qt4BuildConfiguration - 0 - 0 - - - 0 - Déploiement - Déploiement - ProjectExplorer.BuildSteps.Deploy - - 1 - - false - ProjectExplorer.DefaultDeployConfiguration - - 1 - - true - true - true - - 2 - - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - ProjectExplorer.CustomExecutableRunConfiguration - - false - true - true - - 1 0 0 0 @@ -692,8 +592,8 @@ 0 - Déploiement - Déploiement + Deploy + Deploy ProjectExplorer.BuildSteps.Deploy 1 @@ -705,28 +605,25 @@ true true - 0 true 2 - false - -e cpu-cycles --call-graph dwarf,4096 -F 250 - - Qt4ProjectManager.Qt4RunConfiguration: - /home/daniel/develop/RsyncUI/RsyncUI.pro - false + RsyncUI2 + Qt4ProjectManager.Qt4RunConfiguration:/home/daniel/develop/rsyncui/RsyncUI.pro + /home/daniel/develop/rsyncui/RsyncUI.pro + false true true + false true - /home/daniel/develop/RsyncUI/build/Qt_6_10-Debug 1 ProjectExplorer.Project.TargetCount - 1 + 2 ProjectExplorer.Project.Updater.FileVersion diff --git a/RsyncUI.spec b/RsyncUI.spec index d9f7bff..f27f581 100644 --- a/RsyncUI.spec +++ b/RsyncUI.spec @@ -2,7 +2,7 @@ Name: rsyncui Summary: Client for rsync server -Version: 2.13.3 +Version: 2.13.4 Release: %mkrel 1 License: GPLv3 Group: Networking/Remote access diff --git a/downloadfile.cpp b/downloadfile.cpp index 9ca89ce..abcf6a5 100644 --- a/downloadfile.cpp +++ b/downloadfile.cpp @@ -1,18 +1,6 @@ #include "downloadfile.h" #include "tools.h" -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include using namespace std; diff --git a/downloadfile.h b/downloadfile.h index e3c29f9..cc0fda3 100644 --- a/downloadfile.h +++ b/downloadfile.h @@ -2,9 +2,6 @@ #define DOWNLOADFILE_H #include -#include -#include -#include class MainWindow; diff --git a/main.cpp b/main.cpp index 2d32ed3..d768e27 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,6 @@ #include "mainwindow.h" #include "tools.h" #include -#include int main(int argc, char *argv[]) { diff --git a/mainwindow.cpp b/mainwindow.cpp index 149ab41..66b6f8f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,6 +1,5 @@ #include "mainwindow.h" #include -//#include #include #include "ui_configuration.h" #include "version.h" @@ -8,8 +7,9 @@ #include "password.h" #include #include -#include -#include +#include +#include +#include using namespace std; @@ -542,6 +542,7 @@ void MainWindow::listServices() if (this->connexion.ipversion == 0) { + info(DEBUGMACRO, "test version of ip address of " + this->connexion.server); this->connexion.ipversion = whatIpVersion(this->connexion.server); } @@ -716,7 +717,7 @@ bool MainWindow::scanDir(Connexion * connexion, QTreeWidgetItem *parent, QString size = sizeA.at(0) + "," + sizeA.at(1).left(2) + " " + UnitText[sizeA.count()-1] + " "; } - if (line[0] == "d") + if (line[0] == 'd') { isDir = true; }else @@ -843,7 +844,7 @@ uint MainWindow::validateServer(QString *server) { line = line.mid(answerFound, queryPos - answerFound); info(DEBUGMACRO, "line is:\n" + line); - responseList = line.split(QRegExp("\\s+")); + responseList = line.split(QRegularExpression("\\s+")); info(DEBUGMACRO, "ip Address is => " + responseList.at(4)); if (serverAddress.setAddress(responseList.at(4))) { @@ -860,12 +861,12 @@ uint MainWindow::validateServer(QString *server) } } - info(DEBUGMACRO, "Returning ip version: " + QString::number(ipversion)); //ipversion = whatIpVersion(*server); ipversion = serverAddress.protocol(); + info(DEBUGMACRO, "Returning ip version: " + QString::number(ipversion)); - return (ipversion==IPV4?4:6); + return (ipversion == QAbstractSocket::IPv4Protocol?4:6); } @@ -897,7 +898,7 @@ void MainWindow::addTreeItem(QString name, QString fileSize, QString fullsize, Q QFont font; QTreeWidgetItem *treeItem; - info(DEBUGMACRO, "addTreeItem() => adding item to treeview"); + //info(DEBUGMACRO, "addTreeItem() => adding item to treeview"); if (parent != nullptr) { @@ -965,7 +966,7 @@ void MainWindow::preparePopulateTree() this->rescan = true; this->connexion.user = nullptr; this->connexion.password = nullptr; - str = "Folder/" + this->connexion.server + "/" + this->connexion.service; + str = "Folder/" + this->connexion.server + ":" + QByteArray::number(this->connexion.port) + "/" + this->connexion.service; // if service exists in settings for this server if (this->settings.contains(str)) @@ -1083,7 +1084,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD if (item->text(1) != tr("Dir") or downloadDir == true) { // exists saving path in settings ? - str = "Folder/" + this->connexion.server + "/" + this->connexion.service; + str = "Folder/" + this->connexion.server + ":" + QByteArray::number(this->connexion.port) + "/" + this->connexion.service; if(!this->settings.contains(str)) { info(DEBUGMACRO, "saving path do not exists, asking for it"); @@ -1164,7 +1165,7 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD } info(DEBUGMACRO, "Downloading process exist, adding download to download list"); // Adding download to download list - str = path + " => " + this->connexion.server + "/" + this->connexion.service; + str = path + " => " + this->connexion.server + ":" + QByteArray::number(this->connexion.port) + "/" + this->connexion.service; ui->listDownload->addItem(str); }else { @@ -1269,10 +1270,12 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) if (reply == QMessageBox::Yes) { retry = true; + }else + { + this->stopDlAsked = false; + this->trayIcon->showMessage(a.applicationName(), tr("Download ") + aborted + "\n" + this->downloading.path, QSystemTrayIcon::Information); } } - this->stopDlAsked = false; - this->trayIcon->showMessage(a.applicationName(), tr("Download ") + aborted + "\n" + this->downloading.path, QSystemTrayIcon::Information); // disconnecting signals to slots disconnect(this->downloading.process, 0, 0, 0); @@ -1283,9 +1286,9 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) if (retry == false) { - QString filename = ui->listDownload->item(0)->text(); - pos = filename.contains(" => "); - filename.resize(pos); + //QString filename = ui->listDownload->item(0)->text(); + //pos = filename.contains(" => "); + //filename.resize(pos); delete ui->listDownload->takeItem(0); } this->downloading.clear(); @@ -1296,19 +1299,22 @@ void MainWindow::downloadFinished(int exitCode, QProcess::ExitStatus exitStatus) // initializing download path = ui->listDownload->item(0)->text(); pos = path.lastIndexOf("/"); - this->downloading.service = path.midRef(pos+1).toString(); + this->downloading.service = path.mid(pos+1); + path.resize(pos); + pos = path.lastIndexOf(":"); + this->downloading.port = path.mid(pos+1).toUInt(); path.resize(pos); pos = path.lastIndexOf(" => "); - this->downloading.server = path.midRef(pos+4).toString(); + this->downloading.server = path.mid(pos+4); path.resize(pos); - this->downloading.port = this->settings.value("connexion/Servers/" + this->downloading.server + "/port").toInt(); + //this->downloading.port = this->settings.value("connexion/Servers/" + this->downloading.server + "/port").toInt(); this->downloading.path = path; //getUserPassword(true); testServerPresence(this->downloading.service, true); // savepath exists in settings ? - str = "Folder/" + this->downloading.server + "/" + this->downloading.service; + str = "Folder/" + this->downloading.server + ":" + QByteArray::number(this->downloading.port) + "/" + this->downloading.service; if (this->settings.contains(str)) { // setting savepath from saved settings @@ -1461,7 +1467,7 @@ bool MainWindow::on_DefaultSaveFolder_triggered() } // Asking for directory to save files - folder = "Folder/" + this->connexion.server + "/" + this->connexion.service; + folder = "Folder/" + this->connexion.server + ":" + QByteArray::number(this->connexion.port )+ "/" + this->connexion.service; path = this->settings.value(folder).toString(); info(DEBUGMACRO, "Path = " + path); dir = dialog.getExistingDirectory(this, tr("Choose folder where to save file"), path, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); @@ -1558,14 +1564,14 @@ void MainWindow::loadDownloadList() path = ui->listDownload->item(0)->text(); pos = path.lastIndexOf("/"); - this->downloading.service = path.midRef(pos+1).toString(); + this->downloading.service = path.mid(pos+1); path.resize(pos); pos = path.lastIndexOf(" => "); - this->downloading.server = path.midRef(pos+4).toString(); + this->downloading.server = path.mid(pos+4); this->downloading.port = this->settings.value("connexion/Servers/" + this->downloading.server+ "/port").toInt(); path.resize(pos); this->downloading.path = path; - str = "Folder/" + this->downloading.server + "/" + this->downloading.service; + str = "Folder/" + this->downloading.server + ":" + QByteArray::number(this->downloading.port) + "/" + this->downloading.service; if (this->settings.contains(str)) { this->downloading.savePath = this->settings.value(str).toString(); diff --git a/mainwindow.h b/mainwindow.h index 233e0c5..151a8ee 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -7,41 +7,13 @@ #include "ui_configuration.h" #include "ui_about.h" #include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include -#include #include -#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -69,7 +41,7 @@ class Connexion bool paused = false; }; -class Downloading +/*class Downloading { public: QString server; @@ -85,7 +57,7 @@ class Downloading bool paused = false; void clear(); -}; +};*/ class About { @@ -94,8 +66,8 @@ class About QString author = "Daniel TARTAVEL-JEANNOT"; QString licence = "GPL_V3"; QString description; - QString email = "dtux@free.fr"; - QString git = "https://git.labolyon.fr/dtux/RsyncUI/issues"; + QString email = "dtux@free.fr"; + QString git = "https://git.labolyon.fr/dtux/RsyncUI/issues"; }; class MainWindow : public QMainWindow @@ -103,12 +75,12 @@ class MainWindow : public QMainWindow Q_OBJECT public: - Ui::MainWindow *ui; - MainWindow(QWidget *parent = nullptr); - ~MainWindow(); - // passwdManager; - QProgressDialog *progress; - Connexion connexion; + Ui::MainWindow *ui; + MainWindow(QWidget *parent = nullptr); + ~MainWindow(); + // passwdManager; + QProgressDialog *progress; + Connexion connexion; Connexion downloading; QSettings settings; About about; @@ -134,6 +106,7 @@ class MainWindow : public QMainWindow tr("TB"), tr("PB") }; + QList bwUnitChar { 'K', diff --git a/password.h b/password.h index 735051f..68c5113 100644 --- a/password.h +++ b/password.h @@ -1,12 +1,10 @@ #ifndef PASSWORD_H #define PASSWORD_H -//#include "mainwindow.h" -#include "qapplication.h" -#include -#include +#include +#include -extern QApplication a; +//extern QApplication a; void setPassword(QString account, QString pass); QString getPassword(const QString& name); diff --git a/tools.cpp b/tools.cpp index b33729b..7cd8a62 100644 --- a/tools.cpp +++ b/tools.cpp @@ -1,8 +1,8 @@ #include "mainwindow.h" #include "tools.h" -#include "password.h" #include #include +#include using namespace std; @@ -57,14 +57,12 @@ QString getFileType(QString filename) QString preparePath(QString path) { - return path.trimmed().replace(' ', "\ "); + return path.trimmed().replace(' ', '\ '); } int whatIpVersion(QString ipAddress) { QStringList fieldList; -// ulong field; -// uint i; uint ipversion; QHostAddress serverAddress; @@ -73,40 +71,13 @@ int whatIpVersion(QString ipAddress) if (!serverAddress.setAddress(ipAddress)) { error ("Address " + ipAddress + " is bad"); + info(DEBUGMACRO, "ERROR - not an IP address : " + ipAddress); + return 0; } ipversion = serverAddress.protocol(); + info(DEBUGMACRO, "ip protocol version is : " + QByteArray::number(ipversion)); - return (ipversion==IPV4?4:6); - - - /*fieldList = ipAddress.split(":"); - if (fieldList.count() == 8) - { - for (i=0;i<8;i++) - { - field = fieldList[i].toUInt(); - if (field > 65535) - { - return 0; - } - } - info(DEBUGMACRO, "Address is Ip V6"); - return 6; - } - fieldList = ipAddress.split("."); - if(fieldList.count() == 4) - { - for (i=0;i<4;i++) - { - field = fieldList[i].toUInt(); - if (field > 255) - { - return 0; - } - } - info(DEBUGMACRO, "Address is ip V4"); - return 4; - }*/ + return (ipversion == QAbstractSocket::IPv4Protocol?4:6); } QHostAddress searchHosts(QString server) diff --git a/tools.h b/tools.h index 272a753..d9646ab 100644 --- a/tools.h +++ b/tools.h @@ -7,15 +7,8 @@ #define IPV6 1 #include -#include -#include -#include #include -#include #include -#include -#include -#include #include "mainwindow.h" using namespace std; diff --git a/version.h b/version.h index db335b2..ee721a7 100644 --- a/version.h +++ b/version.h @@ -3,6 +3,6 @@ #include -QString version = "2.13.3"; +QString version = "2.13.4"; #endif // VERSION_H