|
5 | 5 | * Derived class of PanelWidget as the UI for program LabelImages. |
6 | 6 | */ |
7 | 7 |
|
| 8 | +#include <QDesktopServices> |
| 9 | +#include <QUrl> |
8 | 10 | #include <QFileDialog> |
9 | 11 | #include <QLabel> |
10 | 12 | #include <QMessageBox> |
@@ -93,6 +95,12 @@ LabelImages_Widget::LabelImages_Widget( |
93 | 95 | QPushButton* next_anno_button = new QPushButton("Next Annotation", scroll_inner); |
94 | 96 | button_row->addWidget(next_anno_button, 1); |
95 | 97 |
|
| 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 | + |
96 | 104 | // add a row for user annotation |
97 | 105 | // the user can annotate in two modes: |
98 | 106 | // - set a pokemon form label |
@@ -125,17 +133,24 @@ LabelImages_Widget::LabelImages_Widget( |
125 | 133 | // connect button signals to define button actions |
126 | 134 |
|
127 | 135 | 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(); |
130 | 137 | }); |
131 | 138 |
|
132 | 139 | 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(); |
135 | 141 | }); |
136 | 142 | 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(); |
139 | 154 | }); |
140 | 155 |
|
141 | 156 | connect(load_custom_set_button, &QPushButton::clicked, this, [this](bool){ |
|
0 commit comments