Skip to content

Commit

Permalink
fix: select dirs instead of files to track
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenvukhang committed Feb 6, 2023
1 parent 4a8f839 commit 805be5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void MainWindow::treeView_trackFolder(const QModelIndex &index)
TreeIndex ti = index;

QFileDialog dialog(this, "Target for " + ti.get_ancestry("/"), start_dir);
dialog.setFileMode(QFileDialog::Directory);
int result = dialog.exec();
grabKeyboard();

Expand Down
16 changes: 7 additions & 9 deletions test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,26 @@ void TestGui::fetch_courses_ui_test()
MainWindow *app = create_app();
authenticate(app);

qDebug() << "GONNA TEST THE MODEL";
TreeModel *model = app->ui->treeView->model();
qDebug() << "AFTER GETTING THE MODEL";
QCOMPARE(model->childrenCount(), 3);
qDebug() << "~~~~~~~~~~" << 1;

TreeIndex ptr = model->index(0, 0);
qDebug() << "~~~~~~~~~~" << 2;
// QCOMPARE(1, 2);

qDebug() << "!!!!!!!!!!!!!!!!!!! COUNT" << ptr.children_count();
QCOMPARE(ptr.course(), "Calculus");
qDebug() << "~~~~~~~~~~" << 3;
QCOMPARE(ptr.children_count(), 1);
ptr = ptr.child(0);
qDebug() << "~~~~~~~~~~" << 4;
QCOMPARE(ptr.remote_dir(), "course files");
qDebug() << "~~~~~~~~~~" << 5;
QCOMPARE(ptr.child(0).remote_dir(), "Admin");
qDebug() << "~~~~~~~~~~" << 6;
QCOMPARE(ptr.child(1).remote_dir(), "Tutorials");
qDebug() << "~~~~~~~~~~" << 7;
qDebug() << "!!!!!!!!!!!!!!!!!!! COUNT" << ptr.children_count();

ptr = model->index(1, 0);
QCOMPARE(ptr.course(), "Geometry");
qDebug() << "!!!!!!!!!!!!!!!!!!! COUNT" << ptr.children_count();
QCOMPARE(ptr.children_count(), 10);
QCOMPARE(ptr.children_count(), 11);
ptr = ptr.child(0);
QCOMPARE(ptr.remote_dir(), "course files");
QCOMPARE(ptr.child(0).remote_dir(), "Course ntoes");
Expand Down

0 comments on commit 805be5b

Please sign in to comment.