Bladeren bron

removing redundant line, simpliyfying removeArgument code from ArgDialog, adding doc comments

logicp 4 jaren geleden
bovenliggende
commit
5f6c5de48c
2 gewijzigde bestanden met toevoegingen van 6 en 13 verwijderingen
  1. 2 8
      src/argdialog.cpp
  2. 4 5
      src/instagram_task.cpp

+ 2 - 8
src/argdialog.cpp

@@ -128,7 +128,6 @@ ArgDialog::ArgDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ArgDialog),
   QObject::connect(ui->dateTime, &QDateTimeEdit::dateTimeChanged, this, [this]() {
     auto date_time = ui->dateTime->dateTime();
     m_task->setArgument("datetime", QString::number(date_time.toTime_t()));
-    auto new_time = std::get<Scheduler::VariantIndex::QSTRING>(m_task->getTaskArgument("datetime"));
     qDebug() << "Time changed to" << date_time;
   });
 
@@ -202,13 +201,8 @@ void ArgDialog::addItem(QString value, QString type) {
         }
       }
     } else {
-      auto&& argument = m_task->getTaskArgument(name);
-      if (argument.isContainer()) {
-        for (auto&& s : value.split("\n")) {
-          m_task->removeArgument(name, s);
-        }
-      } else {
-        argument.clear();
+      for (auto&& s : value.split("\n")) { // If there are multiple values, they are separated by line breaks
+        m_task->removeArgument(name, s);
       }
     }
     ui->argList->removeRow(row_index);

+ 4 - 5
src/instagram_task.cpp

@@ -85,12 +85,11 @@ void InstagramTask::addArgument(QString name, Scheduler::KFileData file) {
 /**
  * @warning This method is used to remove a value to an argument, and can only be used on arguments whose type is a form of container.
  *
- * @brief InstagramTask::addArgument
+ * @brief InstagramTask::removeArgument
+ *
+ * @param [in] {QString}      name   The name of the argument, whose value is expected to be a container.
+ * @param [in] {TypeVariant}  value  The value to be removed from the container argument.
  *
- * @param [in] {QString}      name  The name of the argument
- * @param [in] {TypeVariant}  file  A data structure to be added to a container of files.
- *                                The KFileData structure contains metadata about a file and
- *                                its data as a byte array
  */
 void InstagramTask::removeArgument(QString name, Scheduler::TypeVariant value) {
   for (auto&& argument : m_arguments) {