aboutsummaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorConfuSomu2024-05-29 22:46:29 -0400
committerConfuSomu2024-05-29 22:46:29 -0400
commite3efc04807f946cc75b06ec84b4af79d66b23cce (patch)
tree27ee6d0aefe5ce7e45abb8e92f403eeff5d5aaa4 /src/mainwindow.cpp
parent294f7f78fe3e81bef2c23750426b53354b1b20a6 (diff)
downloadActorViewer-e3efc04807f946cc75b06ec84b4af79d66b23cce.tar
ActorViewer-e3efc04807f946cc75b06ec84b4af79d66b23cce.tar.gz
ActorViewer-e3efc04807f946cc75b06ec84b4af79d66b23cce.zip
Implement basic Welcome tab for greeting user
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 296c961..89351ae 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -27,6 +27,12 @@ MainWindow::~MainWindow()
}
void MainWindow::create_initial_tabs() {
+ welcome_tab = new TabWelcome();
+ ui->tabWidget->addTab(welcome_tab, tr("Welcome"));
+ connect(welcome_tab, &TabWelcome::show_file_open_dialog, this, &MainWindow::on_actionOpen_triggered);
+ // TODO: recent files
+ //connect(welcome_tab, &TabWelcome::show_recent_files, this, &MainWindow::);
+
activity_list_tab = new TabActivityList(&data_archive);
ui->tabWidget->addTab(activity_list_tab, tr("Activity List"));
activity_list_tab->view_actions = {
@@ -88,13 +94,19 @@ void MainWindow::act_command_line(CommandLineParsedOptions &options, QCommandLin
}
}
-void MainWindow::on_actionOpen_triggered(bool checked) {
+void MainWindow::on_actionOpen_triggered() {
QFileDialog fileDialog;
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setNameFilter(tr("Mastodon data export directory (outbox.json)"));
if (fileDialog.exec()) {
QStringList files = fileDialog.selectedFiles();
open_file(files[0]);
+
+ // Close the welcome tab as it's not needed anymore
+ if (welcome_tab) {
+ welcome_tab->deleteLater();
+ welcome_tab = nullptr;
+ }
}
}