diff options
-rw-r--r-- | src/mainwindow.cpp | 6 | ||||
-rw-r--r-- | src/mainwindow.h | 4 | ||||
-rw-r--r-- | src/mainwindow.ui | 38 |
3 files changed, 37 insertions, 11 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b9b268c..b9c4e8e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -15,6 +15,8 @@ MainWindow::MainWindow(QWidget *parent) , ui(new Ui::MainWindow) { ui->setupUi(this); + connect(ui->buttonCopy, &QPushButton::clicked, ui->actionCopy_status, &QAction::trigger); + connect(ui->buttonRandom, &QPushButton::clicked, ui->actionRandom_status, &QAction::trigger); } MainWindow::~MainWindow() @@ -66,7 +68,7 @@ void MainWindow::on_listWidget_itemActivated(QListWidgetItem *item) { } } -void MainWindow::on_buttonRandom_clicked() { +void MainWindow::on_actionRandom_status_triggered(bool checked) { if (data_archive == nullptr) return; // No archive open, avoids crashing int index = QRandomGenerator::global()->bounded(ui->listWidget->count()); @@ -75,7 +77,7 @@ void MainWindow::on_buttonRandom_clicked() { ui->listWidget->setCurrentItem(item); } -void MainWindow::on_buttonCopy_clicked() { +void MainWindow::on_actionCopy_status_triggered(bool checked) { if (data_archive == nullptr or ui->listWidget->selectedItems().isEmpty()) return; StatusListItem* item = dynamic_cast<StatusListItem*>(ui->listWidget->selectedItems()[0]); diff --git a/src/mainwindow.h b/src/mainwindow.h index a856dbe..f1de2d7 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -34,9 +34,9 @@ private slots: void on_actionDirect_messages_triggered(bool checked); void on_actionOnly_with_attachment_triggered(bool checked); void on_actionReblogs_triggered(bool checked); + void on_actionRandom_status_triggered(bool checked); + void on_actionCopy_status_triggered(bool checked); - void on_buttonRandom_clicked(); - void on_buttonCopy_clicked(); void on_buttonSearch_clicked(); void on_menuView_aboutToHide(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 0dbf777..f4a9263 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -29,6 +29,13 @@ </item> </layout> </item> + <item row="1" column="0"> + <widget class="QListWidget" name="listWidget"> + <property name="uniformItemSizes"> + <bool>true</bool> + </property> + </widget> + </item> <item row="0" column="1"> <layout class="QHBoxLayout" name="horizontalLayout_4"> <item> @@ -47,13 +54,6 @@ </item> </layout> </item> - <item row="1" column="0"> - <widget class="QListWidget" name="listWidget"> - <property name="uniformItemSizes"> - <bool>true</bool> - </property> - </widget> - </item> <item row="1" column="1"> <widget class="QTextEdit" name="statusInfoText"> <property name="cursor" stdset="0"> @@ -114,8 +114,22 @@ p, li { white-space: pre-wrap; } <addaction name="actionOnly_with_attachment"/> <addaction name="actionReblogs"/> </widget> + <widget class="QMenu" name="menuGo"> + <property name="title"> + <string>Go</string> + </property> + <addaction name="actionRandom_status"/> + </widget> + <widget class="QMenu" name="menuEdit"> + <property name="title"> + <string>Edit</string> + </property> + <addaction name="actionCopy_status"/> + </widget> <addaction name="menuFile"/> + <addaction name="menuEdit"/> <addaction name="menuView"/> + <addaction name="menuGo"/> <addaction name="menuHelp"/> </widget> <widget class="QStatusBar" name="statusbar"/> @@ -223,6 +237,16 @@ p, li { white-space: pre-wrap; } <string>Show reblogs</string> </property> </action> + <action name="actionRandom_status"> + <property name="text"> + <string>Random status</string> + </property> + </action> + <action name="actionCopy_status"> + <property name="text"> + <string>Copy status text</string> + </property> + </action> </widget> <tabstops> <tabstop>listWidget</tabstop> |