version 1.9.2

This commit is contained in:
2023-02-10 21:32:20 +01:00
parent 6aa69ddd08
commit 13d2c1384b
13 changed files with 1504 additions and 1286 deletions
+61 -23
View File
@@ -36,29 +36,35 @@
#include <QComboBox>
#include <QStringBuilder>
#include <pwd.h>
#include <QProcess>
#include <QToolBar>
#include <QDir>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
extern QMap<int, QString> rsyncErrorStrings;
class Connexion
{
public:
int bandwidthLimit = 0;
std::string bandwidthLimitUnit = "";
std::string server;
std::string service;
int bandwidthLimitUnit;
QString server;
QString service;
int port = 873;
bool comboboxChanged;
};
class Downloading
{
public:
std::string server;
std::string service;
std::string path;
std::string savePath;
QString server;
QString service;
QString path;
QString savePath;
QProcess * process = nullptr;
void clear();
};
@@ -67,7 +73,7 @@ class About
{
public:
QString title = "RsyncUI";
QString version = "1.9.1";
QString version = "1.9.2";
QString author = "Daniel TARTAVEL-JEANNOT";
QString licence = "GPL_V3";
QString description;
@@ -84,38 +90,55 @@ class MainWindow : public QMainWindow
MainWindow(QWidget *parent = nullptr);
~MainWindow();
QProgressDialog *progress;
int pid = 0;
Connexion connexion;
Downloading downloading;
downloadFile downloadO;
//downloadFile downloadO;
QSettings settings;
About about;
QDialog Configuration;
Ui::Configuration config;
std::vector <QString> serversList;
map<char, int> bwUnixIndex {
{'B', 0},
{'K', 1},
{'M', 2},
{'G', 3},
{'P', 4}
QList<QString> bwUnitText {
"KB",
"MB",
"TB",
"GB",
"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().")
};
void displayTree();
void populateTree(QTreeWidgetItem * parent);
void populateList();
void listServices();
bool validateServer(std::string server);
bool isIpAddress(std::string server);
bool validateServer(QString server);
bool isIpAddress(QString server);
QTreeWidgetItem * addTreeRoot(QString name, QString description, bool isDir);
QTreeWidgetItem * addTreeChild(QTreeWidgetItem *parent, QString name, QString size, bool isDir);
void scanDir(std::string server, int portN, QTreeWidgetItem *parent = NULL, std::string path = "" );
void 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();
private slots:
@@ -123,7 +146,13 @@ class MainWindow : public QMainWindow
void on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadDir = false);
void downloadFinished();
void downloadFinished(int exitCode, QProcess::ExitStatus exitStatus);
// void downloadProcessError(QProcess::ProcessError error);
void downloadProcessStderr();
void readRsyncOutput();
void stoppingDownload();
@@ -143,11 +172,20 @@ class MainWindow : public QMainWindow
void on_actionDownload_triggered();
public slots:
//void downloadingErrorSlot(QString);
void on_comboBox_currentIndexChanged(int index);
void on_buttonBox_accepted();
void cancelled(QProcess *);
signals:
void stopDownloading(int);
void stopDownloading(QProcess *);
void progressSignal(int);
void finishedSignal(bool = true);
//void errorSignal(QString);
};
#endif // MAINWINDOW_H