src/dialogs.cpp

Thu, 04 Jul 2013 18:41:24 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 04 Jul 2013 18:41:24 +0300
changeset 329
76db02dc7f60
parent 319
d0f41342ef51
child 332
3013acb1df53
permissions
-rw-r--r--

Designerified the replace coordinates action

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
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
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.
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
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.
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
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>
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
28 #include <qprogressbar.h>
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>
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #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
32 #include "widgets.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include "gui.h"
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "gldraw.h"
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 #include "docs.h"
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
36 #include "file.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #include "dialogs.h"
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
39 extern_cfg (str, io_ldpath);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
40
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 // =============================================================================
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 rb_camera = new RadioBox ("Camera", {}, 0, Qt::Horizontal, this);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 for (int i = 0; i < 6; ++i) {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 if (i == 3)
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 rb_camera->rowBreak ();
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 rb_camera->addButton (g_CameraNames[i]);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 GL::Camera cam = g_win->R ()->camera ();
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 if (cam != GL::Free)
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 rb_camera->setValue ((int) cam);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 QGroupBox* gb_image = new QGroupBox ("Image", this);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 QLabel* lb_fpath = new QLabel ("File:");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 le_fpath = new QLineEdit;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 le_fpath->setFocus ();
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 QLabel* lb_ofs = new QLabel ("Origin:");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 btn_fpath = new QPushButton;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 btn_fpath->setIcon (getIcon ("folder"));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 connect (btn_fpath, SIGNAL (clicked ()), this, SLOT (slot_fpath ()));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 sb_ofsx = new QSpinBox;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 sb_ofsy = new QSpinBox;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 sb_ofsx->setRange (0, 10000);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 sb_ofsy->setRange (0, 10000);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 sb_ofsx->setSuffix (" px");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 sb_ofsy->setSuffix (" px");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 QLabel* lb_dimens = new QLabel ("Dimensions:");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 dsb_lwidth = new QDoubleSpinBox;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 dsb_lheight = new QDoubleSpinBox;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 dsb_lwidth->setRange (0.0f, 10000.0f);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 dsb_lheight->setRange (0.0f, 10000.0f);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 dsb_lwidth->setSuffix (" LDU");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 dsb_lheight->setSuffix (" LDU");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 dsb_lwidth->setSpecialValueText ("Automatic");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 dsb_lheight->setSpecialValueText ("Automatic");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 dbb_buttons = makeButtonBox (*this);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 dbb_buttons->addButton (QDialogButtonBox::Help);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 connect (dbb_buttons, SIGNAL (helpRequested ()), this, SLOT (slot_help()));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 QHBoxLayout* fpathlayout = new QHBoxLayout;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 fpathlayout->addWidget (lb_fpath);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 fpathlayout->addWidget (le_fpath);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 fpathlayout->addWidget (btn_fpath);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 QGridLayout* metalayout = new QGridLayout;
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 metalayout->addWidget (lb_ofs, 0, 0);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 metalayout->addWidget (sb_ofsx, 0, 1);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 metalayout->addWidget (sb_ofsy, 0, 2);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 metalayout->addWidget (lb_dimens, 1, 0);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 metalayout->addWidget (dsb_lwidth, 1, 1);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 metalayout->addWidget (dsb_lheight, 1, 2);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 QVBoxLayout* imagelayout = new QVBoxLayout (gb_image);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 imagelayout->addLayout (fpathlayout);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 imagelayout->addLayout (metalayout);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 QVBoxLayout* layout = new QVBoxLayout (this);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 layout->addWidget (rb_camera);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 layout->addWidget (gb_image);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 layout->addWidget (dbb_buttons);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 connect (dsb_lwidth, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged ()));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 connect (dsb_lheight, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged ()));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 connect (rb_camera, SIGNAL (valueChanged (int)), this, SLOT (fillDefaults (int)));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 slot_dimensionsChanged ();
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 fillDefaults (cam);
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
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 void OverlayDialog::fillDefaults (int newcam) {
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 250
diff changeset
119 overlayMeta& info = g_win->R ()->getOverlay (newcam);
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 if (info.img != null) {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 le_fpath->setText (info.fname);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 sb_ofsx->setValue (info.ox);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 sb_ofsy->setValue (info.oy);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 dsb_lwidth->setValue (info.lw);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 dsb_lheight->setValue (info.lh);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 } else {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 le_fpath->setText ("");
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 sb_ofsx->setValue (0);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 sb_ofsy->setValue (0);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
131 dsb_lwidth->setValue (0.0f);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 dsb_lheight->setValue (0.0f);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 str OverlayDialog::fpath () const { return le_fpath->text (); }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 ushort OverlayDialog::ofsx () const { return sb_ofsx->value (); }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 ushort OverlayDialog::ofsy () const { return sb_ofsy->value (); }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
139 double OverlayDialog::lwidth () const { return dsb_lwidth->value (); }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140 double OverlayDialog::lheight () const { return dsb_lheight->value (); }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 int OverlayDialog::camera () const { return rb_camera->value (); }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
143 void OverlayDialog::slot_fpath () {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 le_fpath->setText (QFileDialog::getOpenFileName (null, "Overlay image"));
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147 void OverlayDialog::slot_help () {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 showDocumentation (g_docs_overlays);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149 }
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151 void OverlayDialog::slot_dimensionsChanged () {
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 bool enable = (dsb_lwidth->value () != 0) || (dsb_lheight->value () != 0);
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153 dbb_buttons->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
154 }
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
155
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
156 // =============================================================================
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
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
158 // =============================================================================
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
159 SetContentsDialog::SetContentsDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
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
160 lb_error = new QLabel;
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
161 lb_errorIcon = new QLabel;
280
b8c2d4e8c2c1 And I forgot to rebrand the actual dialog box...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 274
diff changeset
162 lb_contents = new QLabel ("LDraw code:", parent);
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
163
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
164 le_contents = new QLineEdit (parent);
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
165 le_contents->setWhatsThis ("The LDraw code of this object. The code written "
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
166 "here is expected to be valid LDraw code, invalid code here results "
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
167 "the object being turned into an error object. Please do refer to the "
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
168 "<a href=\"http://www.ldraw.org/article/218.html\">official file format "
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
169 "standard</a> for further information.");
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
170 le_contents->setMinimumWidth (384);
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
171
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
172 QHBoxLayout* bottomRow = new QHBoxLayout;
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
173 bottomRow->addWidget (lb_errorIcon);
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
174 bottomRow->addWidget (lb_error);
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
175 bottomRow->addWidget (makeButtonBox (*this));
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
176
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
177 QVBoxLayout* layout = new QVBoxLayout (this);
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
178 layout->addWidget (lb_contents);
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
179 layout->addWidget (le_contents);
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
180 layout->addLayout (bottomRow);
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
181
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
182 setWindowIcon (getIcon ("set-contents"));
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
183 }
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
184
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
185 void SetContentsDialog::setObject (LDObject* obj) {
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 280
diff changeset
186 le_contents->setText (obj->raw ());
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
187
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
188 if (obj->getType() == LDObject::Gibberish) {
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 280
diff changeset
189 lb_error->setText (fmt ("<span style=\"color: #900\">%1</span>",
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 280
diff changeset
190 static_cast<LDGibberish*> (obj)->reason));
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
191
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
192 QPixmap errorPixmap = getIcon ("error").scaledToHeight (16);
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
193 lb_errorIcon->setPixmap (errorPixmap);
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
194 }
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
195 }
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
196
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
197 str SetContentsDialog::text () const {
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
198 return le_contents->text ();
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
199 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
200
258
f9c48d4481e1 Fixed text editing not triggering configuration. So simple..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
201 // =================================================================================================
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
202 LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f)
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
203 : QDialog (parent, f), m_validDefault (validDefault)
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
204 {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
205 QLabel* lb_description = null;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
206 lb_resolution = new QLabel ("---");
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 if (validDefault == false)
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
209 lb_description = new QLabel ("Please input your LDraw directory");
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
210
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
211 QLabel* lb_path = new QLabel ("LDraw path:");
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
212 le_path = new QLineEdit;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
213 btn_findPath = new QPushButton;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
214 btn_findPath->setIcon (getIcon ("folder"));
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
215
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
216 btn_cancel = new QPushButton;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
217
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
218 if (validDefault == false) {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
219 btn_cancel->setText ("Exit");
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
220 btn_cancel->setIcon (getIcon ("exit"));
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
221 } else {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
222 btn_cancel->setText ("Cancel");
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
223 btn_cancel->setIcon (getIcon ("cancel"));
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
224 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
225
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
226 dbb_buttons = new QDialogButtonBox (QDialogButtonBox::Ok);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
227 dbb_buttons->addButton (btn_cancel, QDialogButtonBox::RejectRole);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
228 okButton ()->setEnabled (false);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
229
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
230 QHBoxLayout* inputLayout = new QHBoxLayout;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
231 inputLayout->addWidget (lb_path);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
232 inputLayout->addWidget (le_path);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
233 inputLayout->addWidget (btn_findPath);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
234
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
235 QVBoxLayout* mainLayout = new QVBoxLayout;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
236
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
237 if (validDefault == false)
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
238 mainLayout->addWidget (lb_description);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
239
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
240 mainLayout->addLayout (inputLayout);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
241 mainLayout->addWidget (lb_resolution);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
242 mainLayout->addWidget (dbb_buttons);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
243 setLayout (mainLayout);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
244
258
f9c48d4481e1 Fixed text editing not triggering configuration. So simple..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
245 connect (le_path, SIGNAL (textEdited (QString)), this, SLOT (slot_tryConfigure ()));
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
246 connect (btn_findPath, SIGNAL (clicked ()), this, SLOT (slot_findPath ()));
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
247 connect (dbb_buttons, SIGNAL (accepted ()), this, SLOT (accept ()));
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
248 connect (dbb_buttons, SIGNAL (rejected ()), this, (validDefault) ? SLOT (reject ()) : SLOT (slot_exit ()));
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
249
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
250 setPath (io_ldpath);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
251 if (validDefault)
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
252 slot_tryConfigure ();
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
253 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
254
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
255 QPushButton* LDrawPathDialog::okButton () {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
256 return dbb_buttons->button (QDialogButtonBox::Ok);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
257 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
258
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
259 void LDrawPathDialog::setPath (str path) {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
260 le_path->setText (path);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
261 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
262
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 249
diff changeset
263 str LDrawPathDialog::filename () const {
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
264 return le_path->text ();
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
265 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
266
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
267 void LDrawPathDialog::slot_findPath () {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
268 str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path");
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
269
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 280
diff changeset
270 if (newpath.length () > 0 && newpath != filename ()) {
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
271 setPath (newpath);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
272 slot_tryConfigure ();
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
273 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
274 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
275
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
276 void LDrawPathDialog::slot_exit () {
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
277 exit (1);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
278 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
279
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
280 void LDrawPathDialog::slot_tryConfigure () {
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 249
diff changeset
281 if (LDPaths::tryConfigure (filename ()) == false) {
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 280
diff changeset
282 lb_resolution->setText (fmt ("<span style=\"color:red; font-weight: bold;\">%1</span>",
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 280
diff changeset
283 LDPaths::getError()));
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
284 okButton ()->setEnabled (false);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
285 return;
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
286 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
287
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
288 lb_resolution->setText ("<span style=\"color: #7A0; font-weight: bold;\">OK!</span>");
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
289 okButton ()->setEnabled (true);
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
290 }
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
291
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
292 // =============================================================================
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
294 // =============================================================================
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
295 RotationPointDialog::RotationPointDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
296 rb_rotpoint = new RadioBox ("Rotation Point", { "Object center", "Custom" }, 0, Qt::Vertical, this);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
297 connect (rb_rotpoint, SIGNAL (valueChanged (int)), this, SLOT (radioBoxChanged ()));
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
298
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
299 gb_customPos = new QGroupBox ("Custom point", this);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
300 dsb_customX = new QDoubleSpinBox;
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
301 dsb_customY = new QDoubleSpinBox;
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
302 dsb_customZ = new QDoubleSpinBox;
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
303
212
79c5205b807c Fixed: rotation point dialog didn't accept negative custom coords; objects were rotated by the grid angle's half
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
304 for (auto x : initlist<QDoubleSpinBox*> ({dsb_customX, dsb_customY, dsb_customZ}))
79c5205b807c Fixed: rotation point dialog didn't accept negative custom coords; objects were rotated by the grid angle's half
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
305 x->setRange (-10000.0f, 10000.0f);
79c5205b807c Fixed: rotation point dialog didn't accept negative custom coords; objects were rotated by the grid angle's half
Santeri Piippo <crimsondusk64@gmail.com>
parents: 211
diff changeset
306
211
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
307 QGridLayout* customLayout = new QGridLayout (gb_customPos);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
308 customLayout->setColumnStretch (1, 1);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
309 customLayout->addWidget (new QLabel ("X"), 0, 0);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
310 customLayout->addWidget (dsb_customX, 0, 1);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
311 customLayout->addWidget (new QLabel ("Y"), 1, 0);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
312 customLayout->addWidget (dsb_customY, 1, 1);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
313 customLayout->addWidget (new QLabel ("Z"), 2, 0);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
314 customLayout->addWidget (dsb_customZ, 2, 1);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
315
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
316 QVBoxLayout* layout = new QVBoxLayout (this);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
317 layout->addWidget (rb_rotpoint);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
318 layout->addWidget (gb_customPos);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
319 layout->addWidget (makeButtonBox (*this));
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
320 }
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
321
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
322 bool RotationPointDialog::custom () const {
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
323 return rb_rotpoint->value () == 1;
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
324 }
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
325
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
326 vertex RotationPointDialog::customPos () const {
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
327 return vertex (dsb_customX->value (), dsb_customY->value (), dsb_customZ->value ());
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
328 }
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
329
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
330 void RotationPointDialog::setCustom (bool custom) {
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
331 rb_rotpoint->setValue (custom == true ? 1 : 0);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
332 gb_customPos->setEnabled (custom);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
333 }
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
334
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
335 void RotationPointDialog::setCustomPos (const vertex& pos) {
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
336 dsb_customX->setValue (pos[X]);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
337 dsb_customY->setValue (pos[Y]);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
338 dsb_customZ->setValue (pos[Z]);
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
339 }
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
340
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
341 void RotationPointDialog::radioBoxChanged () {
8d35e631bef3 Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
342 setCustom (rb_rotpoint->value ());
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
343 }
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
344
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
345 // =============================================================================
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
346 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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
347 // =============================================================================
249
6b2cc2d82ba6 Use QMutex for the thread locking, remove filename from the progress dialog since it's not known anyway
Santeri Piippo <crimsondusk64@gmail.com>
parents: 248
diff changeset
348 OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
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
349 progressBar = new QProgressBar;
319
d0f41342ef51 Show values in file opening prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
350 progressText = new QLabel( "Parsing..." );
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
351 setNumLines (0);
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
352 m_progress = 0;
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
353
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
354 QDialogButtonBox* dbb_buttons = new QDialogButtonBox;
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
355 dbb_buttons->addButton (QDialogButtonBox::Cancel);
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
356 connect (dbb_buttons, SIGNAL (rejected ()), this, SLOT (reject ()));
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
357
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
358 QVBoxLayout* layout = new QVBoxLayout (this);
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
359 layout->addWidget (progressText);
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
360 layout->addWidget (progressBar);
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
361 layout->addWidget (dbb_buttons);
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
362 }
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
363
274
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
364 READ_ACCESSOR (ulong, OpenProgressDialog::numLines) {
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
365 return m_numLines;
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
366 }
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
367
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
368 SET_ACCESSOR (ulong, OpenProgressDialog::setNumLines) {
d232fe4d88a6 Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
369 m_numLines = val;
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
370 progressBar->setRange (0, numLines ());
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
371 updateValues ();
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
372 }
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
373
249
6b2cc2d82ba6 Use QMutex for the thread locking, remove filename from the progress dialog since it's not known anyway
Santeri Piippo <crimsondusk64@gmail.com>
parents: 248
diff changeset
374 void OpenProgressDialog::updateValues () {
319
d0f41342ef51 Show values in file opening prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
375 progressText->setText( fmt( "Parsing... %1 / %2", progress(), numLines() ));
d0f41342ef51 Show values in file opening prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
376 progressBar->setValue( progress() );
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
377 }
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
378
249
6b2cc2d82ba6 Use QMutex for the thread locking, remove filename from the progress dialog since it's not known anyway
Santeri Piippo <crimsondusk64@gmail.com>
parents: 248
diff changeset
379 void OpenProgressDialog::updateProgress (int progress) {
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
380 m_progress = progress;
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
381 updateValues ();
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
382 }

mercurial