Skip to content

Commit 71757c3

Browse files
committed
version bump and some UI changes
1 parent 1b2ab9a commit 71757c3

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

src/ui.cpp

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
#include <QtWidgets/QMainWindow>
19+
#include <QtWidgets/QMenuBar>
20+
#include <QtWidgets/QMenu>
21+
#include <QtWidgets/QAction>
22+
1823
#include <QtWidgets/QApplication>
1924
#include <QtWidgets/QLabel>
2025
#include <QtGui/QDragEnterEvent>
2126
#include <QtGui/QDropEvent>
2227
#include <QtCore/QMimeData>
2328
#include <QtCore/QDebug>
2429
#include <QtCore/QFileInfo>
30+
#include <QtCore/QProcess>
2531

2632
#include "processing.h"
2733

@@ -33,7 +39,7 @@ class DropArea : public QLabel {
3339
setMinimumSize(400, 400);
3440
setMaximumSize(400, 400);
3541
setWindowFlags(Qt::WindowStaysOnTopHint);
36-
setWindowTitle("Solidify 1.21");
42+
setWindowTitle("Solidify 1.22");
3743
setText("Drag & drop files here"); // Set text
3844
setAlignment(Qt::AlignCenter); // Set alignment to center
3945

@@ -68,11 +74,47 @@ class DropArea : public QLabel {
6874
}
6975
};
7076

77+
class MainWindow : public QMainWindow {
78+
public:
79+
MainWindow() {
80+
DropArea* dropArea = new DropArea;
81+
setCentralWidget(dropArea);
82+
83+
QMenuBar* menuBar = new QMenuBar;
84+
QMenu* f_menu = new QMenu("Files", menuBar);
85+
QMenu* r_menu = new QMenu("Reset", menuBar);
86+
QAction* f_Restart = new QAction("Restart", r_menu);
87+
QAction* f_Exit = new QAction("Exit", f_menu);
88+
r_menu->addAction(f_Restart);
89+
f_menu->addAction(f_Exit);
90+
menuBar->addMenu(f_menu);
91+
menuBar->addMenu(r_menu);
92+
setMenuBar(menuBar);
93+
94+
// Connect the Exit action's triggered signal to QApplication's quit slot
95+
connect(f_Exit, &QAction::triggered, qApp, &QApplication::quit);
96+
97+
// Connect the Restart action's triggered signal to a slot that restarts the app
98+
connect(f_Restart, &QAction::triggered, this, &MainWindow::restartApp);
99+
}
100+
101+
private slots:
102+
void restartApp() {
103+
QStringList arguments;
104+
QProcess::startDetached(QApplication::applicationFilePath(), arguments);
105+
106+
QApplication::quit();
107+
}
108+
};
109+
71110
int main(int argc, char* argv[]) {
72111
QApplication app(argc, argv);
73112

74-
DropArea dropArea;
75-
dropArea.show();
113+
MainWindow window;
114+
window.show();
115+
116+
//DropArea dropArea;
117+
//dropArea.show();
76118

77119
return app.exec();
78120
}

0 commit comments

Comments
 (0)