Skip to content

Commit 3307436

Browse files
author
Gin
committed
more buttons
1 parent 55b131d commit 3307436

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

SerialPrograms/Source/ML/Programs/ML_LabelImagesWidget.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Derived class of PanelWidget as the UI for program LabelImages.
66
*/
77

8+
#include <QDesktopServices>
9+
#include <QUrl>
810
#include <QFileDialog>
911
#include <QLabel>
1012
#include <QMessageBox>
@@ -93,6 +95,12 @@ LabelImages_Widget::LabelImages_Widget(
9395
QPushButton* next_anno_button = new QPushButton("Next Annotation", scroll_inner);
9496
button_row->addWidget(next_anno_button, 1);
9597

98+
QPushButton* save_anno_button = new QPushButton("Save Annotation", scroll_inner);
99+
button_row->addWidget(save_anno_button, 1);
100+
101+
QPushButton* open_anno_folder_button = new QPushButton("Open Saved Annotation Folder", scroll_inner);
102+
button_row->addWidget(open_anno_folder_button, 1);
103+
96104
// add a row for user annotation
97105
// the user can annotate in two modes:
98106
// - set a pokemon form label
@@ -125,17 +133,24 @@ LabelImages_Widget::LabelImages_Widget(
125133
// connect button signals to define button actions
126134

127135
connect(delete_anno_button, &QPushButton::clicked, this, [this](bool){
128-
auto& program = this->m_program;
129-
program.delete_selected_annotation();
136+
this->m_program.delete_selected_annotation();
130137
});
131138

132139
connect(pre_anno_button, &QPushButton::clicked, this, [this](bool){
133-
auto& program = this->m_program;
134-
program.select_prev_annotation();
140+
this->m_program.select_prev_annotation();
135141
});
136142
connect(next_anno_button, &QPushButton::clicked, this, [this](bool){
137-
auto& program = this->m_program;
138-
program.select_next_annotation();
143+
this->m_program.select_next_annotation();
144+
});
145+
connect(open_anno_folder_button, &QPushButton::clicked, this, [this](bool){
146+
this->m_program.save_annotation_to_file();
147+
148+
// ensure the folder exists
149+
std::filesystem::create_directory(ML_ANNOTATION_PATH());
150+
QDesktopServices::openUrl(QUrl(QString::fromStdString("file:///" + ML_ANNOTATION_PATH())));
151+
});
152+
connect(save_anno_button, &QPushButton::clicked, this, [this](bool){
153+
this->m_program.save_annotation_to_file();
139154
});
140155

141156
connect(load_custom_set_button, &QPushButton::clicked, this, [this](bool){

0 commit comments

Comments
 (0)