Wed, 08 May 2013 13:19:07 +0300
Object editing dialog now can alter the matrix of subfiles and radials
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include <qlineedit.h> |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <qpushbutton.h> |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include <qdialogbuttonbox.h> |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <QFileDialog> |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "zz_ldrawPathDialog.h" |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "gui.h" |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "file.h" |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
27 | extern_cfg (str, io_ldpath); |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | // ======================================================================================================================================== |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
30 | LDrawPathDialog::LDrawPathDialog (const bool validDefault, QWidget* parent, Qt::WindowFlags f) |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
31 | : QDialog (parent, f), m_validDefault (validDefault) |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
32 | { |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
33 | QLabel* lb_description; |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | lb_resolution = new QLabel ("---"); |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
35 | |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
36 | if (validDefault == false) |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
37 | lb_description = new QLabel ("Please input your LDraw directory"); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
38 | |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | QLabel* lb_path = new QLabel ("LDraw path:"); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | le_path = new QLineEdit; |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | btn_findPath = new QPushButton; |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | btn_findPath->setIcon (getIcon ("folder")); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | btn_tryConfigure = new QPushButton ("Configure"); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | btn_tryConfigure->setIcon (getIcon ("settings")); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
47 | btn_cancel = new QPushButton; |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
48 | |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
49 | if (validDefault == false) { |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
50 | btn_cancel->setText ("Exit"); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
51 | btn_cancel->setIcon (getIcon ("exit")); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
52 | } else { |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
53 | btn_cancel->setText ("Cancel"); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
54 | btn_cancel->setIcon (getIcon ("cancel")); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
55 | } |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | dbb_buttons = new QDialogButtonBox (QDialogButtonBox::Ok); |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
58 | dbb_buttons->addButton (btn_tryConfigure, QDialogButtonBox::ActionRole); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
59 | dbb_buttons->addButton (btn_cancel, QDialogButtonBox::RejectRole); |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | okButton ()->setEnabled (false); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | QHBoxLayout* inputLayout = new QHBoxLayout; |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | inputLayout->addWidget (lb_path); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | inputLayout->addWidget (le_path); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | inputLayout->addWidget (btn_findPath); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | QVBoxLayout* mainLayout = new QVBoxLayout; |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
68 | |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
69 | if (validDefault == false) |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
70 | mainLayout->addWidget (lb_description); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
71 | |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | mainLayout->addLayout (inputLayout); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | mainLayout->addWidget (lb_resolution); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | mainLayout->addWidget (dbb_buttons); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | setLayout (mainLayout); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
77 | connect (le_path, SIGNAL (textEdited ()), this, SLOT (slot_tryConfigure ())); |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | connect (btn_findPath, SIGNAL (clicked ()), this, SLOT (slot_findPath ())); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | connect (btn_tryConfigure, SIGNAL (clicked ()), this, SLOT (slot_tryConfigure ())); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | connect (dbb_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
81 | connect (dbb_buttons, SIGNAL (rejected ()), this, (validDefault) ? SLOT (reject ()) : SLOT (slot_exit ())); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
82 | |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
83 | setPath (io_ldpath); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
84 | if (validDefault) |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
179
diff
changeset
|
85 | slot_tryConfigure (); |
179
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | // ======================================================================================================================================== |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | QPushButton* LDrawPathDialog::okButton () { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | return dbb_buttons->button (QDialogButtonBox::Ok); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | // ======================================================================================================================================== |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | void LDrawPathDialog::setPath (str path) { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | le_path->setText (path); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | // ======================================================================================================================================== |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | str LDrawPathDialog::path () const { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | return le_path->text (); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | // ======================================================================================================================================== |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | void LDrawPathDialog::slot_findPath () { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | str newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path"); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | if (~newpath > 0 && newpath != path ()) { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | setPath (newpath); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | slot_tryConfigure (); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | // ======================================================================================================================================== |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | void LDrawPathDialog::slot_exit () { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | exit (1); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | // ======================================================================================================================================== |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | void LDrawPathDialog::slot_tryConfigure () { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | if (LDPaths::tryConfigure (path ()) == false) { |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | lb_resolution->setText (fmt ("<span style=\"color:red; font-weight: bold;\">%s</span>", LDPaths::getError().chars ())); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | okButton ()->setEnabled (false); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | return; |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | } |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | lb_resolution->setText ("<span style=\"color: #7A0; font-weight: bold;\">OK!</span>"); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | okButton ()->setEnabled (true); |
f98391b179ab
Added a dialog for inquering the user's LDraw directory, not having it set leads to crashing...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | } |