From e3efc04807f946cc75b06ec84b4af79d66b23cce Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 29 May 2024 22:46:29 -0400 Subject: Implement basic Welcome tab for greeting user --- src/mainwindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') 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; + } } } -- cgit v1.2.3-54-g00ecf