Skip to content

Commit e369334

Browse files
committed
splitting code
1 parent 51cc6f2 commit e369334

File tree

6 files changed

+100
-21
lines changed

6 files changed

+100
-21
lines changed

Solidify.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@
129129
</Link>
130130
</ItemDefinitionGroup>
131131
<ItemGroup>
132+
<ClCompile Include="src\processing.cpp" />
132133
<ClCompile Include="src\Solidify.cpp" />
133134
<ClCompile Include="src\ui.cpp" />
134135
</ItemGroup>
135136
<ItemGroup>
137+
<ClInclude Include="src\processing.h" />
136138
<ClInclude Include="src\solidify.h" />
137139
<ClInclude Include="src\Timer.h" />
138140
</ItemGroup>

Solidify.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<ClCompile Include="src\ui.cpp">
2222
<Filter>Source Files</Filter>
2323
</ClCompile>
24+
<ClCompile Include="src\processing.cpp">
25+
<Filter>Source Files</Filter>
26+
</ClCompile>
2427
</ItemGroup>
2528
<ItemGroup>
2629
<ClInclude Include="src\Timer.h">
@@ -29,5 +32,8 @@
2932
<ClInclude Include="src\solidify.h">
3033
<Filter>Source Files</Filter>
3134
</ClInclude>
35+
<ClInclude Include="src\processing.h">
36+
<Filter>Source Files</Filter>
37+
</ClInclude>
3238
</ItemGroup>
3339
</Project>

src/processing.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
#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>
24+
25+
#include "solidify.h"
26+
27+
std::vector<QString> fileNames; // This will hold the names of all files
28+
29+
bool doProcessing(QList<QUrl> urls) {
30+
for (const QUrl& url : urls) {
31+
QString fileName = url.toLocalFile();
32+
if (!fileName.isEmpty()) {
33+
fileNames.push_back(fileName);
34+
}
35+
}
36+
37+
for (int i = 0; i < fileNames.size(); i++) {
38+
//qDebug() << "File name: " << fileName;
39+
QFileInfo fileInfo(fileNames[i]);
40+
QString baseName = fileInfo.baseName();
41+
QString path = fileInfo.absolutePath();
42+
QString outName = path + "/" + baseName + "_fill." + fileInfo.completeSuffix();
43+
44+
// Call the solidify_main function
45+
if (solidify_main(fileNames[i].toStdString(), outName.toStdString())) {
46+
exit(-1);
47+
};
48+
}
49+
50+
return true;
51+
}

src/processing.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#pragma once
19+
#include <QtCore/QFileInfo>
20+
21+
bool doProcessing(QList<QUrl> urls);

src/solidify.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
*/
117
#pragma once
218

3-
int solidify_main(const std::string& inputFileName, const std::string& outputFileName);
19+
int solidify_main(const std::string& inputFileName, const std::string& outputFileName);

src/ui.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <QtCore/QDebug>
2424
#include <QtCore/QFileInfo>
2525

26-
#include "solidify.h"
26+
#include "processing.h"
2727

2828
class DropArea : public QLabel {
2929
public:
@@ -50,27 +50,10 @@ class DropArea : public QLabel {
5050
// return;
5151
//}
5252

53-
std::vector<QString> fileNames; // This will hold the names of all files
53+
// Processing
5454

55-
for (const QUrl& url : urls) {
56-
QString fileName = url.toLocalFile();
57-
if (!fileName.isEmpty()) {
58-
fileNames.push_back(fileName);
59-
}
60-
}
61-
62-
for (int i = 0; i < fileNames.size(); i++) {
63-
//qDebug() << "File name: " << fileName;
64-
QFileInfo fileInfo(fileNames[i]);
65-
QString baseName = fileInfo.baseName();
66-
QString path = fileInfo.absolutePath();
67-
QString outName = path + "/" + baseName + "_fill." + fileInfo.completeSuffix();
55+
bool success = doProcessing(urls);
6856

69-
// Call the solidify_main function
70-
if (solidify_main(fileNames[i].toStdString(), outName.toStdString())) {
71-
exit(-1);
72-
};
73-
}
7457
qDebug() << "Done!";
7558
}
7659
};

0 commit comments

Comments
 (0)