src/dialogs.cpp

Sat, 07 Dec 2013 01:03:17 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 07 Dec 2013 01:03:17 +0200
changeset 550
d97594e3fc54
parent 540
0334789cb4d7
child 553
2418d5955421
permissions
-rw-r--r--

more stuff

198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
4 *
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
9 *
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
14 *
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QDialog>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QLineEdit>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QSpinBox>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QDialogButtonBox>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QFileDialog>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <QLabel>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include <QPushButton>
202
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 200
diff changeset
26 #include <QBoxLayout>
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
27 #include <QGridLayout>
431
ec1e2059319b stability to downloading
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
28 #include <QProgressBar>
262
56f8987f4c7c Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents: 259
diff changeset
29 #include <QCheckBox>
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
30 #include <QDesktopServices>
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
31 #include <QMessageBox>
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
32 #include <QUrl>
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include "dialogs.h"
202
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 200
diff changeset
34 #include "widgets.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 #include "gui.h"
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 #include "gldraw.h"
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #include "docs.h"
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
38 #include "file.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 #include "dialogs.h"
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
40 #include "ui_overlay.h"
337
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
41 #include "ui_ldrawpath.h"
370
843b3dbbd849 make file loading be done properly as just a QObject rather than multi-threaded..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 337
diff changeset
42 #include "ui_openprogress.h"
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
43 #include "ui_extprogpath.h"
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
44 #include "ui_about.h"
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
45 #include "ui_bombbox.h"
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
46 #include "moc_dialogs.cpp"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
48 extern const char* g_extProgPathFilter;
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
49 extern_cfg (String, io_ldpath);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
50
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
52 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
53 OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
54 { ui = new Ui_OverlayUI;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
55 ui->setupUi (this);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
56
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
57 m_cameraArgs =
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
58 { { ui->top, GL::ETopCamera },
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
59 { ui->bottom, GL::EBottomCamera },
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
60 { ui->front, GL::EFrontCamera },
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
61 { ui->back, GL::EBackCamera },
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
62 { ui->left, GL::ELeftCamera },
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
63 { ui->right, GL::ERightCamera }
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
64 };
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
65
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
66 GL::EFixedCamera cam = g_win->R()->camera();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
67
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
68 if (cam == GL::EFreeCamera)
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
69 cam = GL::ETopCamera;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
70
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
71 connect (ui->width, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
72 connect (ui->height, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
73 connect (ui->buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_help()));
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
74 connect (ui->fileSearchButton, SIGNAL (clicked (bool)), this, SLOT (slot_fpath()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
75
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
76 slot_dimensionsChanged();
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
77 fillDefaults (cam);
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
78 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
79
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
80 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
81 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
82 OverlayDialog::~OverlayDialog()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
83 { delete ui;
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
86 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
87 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
88 void OverlayDialog::fillDefaults (int newcam)
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
89 { LDGLOverlay& info = g_win->R()->getOverlay (newcam);
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
90 radioDefault<int> (newcam, m_cameraArgs);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
91
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
92 if (info.img != null)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
93 { ui->filename->setText (info.fname);
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
94 ui->originX->setValue (info.ox);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
95 ui->originY->setValue (info.oy);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
96 ui->width->setValue (info.lw);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
97 ui->height->setValue (info.lh);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
98 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
99 else
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
100 { ui->filename->setText ("");
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
101 ui->originX->setValue (0);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
102 ui->originY->setValue (0);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
103 ui->width->setValue (0.0f);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
104 ui->height->setValue (0.0f);
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
105 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
106 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
107
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
108 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
109 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
110 str OverlayDialog::fpath() const
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
111 { return ui->filename->text();
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
112 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
113
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 497
diff changeset
114 int OverlayDialog::ofsx() const
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
115 { return ui->originX->value();
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 497
diff changeset
118 int OverlayDialog::ofsy() const
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
119 { return ui->originY->value();
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
120 }
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
122 double OverlayDialog::lwidth() const
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
123 { return ui->width->value();
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
124 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
125
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
126 double OverlayDialog::lheight() const
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
127 { return ui->height->value();
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
130 int OverlayDialog::camera() const
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
131 { return radioSwitch<int> (GL::ETopCamera, m_cameraArgs);
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
132 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
133
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
134 void OverlayDialog::slot_fpath()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
135 { ui->filename->setText (QFileDialog::getOpenFileName (null, "Overlay image"));
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
138 void OverlayDialog::slot_help()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
139 { showDocumentation (g_docs_overlays);
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
140 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 333
diff changeset
141
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
142 void OverlayDialog::slot_dimensionsChanged()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
143 { bool enable = (ui->width->value() != 0) || (ui->height->value() != 0);
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
144 ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (enable);
199
10dd5909a50e Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
145 }
10dd5909a50e Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
146
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
147 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
148 // -----------------------------------------------------------------------------
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
149 LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f) :
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
150 QDialog (parent, f),
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
151 m_validDefault (validDefault)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
152 { ui = new Ui_LDPathUI;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
153 ui->setupUi (this);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
154 ui->status->setText ("---");
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
155
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
156 if (validDefault)
337
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
157 ui->heading->hide();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
158 else
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
159 { cancelButton()->setText ("Exit");
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
160 cancelButton()->setIcon (getIcon ("exit"));
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
161 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
162
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
163 okButton()->setEnabled (false);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
164
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
165 connect (ui->path, SIGNAL (textEdited (QString)), this, SLOT (slot_tryConfigure()));
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
166 connect (ui->searchButton, SIGNAL (clicked()), this, SLOT (slot_findPath()));
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
167 connect (ui->buttonBox, SIGNAL (rejected()), this, validDefault ? SLOT (reject()) : SLOT (slot_exit()));
436
4268a5507725 Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
168 connect (ui->buttonBox, SIGNAL (accepted()), this, SLOT (slot_accept()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
169
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
170 setPath (io_ldpath);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
171
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
172 if (validDefault)
337
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
173 slot_tryConfigure();
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
174 }
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
175
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
176 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
177 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
178 LDrawPathDialog::~LDrawPathDialog()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
179 { delete ui;
337
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
180 }
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
181
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
182 QPushButton* LDrawPathDialog::okButton()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
183 { return ui->buttonBox->button (QDialogButtonBox::Ok);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
184 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
185
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
186 QPushButton* LDrawPathDialog::cancelButton()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
187 { return ui->buttonBox->button (QDialogButtonBox::Cancel);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
188 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
189
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
190 void LDrawPathDialog::setPath (str path)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
191 { ui->path->setText (path);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
192 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
193
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
194 str LDrawPathDialog::filename() const
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
195 { return ui->path->text();
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
196 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
197
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
198 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
199 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
200 void LDrawPathDialog::slot_findPath()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
201 { str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
202
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
203 if (newpath.length() > 0 && newpath != filename())
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
204 { setPath (newpath);
337
4e05207c76c9 Converted ldraw path prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
205 slot_tryConfigure();
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
206 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
207 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
208
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
209 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
210 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
211 void LDrawPathDialog::slot_exit()
526
b29b6fc45ba9 style corrections
Santeri Piippo <crimsondusk64@gmail.com>
parents: 513
diff changeset
212 { exit (0);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
213 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
214
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
215 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
216 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
217 void LDrawPathDialog::slot_tryConfigure()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
218 { if (LDPaths::tryConfigure (filename()) == false)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
219 { ui->status->setText (fmt ("<span style=\"color:#700; \">%1</span>", LDPaths::getError()));
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
220 okButton()->setEnabled (false);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
221 return;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
222 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
223
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
224 ui->status->setText ("<span style=\"color: #270; \">OK!</span>");
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
225 okButton()->setEnabled (true);
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
226 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
227
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
228 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
229 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
230 void LDrawPathDialog::slot_accept()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
231 { Config::save();
436
4268a5507725 Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
232 accept();
4268a5507725 Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
233 }
4268a5507725 Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
234
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
235 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
236 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
237 OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
238 { ui = new Ui_OpenProgressUI;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
239 ui->setupUi (this);
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
240 ui->progressText->setText ("Parsing...");
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
241 setNumLines (0);
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 526
diff changeset
242 m_Progress = 0;
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 226
diff changeset
243 }
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 226
diff changeset
244
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
245 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
246 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
247 OpenProgressDialog::~OpenProgressDialog()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
248 { delete ui;
370
843b3dbbd849 make file loading be done properly as just a QObject rather than multi-threaded..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 337
diff changeset
249 }
843b3dbbd849 make file loading be done properly as just a QObject rather than multi-threaded..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 337
diff changeset
250
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
251 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
252 // -----------------------------------------------------------------------------
540
0334789cb4d7 - Changed the callback parm of PROPERTY to a stock/custom write method argument.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 539
diff changeset
253 void OpenProgressDialog::setNumLines (int const& a)
0334789cb4d7 - Changed the callback parm of PROPERTY to a stock/custom write method argument.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 539
diff changeset
254 { m_NumLines = a;
0334789cb4d7 - Changed the callback parm of PROPERTY to a stock/custom write method argument.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 539
diff changeset
255 ui->progressBar->setRange (0, getNumLines());
370
843b3dbbd849 make file loading be done properly as just a QObject rather than multi-threaded..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 337
diff changeset
256 updateValues();
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 226
diff changeset
257 }
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 226
diff changeset
258
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
259 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
260 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
261 void OpenProgressDialog::updateValues()
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 526
diff changeset
262 { ui->progressText->setText (fmt ("Parsing... %1 / %2", getProgress(), getNumLines()));
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 526
diff changeset
263 ui->progressBar->setValue (getProgress());
248
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 226
diff changeset
264 }
4431371f3ffe Added a progress dialog for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. My first real use case of multi-threading...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 226
diff changeset
265
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
266 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
267 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
268 void OpenProgressDialog::updateProgress (int progress)
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 526
diff changeset
269 { setProgress (progress);
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
270 updateValues();
410
a5aebcf4a1c8 Include the moc files in the source cpp files to reduce compile time
Santeri Piippo <crimsondusk64@gmail.com>
parents: 370
diff changeset
271 }
a5aebcf4a1c8 Include the moc files in the source cpp files to reduce compile time
Santeri Piippo <crimsondusk64@gmail.com>
parents: 370
diff changeset
272
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
273 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
274 // -----------------------------------------------------------------------------
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
275 ExtProgPathPrompt::ExtProgPathPrompt (str progName, QWidget* parent, Qt::WindowFlags f) :
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
276 QDialog (parent, f),
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
277 ui (new Ui_ExtProgPath)
526
b29b6fc45ba9 style corrections
Santeri Piippo <crimsondusk64@gmail.com>
parents: 513
diff changeset
278 {
b29b6fc45ba9 style corrections
Santeri Piippo <crimsondusk64@gmail.com>
parents: 513
diff changeset
279 ui->setupUi (this);
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
280 str labelText = ui->m_label->text();
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
281 labelText.replace ("<PROGRAM>", progName);
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
282 ui->m_label->setText (labelText);
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
283 connect (ui->m_findPath, SIGNAL (clicked (bool)), this, SLOT (findPath()));
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
284 }
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
285
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
286 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
287 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
288 ExtProgPathPrompt::~ExtProgPathPrompt()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
289 { delete ui;
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
290 }
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
291
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
292 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
293 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
294 void ExtProgPathPrompt::findPath()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
295 { str path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
296
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
297 if (!path.isEmpty())
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
298 ui->m_path->setText (path);
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
299 }
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 436
diff changeset
300
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
301 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
302 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
303 str ExtProgPathPrompt::getPath() const
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
304 { return ui->m_path->text();
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
305 }
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
306
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
307 // =============================================================================
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
308 // -----------------------------------------------------------------------------
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
309 AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) :
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
310 QDialog (parent, f)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
311 { Ui::AboutUI ui;
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
312 ui.setupUi (this);
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
313 ui.versionInfo->setText (fmt (tr ("LDForge %1"), fullVersionString()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
314
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
315 QPushButton* mailButton = new QPushButton;
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
316 mailButton->setText ("Contact");
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
317 mailButton->setIcon (getIcon ("mail"));
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
318 ui.buttonBox->addButton (static_cast<QAbstractButton*> (mailButton), QDialogButtonBox::HelpRole);
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
319 connect (ui.buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_mail()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
320
472
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
321 setWindowTitle ("About " APPNAME);
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
322 }
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
323
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
324 // =============================================================================
8986414c6ad5 merged aboutDialog.cpp to dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
325 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
326 void AboutDialog::slot_mail()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
327 { QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <slatenails64@gmail.com>?subject=LDForge"));
491
7d1b5ecd76c0 it's LDForge's 1st birthday!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
328 }
513
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
329
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
330 // =============================================================================
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
331 // -----------------------------------------------------------------------------
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
332 void bombBox (const str& message)
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
333 { QDialog dlg (g_win);
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
334 Ui_BombBox ui;
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
335
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
336 ui.setupUi (&dlg);
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
337 ui.m_text->setText (message);
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
338 ui.buttonBox->button (QDialogButtonBox::Close)->setText (QObject::tr ("Damn it"));
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
339 dlg.exec();
29eb671b34f6 Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
340 }

mercurial