Progress: 50%.
This commit is contained in:
parent
159d38e210
commit
fa9ca77bfd
1 changed files with 227 additions and 16 deletions
32
mainscreen.h
32
mainscreen.h
|
|
@ -29,11 +29,37 @@ struct SearchItem {
|
|||
QString downloads;
|
||||
QString timestamp;
|
||||
QString magnet;
|
||||
std::filesystem::path download_path;
|
||||
void printData();
|
||||
void writeData(std::string file_path);
|
||||
void readFromData(std::string file_path);
|
||||
};
|
||||
|
||||
struct Status {
|
||||
SearchItem it;
|
||||
int progress;
|
||||
float speed;
|
||||
};
|
||||
|
||||
class Socket: public QObject {
|
||||
Q_OBJECT
|
||||
std::unordered_map<std::string, QLocalSocket *> active_sockets;
|
||||
QTimer *recheck = nullptr;
|
||||
QTimer *timer = nullptr;
|
||||
bool checked_resume_files = false;
|
||||
public:
|
||||
Socket(QObject *parent = nullptr);
|
||||
signals:
|
||||
void launchTorrentSession(SearchItem it);
|
||||
void sendStatusToMainScreen(Status st);
|
||||
public slots:
|
||||
void start();
|
||||
void startNotDownloadingSessions();
|
||||
private slots:
|
||||
bool isTitleInActiveSession(QString title);
|
||||
void socketReadyRead();
|
||||
};
|
||||
|
||||
class MainScreen : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -52,9 +78,15 @@ class MainScreen : public QObject
|
|||
|
||||
QNetworkAccessManager *manager = nullptr;
|
||||
std::string tags_file_path = "";
|
||||
Socket *socket = nullptr;
|
||||
QThread *socket_thread = nullptr;
|
||||
public:
|
||||
explicit MainScreen(std::string search_term = "", QObject *parent = nullptr);
|
||||
signals:
|
||||
void startSocket();
|
||||
public slots:
|
||||
void resumeOldTorrentSession(SearchItem it);
|
||||
void statusFromSocket(Status st);
|
||||
private:
|
||||
void renderSearchPage(std::string search_term);
|
||||
void renderHomePage();
|
||||
|
|
|
|||
Loading…
Reference in a new issue