Parcourir la source

no longer using separately defined Task struct in util.hpp and argdialog.h

logicp il y a 5 ans
Parent
commit
f84a725bd7
5 fichiers modifiés avec 6 ajouts et 16 suppressions
  1. 3 2
      headers/util.hpp
  2. 0 5
      include/argdialog.h
  3. 1 0
      include/client.hpp
  4. 2 2
      src/argdialog.cpp
  5. 0 7
      src/mainwindow.cpp

+ 3 - 2
headers/util.hpp

@@ -26,7 +26,7 @@ public:
     auto begin() {return _obj.rbegin();}
     auto end() {return _obj.rend();}
 };
-}
+}  // namespace Kontainer
 
 enum FileType {
     VIDEO = 1,
@@ -42,6 +42,7 @@ struct KFileData {
 struct Task {
   QVector<KFileData> files;
   std::vector<std::string> args;
+  int mask;
 };
 
 typedef QQueue<Task> TaskQueue;
@@ -428,5 +429,5 @@ QString generatePreview(QString video_path, QString video_name) {
   return preview_name;
 }
 }; // namespace FileUtils
-}
+}  // namespace
 #endif  // UTIL_HPP

+ 0 - 5
include/argdialog.h

@@ -23,11 +23,6 @@ const QString REQUESTED_BY_TYPE = "requested by";
 
 typedef std::string Str;
 
-typedef struct Task {
-    int mask;
-    std::vector<std::string> args;
-} Task;
-
 typedef struct KFile {
   QString name;
   QString path;

+ 1 - 0
include/client.hpp

@@ -104,5 +104,6 @@ private:
     std::vector<int> selected_commands;
     QQueue<KFileData> outgoing_files;
     std::vector<SentFile> sent_files;
+    TaskQueue m_task_queue;
 };
 #endif // CLIENT_HPP

+ 2 - 2
src/argdialog.cpp

@@ -203,8 +203,8 @@ void ArgDialog::clearPost() {
 }
 
 void ArgDialog::clearTask() {
-    m_task.args = {};
-    m_task.mask = -1;
+  m_task.args.clear();
+  m_task.mask = -1;
 }
 
 void ArgDialog::addRequestedBy(QString value) {

+ 0 - 7
src/mainwindow.cpp

@@ -139,19 +139,12 @@ void MainWindow::connectClient() {
   QObject::connect(
       arg_ui, &ArgDialog::taskRequestReady, this,
       [this](Task task, bool file_pending) {
-        // TODO: Maybe this should be handled by the Client class directly
         auto mask = q_client->getSelectedApp();
         if (mask > -1) {
           if (q_client->getAppName(mask) == "Instagram") {
-            auto datetime = task.args.at(0);
-            auto current_datetime = QDateTime::currentDateTime().toTime_t();
-            auto seconds_diff = std::stoi(datetime) - current_datetime;
-            //                qDebug() << "Time difference: " << seconds_diff;
-            //                if (seconds_diff > 3600) {
             qDebug() << "Scheduling a task";
             task.args.push_back(std::to_string(mask));
             q_client->scheduleTask(task.args, file_pending);
-            //                }
           }
         }
       });