Skip to content

Commit 111caea

Browse files
committed
sorting files
1 parent 3ff9252 commit 111caea

File tree

6 files changed

+121
-96
lines changed

6 files changed

+121
-96
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ bld/
3737
.vs/
3838
# Uncomment if you have tasks that create the project's static files in wwwroot
3939
#wwwroot/
40-
40+
# Visual Studio Code
41+
.vscode/*
4142
# Visual Studio 2017 auto generated files
4243
Generated\ Files/
4344

Solidify.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
</Link>
130130
</ItemDefinitionGroup>
131131
<ItemGroup>
132+
<ClCompile Include="src\main.cpp" />
132133
<ClCompile Include="src\processing.cpp" />
133134
<ClCompile Include="src\Solidify.cpp" />
134135
<ClCompile Include="src\ui.cpp" />
@@ -137,6 +138,7 @@
137138
<ClInclude Include="src\processing.h" />
138139
<ClInclude Include="src\solidify.h" />
139140
<ClInclude Include="src\Timer.h" />
141+
<ClInclude Include="src\ui.h" />
140142
</ItemGroup>
141143
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
142144
<ImportGroup Label="ExtensionTargets">

src/main.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Solidify (Push Pull) algorithm implementation using OpenImageIO
3+
* Copyright (c) 2022 Erium Vladlen.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, version 3.
8+
*
9+
* This program is distributed in the hope that it will be useful, but
10+
* WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+
* General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include "ui.h"
19+
20+
int main(int argc, char* argv[]) {
21+
QApplication app(argc, argv);
22+
23+
MainWindow window;
24+
window.show();
25+
26+
//DropArea dropArea;
27+
//dropArea.show();
28+
29+
return app.exec();
30+
}

src/processing.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@
1414
* You should have received a copy of the GNU General Public License
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
#include <QtWidgets/QApplication>
18-
#include <QtWidgets/QLabel>
19-
#include <QtGui/QDragEnterEvent>
20-
#include <QtGui/QDropEvent>
21-
#include <QtCore/QMimeData>
22-
#include <QtCore/QDebug>
23-
#include <QtCore/QFileInfo>
2417

18+
#include "ui.h"
2519
#include "solidify.h"
2620

2721
QString checkAlpha(std::vector<QString> fileNames) {

src/ui.cpp

Lines changed: 52 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
1-
/*
2-
* Solidify (Push Pull) algorithm implementation using OpenImageIO
3-
* Copyright (c) 2022 Erium Vladlen.
4-
*
5-
* This program is free software: you can redistribute it and/or modify
6-
* it under the terms of the GNU General Public License as published by
7-
* the Free Software Foundation, version 3.
8-
*
9-
* This program is distributed in the hope that it will be useful, but
10-
* WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12-
* General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU General Public License
15-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
*/
1+
#include "ui.h"
172

183
#include <QtWidgets/QMainWindow>
194
#include <QtWidgets/QMenuBar>
@@ -31,90 +16,69 @@
3116

3217
#include "processing.h"
3318

34-
class DropArea : public QLabel {
35-
public:
36-
DropArea() {
37-
setAcceptDrops(true);
38-
resize(400, 400);
39-
setMinimumSize(400, 400);
40-
setMaximumSize(400, 400);
41-
setWindowFlags(Qt::WindowStaysOnTopHint);
42-
setWindowTitle("Solidify 1.22");
43-
setText("Drag & drop files here"); // Set text
44-
setAlignment(Qt::AlignCenter); // Set alignment to center
45-
46-
QFont font = this->font();
47-
font.setPointSize(16);
48-
setFont(font);
49-
}
19+
DropArea::DropArea() {
20+
setAcceptDrops(true);
21+
setText("Drag & drop files here"); // Set text
22+
setAlignment(Qt::AlignCenter); // Set alignment to center
23+
24+
QFont font = this->font();
25+
font.setPointSize(16);
26+
setFont(font);
27+
}
5028

51-
protected:
52-
void dragEnterEvent(QDragEnterEvent* event) override {
53-
event->acceptProposedAction();
29+
void DropArea::dragEnterEvent(QDragEnterEvent* event) {
30+
event->acceptProposedAction();
31+
}
32+
33+
void DropArea::dropEvent(QDropEvent* event) {
34+
QList<QUrl> urls = event->mimeData()->urls();
35+
if (urls.isEmpty()) {
36+
return;
5437
}
5538

56-
void dropEvent(QDropEvent* event) override {
57-
QList<QUrl> urls = event->mimeData()->urls();
58-
if (urls.isEmpty()) {
59-
return;
60-
}
39+
//QString fileName = urls.first().toLocalFile();
40+
//if (fileName.isEmpty()) {
41+
// return;
42+
//}
6143

62-
//QString fileName = urls.first().toLocalFile();
63-
//if (fileName.isEmpty()) {
64-
// return;
65-
//}
44+
// Processing
6645

67-
// Processing
46+
bool success = doProcessing(urls);
6847

69-
bool success = doProcessing(urls);
48+
qDebug() << "Done!";
7049

71-
qDebug() << "Done!";
50+
return;
51+
}
7252

73-
return;
74-
}
75-
};
76-
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-
}
53+
MainWindow::MainWindow() {
54+
DropArea* dropArea = new DropArea;
55+
dropArea->setFixedSize(400, 400); // Set the size of the drop area
56+
setCentralWidget(dropArea);
10057

101-
private slots:
102-
void restartApp() {
103-
QStringList arguments;
104-
QProcess::startDetached(QApplication::applicationFilePath(), arguments);
58+
setWindowFlags(Qt::WindowStaysOnTopHint);
59+
setWindowTitle("Solidify 1.22");
10560

106-
QApplication::quit();
107-
}
108-
};
61+
QMenuBar* menuBar = new QMenuBar;
62+
QMenu* f_menu = new QMenu("Files", menuBar);
63+
QMenu* r_menu = new QMenu("Reset", menuBar);
64+
QAction* f_Restart = new QAction("Restart", r_menu);
65+
QAction* f_Exit = new QAction("Exit", f_menu);
66+
r_menu->addAction(f_Restart);
67+
f_menu->addAction(f_Exit);
68+
menuBar->addMenu(f_menu);
69+
menuBar->addMenu(r_menu);
70+
setMenuBar(menuBar);
10971

110-
int main(int argc, char* argv[]) {
111-
QApplication app(argc, argv);
72+
// Connect the Exit action's triggered signal to QApplication's quit slot
73+
connect(f_Exit, &QAction::triggered, qApp, &QApplication::quit);
11274

113-
MainWindow window;
114-
window.show();
75+
// Connect the Restart action's triggered signal to a slot that restarts the app
76+
connect(f_Restart, &QAction::triggered, this, &MainWindow::restartApp);
77+
}
11578

116-
//DropArea dropArea;
117-
//dropArea.show();
79+
void MainWindow::restartApp() {
80+
QStringList arguments;
81+
QProcess::startDetached(QApplication::applicationFilePath(), arguments);
11882

119-
return app.exec();
83+
QApplication::quit();
12084
}

src/ui.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#pragma once
2+
3+
#include <QtWidgets/QMainWindow>
4+
#include <QtWidgets/QMenuBar>
5+
#include <QtWidgets/QMenu>
6+
#include <QtWidgets/QAction>
7+
8+
#include <QtWidgets/QApplication>
9+
#include <QtWidgets/QLabel>
10+
#include <QtGui/QDragEnterEvent>
11+
#include <QtGui/QDropEvent>
12+
#include <QtCore/QMimeData>
13+
#include <QtCore/QDebug>
14+
#include <QtCore/QFileInfo>
15+
#include <QtCore/QProcess>
16+
17+
#include "processing.h"
18+
19+
class DropArea : public QLabel {
20+
public:
21+
DropArea();
22+
23+
protected:
24+
void dragEnterEvent(QDragEnterEvent* event) override;
25+
void dropEvent(QDropEvent* event) override;
26+
};
27+
28+
class MainWindow : public QMainWindow {
29+
public:
30+
MainWindow();
31+
32+
private slots:
33+
void restartApp();
34+
};

0 commit comments

Comments
 (0)