Parcourir la source

organizing into better structure
skeletons for tasks, which need to be removed from argdialog

logicp il y a 5 ans
Parent
commit
c76b75ae65

+ 2 - 0
.gitignore

@@ -14,3 +14,5 @@ config
 ky_gui_plugin_import.cpp
 html
 qdoc.conf
+**/*/.autosave
+**.autosave

+ 0 - 0
include/client.hpp → include/client/client.hpp


+ 15 - 0
include/task/instagram_task.hpp

@@ -0,0 +1,15 @@
+#ifndef __INSTAGRAM_TASK_HPP__
+#define __INSTAGRAM_TASK_HPP__
+
+#include <include/task/task.hpp>
+
+namespace Task {
+
+class InstagramTask : public Task {
+ public:
+  bool isReady() override { return false; }
+  ~InstagramTask() override {}
+};
+}  // namespace Task
+
+#endif  // __INSTAGRAM_TASK_HPP

+ 12 - 0
include/task/task.hpp

@@ -0,0 +1,12 @@
+#ifndef __TASK_HPP__
+#define __TASK_HPP__
+
+namespace Task {
+
+class Task {
+ public:
+  virtual bool isReady() = 0;
+};
+}  // namespace Task
+
+#endif  // __TASK_HPP__

+ 13 - 0
include/task/task.hpp.autosave

@@ -0,0 +1,13 @@
+#ifndef __TASK_HPP__
+#define __TASK_HPP__
+
+namespace Task {
+
+class Task {
+ public:
+  virtual bool isReady() = 0;
+  virtual ~Task() = 0;
+};
+}  // namespace Task
+
+#endif  // __TASK_HPP__

+ 0 - 0
include/argdialog.h → include/ui/argdialog.h


+ 0 - 0
include/connection_indicator.h → include/ui/connection_indicator.h


+ 0 - 0
include/consoledialog.h → include/ui/consoledialog.h


+ 0 - 0
include/kfiledialog.h → include/ui/kfiledialog.h


+ 0 - 0
include/mainwindow.h → include/ui/mainwindow.h


+ 14 - 9
ky_gui.pro

@@ -28,18 +28,24 @@ CONFIG += static
 QMAKE_CXXFLAGS += "-fno-sized-deallocation"
 
 SOURCES += \
-        src/argdialog.cpp \
-        src/consoledialog.cpp \
-        src/kfiledialog.cpp \
         src/main.cpp \
         src/mainwindow.cpp \
         src/client.cpp \
+        src/instagram_task.cpp\
+        src/argdialog.cpp \
+        src/consoledialog.cpp \
+        src/kfiledialog.cpp \
+
         src/connection_indicator.cpp
 HEADERS += \
-        include/argdialog.h \
-        include/consoledialog.h \
-        include/mainwindow.h \
-        include/client.hpp \
+        include/ui/argdialog.h \
+        include/ui/consoledialog.h \
+        include/ui/mainwindow.h \
+        include/ui/connection_indicator.h \
+        include/ui/kfiledialog.h \
+        include/client/client.hpp \
+        include/task/task.hpp \
+        include/task/instagram_task.hpp\
         headers/kmessage_codec.hpp \
         headers/instatask_generated.h \
         headers/json.hpp \
@@ -48,8 +54,7 @@ HEADERS += \
         headers/rapidjson/writer.h \
         headers/rapidjson/stringbuffer.h \
         headers/rapidjson/document.h \
-        include/connection_indicator.h \
-        include/kfiledialog.h
+
 
 FORMS += \
         argdialog.ui \

+ 6 - 3
src/argdialog.cpp

@@ -68,6 +68,10 @@ ArgDialog::ArgDialog(QWidget *parent)
 
   QObject::connect(ui->addArgument, &QPushButton::clicked, this, [this]() {
     QString text = ui->argInput->toPlainText();
+    // TODO: argType values need to be set by configuration
+    // Can this somehow be known via the flatbuffer schema? I think not
+    // handling of type needs to be abstracted by a class which can be
+    // subclassed for various types of task: Instagram, etc
     auto type = ui->argType->currentText();
     if (text.size() > 0) {
       if (type == Args::HASHTAG_TYPE) {
@@ -98,9 +102,8 @@ ArgDialog::ArgDialog(QWidget *parent)
 
   QObject::connect(ui->argCommandButtons,
                    static_cast<void (QDialogButtonBox::*)(QAbstractButton *)>(
-                     &QDialogButtonBox::clicked),
-                   this,
-                   [this](QAbstractButton *button) {
+                       &QDialogButtonBox::clicked),
+                   this, [this](QAbstractButton *button) {
                      if (button->text() == "Save") {
                        if (m_ig_post.isReady()) {
                          setTaskArguments();

+ 0 - 0
src/instagram_task.cpp