rsyncui/mainwindow.h

117 lines
2.7 KiB
C
Raw Permalink Normal View History

2023-01-07 12:44:45 +01:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
2023-01-18 23:12:21 +01:00
#include "tools.h"
2023-01-07 12:44:45 +01:00
#include <QMainWindow>
#include <string>
#include <QTreeWidgetItem>
#include <QListWidgetItem>
#include "downloadfile.h"
#include <QProgressDialog>
2023-01-12 09:23:45 +01:00
#include <QSettings>
#include <vector>
2023-01-07 12:44:45 +01:00
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
2023-01-12 09:23:45 +01:00
class Connexion
{
public:
std::string bandwidthLimit = "1M";
std::string server;
int port = 873;
};
class Downloading
{
public:
std::string service;
std::string path;
std::string defaultSavePath;
std::string savePath;
QString dirPath;
int pid = 0;
};
class About
{
public:
QString title = "RsyncUI";
QString author = "Daniel TARTAVEL-JEANNOT";
QString licence = "GPL_V3";
QString description = "Client for rsync server";
QString email = "dtux@free.fr";
QString git = "https://git.labolyon.fr/dtux/RsyncUI/issues";
};
2023-01-07 12:44:45 +01:00
class MainWindow : public QMainWindow
{
Q_OBJECT
2023-01-12 09:23:45 +01:00
public:
Ui::MainWindow *ui;
MainWindow(QWidget *parent = nullptr);
~MainWindow();
QProgressDialog *progress;
void displayTree();
void populateTree();
void populateList();
void listServices();
bool validateServer(std::string server);
bool isIpAddress(std::string server);
QTreeWidgetItem * addTreeRoot(QString name, QString description);
QTreeWidgetItem * addTreeChild(QTreeWidgetItem *parent, QString name, QString size);
void scanDir(std::string server, int portN, QTreeWidgetItem *parent = NULL, std::string path = "" );
void startDownloading();
void loadSettings();
void saveSettings();
Connexion connexion;
Downloading downloading;
downloadFile downloadO;
QSettings settings;
About about;
std::vector <QString> serversList;
2023-01-12 09:23:45 +01:00
private slots:
void on_khistorycombobox_returnPressed();
2023-01-07 12:44:45 +01:00
2023-01-12 09:23:45 +01:00
//void on_portEdit_userTextChanged();
2023-01-07 12:44:45 +01:00
2023-01-12 09:23:45 +01:00
void on_portEdit_returnPressed();
2023-01-07 12:44:45 +01:00
2023-01-18 23:12:21 +01:00
//void on_actionDownload_triggered();
2023-01-07 12:44:45 +01:00
2023-01-18 23:12:21 +01:00
void on_listWidget_clicked();
2023-01-07 12:44:45 +01:00
2023-01-18 23:12:21 +01:00
void on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item);
2023-01-07 12:44:45 +01:00
2023-01-12 09:23:45 +01:00
void downloadFinished();
2023-01-07 12:44:45 +01:00
2023-01-12 09:23:45 +01:00
void stoppingDownload();
2023-01-07 12:44:45 +01:00
2023-01-12 09:23:45 +01:00
void on_listDownload_itemClicked(QListWidgetItem *item);
2023-01-07 12:44:45 +01:00
void on_actionAbout_triggered();
void on_actionAbout_Qt_triggered();
2023-01-18 23:12:21 +01:00
void on_khistorycombobox_currentIndexChanged(int);
2023-01-15 15:25:22 +01:00
void on_DefaultSaveFolder_triggered();
2023-01-18 23:12:21 +01:00
void returnPressed();
void on_connectButton_clicked();
2023-01-12 09:23:45 +01:00
signals:
void stopDownloading(int);
2023-01-07 12:44:45 +01:00
};
2023-01-12 09:23:45 +01:00
2023-01-07 12:44:45 +01:00
#endif // MAINWINDOW_H