-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqt_edit.cpp
More file actions
42 lines (35 loc) · 1.2 KB
/
qt_edit.cpp
File metadata and controls
42 lines (35 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <QApplication>
#include <QMainWindow>
#include <QWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLineEdit>
#include <QImage>
#include <QPainter>
#include <QFileDialog>
#include <QColorDialog>
#include "comicfile.hpp"
#include "qt_editWindow.hpp"
int main(int argc, char **argv) {
QApplication app(argc, argv);
if (argc < 2 || argc > 3) {
std::cerr << "usage: " << argv[0] << " <XML/JSON file> [output file]\n";
exit(-1);
}
Comicfile* comic = parse_file(argv[1]);
QMainWindow window;
MainWindow* box = new MainWindow(comic, &window);
// Todo this direct access is not good code
box->filename_in = argv[1];
if (argc == 3) {
box->filename_out = argv[2];
} else {
// Derive filename and format for output file
std::string filename_ext = box->filename_in.substr(box->filename_in.rfind('.')+1);
box->filename_out = QString::fromStdString(box->filename_in.substr(0, box->filename_in.rfind('.')+1) + comic->getLanguage() + "." + filename_ext).toStdString();
}
window.setCentralWidget(box);
//window.resize(comic->getImageWidth(), comic->getImageHeight() + 30);
window.show();
return app.exec();
}