version 2.12.1

This commit is contained in:
2024-08-03 15:22:35 +02:00
parent 916cbc6d5b
commit ec38ce4ec3
12 changed files with 614 additions and 303 deletions
+139 -136
View File
@@ -1,13 +1,11 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#define QT_USE_FAST_CONCATENATION
#define QT_USE_FAST_OPERATOR_PLUS
#include "ui_mainwindow.h"
#include "ui_configuration.h"
#include "ui_about.h"
#include "downloadfile.h"
#include "tools.h"
#include "password.h"
#include <QMainWindow>
#include <string>
#include <QTreeWidgetItem>
@@ -53,180 +51,185 @@ extern QMap<int, QString> rsyncErrorStrings;
class Connexion
{
public:
int bandwidthLimit = 0;
int bandwidthLimitUnit;
int contimeout = 20;
QString server;
QString service;
QString path;
QString savePath;
QString user;
QString password;
QProcess * process = nullptr;
int port = 873;
bool comboboxChanged;
bool quit = false;
void clear();
public:
int bandwidthLimit = 0;
int bandwidthLimitUnit;
int contimeout = 20;
QString server;
QString service;
QString path;
QString savePath;
QString user;
QString password;
QProcess * process = nullptr;
int ipversion = 4;
uint port = 873;
bool quit = false;
void clear();
};
class Downloading
{
public:
QString server;
QString service;
QString path;
QString savePath;
QString user;
QString password;
int port = 873;
QProcess * process = nullptr;
bool quit = false;
void clear();
public:
QString server;
QString service;
QString path;
QString savePath;
QString user;
QString password;
int ipversion = 4;
int port = 873;
QProcess * process = nullptr;
bool quit = false;
void clear();
};
class About
{
public:
QString version;
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";
public:
QString version;
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";
};
class MainWindow : public QMainWindow
{
Q_OBJECT
Q_OBJECT
public:
Ui::MainWindow *ui;
MainWindow(QWidget *parent = nullptr);
~MainWindow();
// passwdManager;
QProgressDialog *progress;
Connexion connexion;
Connexion downloading;
QSettings settings;
About about;
QDialog Configuration;
Ui::Configuration config;
QDialog aboutDialog;
Ui::windowAbout AboutW;
std::vector <QString> serversList;
QSystemTrayIcon * trayIcon;
QString icon = "/usr/share/icons/RsyncUI.png";
bool rescan = false;
bool stopDlAsked;
bool treeviewClicked;
public:
Ui::MainWindow *ui;
MainWindow(QWidget *parent = nullptr);
~MainWindow();
// passwdManager;
QProgressDialog *progress;
Connexion connexion;
Connexion downloading;
QSettings settings;
About about;
QDialog Configuration;
Ui::Configuration config;
QDialog aboutDialog;
Ui::windowAbout AboutW;
std::vector <QString> serversList;
QSystemTrayIcon * trayIcon;
QString icon = "/usr/share/icons/RsyncUI.png";
bool rescan = false;
bool stopDlAsked;
bool treeviewClicked;
bool initialization = true;
bool exiting = false;
QList<QString> UnitText
{
tr("B"),
tr("KB"),
tr("MB"),
tr("GB"),
tr("TB"),
tr("PB")
};
QList<QChar> bwUnitChar
{
'K',
'M',
'T',
'G',
'P'
};
QList<QString> UnitText
{
tr("B"),
tr("KB"),
tr("MB"),
tr("GB"),
tr("TB"),
tr("PB")
};
QList<QChar> bwUnitChar
{
'K',
'M',
'T',
'G',
'P'
};
QVector<QString> downloadProcessErrorString =
{
tr("The process failed to start. Either the invoked program is missing, or you may have insufficient permissions or resources to invoke the program."),
tr("The process crashed some time after starting successfully."),
tr("The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again."),
tr("An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel."),
tr("An error occurred when attempting to read from the process. For example, the process may not be running."),
tr("An unknown error occurred. This is the default return value of error().")
};
QVector<QString> downloadProcessErrorString =
{
tr("The process failed to start. Either the invoked program is missing, or you may have insufficient permissions or resources to invoke the program."),
tr("The process crashed some time after starting successfully."),
tr("The last waitFor...() function timed out. The state of QProcess is unchanged, and you can try calling waitFor...() again."),
tr("An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel."),
tr("An error occurred when attempting to read from the process. For example, the process may not be running."),
tr("An unknown error occurred. This is the default return value of error().")
};
void displayTree();
void populateTree();
void populateList(int);
void listServices();
bool validateServer(QString server);
bool isIpAddress(QString server);
void addTreeItem(QString name, QString fileSize, QString fullsize, QString type, QString date, bool isDir, QString dirName, QTreeWidgetItem *parent);
bool scanDir(QString server, int portN, QTreeWidgetItem *parent = NULL, QString path = "" );
void startDownloading();
void loadSettings();
void saveSettings();
void closeEvent (QCloseEvent *event);
void saveDownloadList();
void loadDownloadList();
void download();
void initSystemTrayIcon();
void hideWindow();
void showWindow();
void init();
bool getUserPassword(Connexion *);
void preparePopulateTree();
bool testServicePresence(QString, bool=false);
void passwordStore (QString account, QString password);
QString passwordGet (QString account);
void displayTree();
void populateTree();
void populateList(QString server, uint port);
void listServices();
uint validateServer(QString server);
void addTreeItem(QString name, QString fileSize, QString fullsize, QString type, QString date, bool isDir, QString dirName, QTreeWidgetItem *parent);
bool scanDir(Connexion * connexion, QTreeWidgetItem *parent = NULL, QString path = "" );
void startDownloading();
void loadSettings();
void saveSettings();
void closeEvent (QCloseEvent *event);
void saveDownloadList();
void loadDownloadList();
void deleteDownloadList();
void download();
void initSystemTrayIcon();
void hideWindow();
void showWindow();
void init();
bool getUserPassword(Connexion *);
void preparePopulateTree();
bool testServerPresence(QString, bool=false);
void passwordStore (QString account, QString password);
QString passwordGet (QString account);
private slots:
private slots:
void on_listWidget_clicked();
void on_listWidget_clicked();
void on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadDir = false);
void on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadDir = false);
void downloadFinished(int exitCode, QProcess::ExitStatus exitStatus);
void downloadFinished(int exitCode, QProcess::ExitStatus exitStatus);
void readRsyncOutput();
void readRsyncOutput();
void stoppingDownload();
void stoppingDownload();
void on_listDownload_itemClicked(QListWidgetItem *item);
void on_listDownload_itemClicked(QListWidgetItem *item);
void on_actionAbout_triggered();
void on_actionAbout_triggered();
void on_actionAbout_Qt_triggered();
void on_actionAbout_Qt_triggered();
void on_khistorycombobox_currentIndexChanged(int);
bool on_DefaultSaveFolder_triggered();
bool on_DefaultSaveFolder_triggered();
void on_connectButton_clicked();
void on_connectButton_clicked();
void on_action_Settings_triggered();
void on_action_Settings_triggered();
void on_actionDownload_triggered();
void on_actionDownload_triggered();
void on_comboBox_currentIndexChanged(int index);
void on_comboBox_currentIndexChanged(int index);
void on_buttonBox_accepted();
void on_buttonBox_accepted();
void cancelled(QProcess *);
void cancelled(QProcess *);
void on_trayIcon_clicked(QSystemTrayIcon::ActivationReason reason);
void on_trayIcon_clicked(QSystemTrayIcon::ActivationReason reason);
void quitApp();
void quitApp();
void on_actionExit_triggered();
void on_actionExit_triggered();
void setDlSpeed(QString speed);
void setDlSpeed(QString speed);
void on_actionHiddenService_triggered();
void on_actionHiddenService_triggered();
//void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);
void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);
//void on_khistorycombobox_currentTextChanged(const QString &arg1);
void on_khistorycombobox_currentTextChanged(const QString &arg1);
signals:
void stopDownloading(QProcess *);
void progressSignal(int);
void speed(QString);
void finishedSignal(bool = true);
void fileName(QString);
void passwordReady();
void stopDownloading(QProcess *);
void progressSignal(int);
void speed(QString);
void finishedSignal(bool = true);
void fileName(QString);
void passwordReady();
};
#endif // MAINWINDOW_H