src/dialogs.cpp

Tue, 16 Feb 2016 01:51:00 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 16 Feb 2016 01:51:00 +0200
changeset 1020
815a040d4039
parent 1014
f0a8ecb6a357
child 1032
376db8dd6a42
permissions
-rw-r--r--

Reformatted primitives.cpp
Added license headers to generateprimitivedialog.cpp and .h

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1014
f0a8ecb6a357 Happy new year 2016!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 985
diff changeset
3 * Copyright (C) 2013 - 2016 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QDialog>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QLineEdit>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QSpinBox>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QDialogButtonBox>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QFileDialog>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <QLabel>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include <QPushButton>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include <QBoxLayout>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include <QGridLayout>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 #include <QProgressBar>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include <QCheckBox>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include <QDesktopServices>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #include <QMessageBox>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 #include <QUrl>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include "dialogs.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "radioGroup.h"
962
a4b463a7ee82 Rename MainWindow files
Teemu Piippo <crimsondusk64@gmail.com>
parents: 958
diff changeset
35 #include "mainwindow.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 #include "glRenderer.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #include "documentation.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 #include "ldDocument.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 #include "dialogs.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 #include "ui_overlay.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 #include "ui_extprogpath.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 #include "ui_about.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 extern const char* g_extProgPathFilter;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 OverlayDialog::OverlayDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 ui = new Ui_OverlayUI;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 ui->setupUi (this);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 m_cameraArgs =
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 {
762
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
55 { ui->top, ETopCamera },
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
56 { ui->bottom, EBottomCamera },
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
57 { ui->front, EFrontCamera },
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
58 { ui->back, EBackCamera },
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
59 { ui->left, ELeftCamera },
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
60 { ui->right, ERightCamera }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62
981
5d5d84ab2c48 Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 970
diff changeset
63 ECamera cam = g_win->renderer()->camera();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64
762
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
65 if (cam == EFreeCamera)
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 757
diff changeset
66 cam = ETopCamera;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 connect (ui->width, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 connect (ui->height, SIGNAL (valueChanged (double)), this, SLOT (slot_dimensionsChanged()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 connect (ui->buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_help()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 connect (ui->fileSearchButton, SIGNAL (clicked (bool)), this, SLOT (slot_fpath()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 slot_dimensionsChanged();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 fillDefaults (cam);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 OverlayDialog::~OverlayDialog()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 delete ui;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 void OverlayDialog::fillDefaults (int newcam)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 {
981
5d5d84ab2c48 Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents: 970
diff changeset
88 LDGLOverlay& info = g_win->renderer()->getOverlay (newcam);
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
89 RadioDefault<int> (newcam, m_cameraArgs);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
985
ed7b31b9f904 Remove "!= nullptr" expressions
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
91 if (info.img)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 ui->filename->setText (info.fname);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 ui->originX->setValue (info.ox);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 ui->originY->setValue (info.oy);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 ui->width->setValue (info.lw);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 ui->height->setValue (info.lh);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 else
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 ui->filename->setText ("");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 ui->originX->setValue (0);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 ui->originY->setValue (0);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 ui->width->setValue (0.0f);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 ui->height->setValue (0.0f);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 // =============================================================================
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
111 QString OverlayDialog::fpath() const
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 return ui->filename->text();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 int OverlayDialog::ofsx() const
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 return ui->originX->value();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 int OverlayDialog::ofsy() const
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 return ui->originY->value();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 double OverlayDialog::lwidth() const
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 return ui->width->value();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
131 double OverlayDialog::lheight() const
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 return ui->height->value();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 int OverlayDialog::camera() const
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
138 return RadioSwitch<int> (ETopCamera, m_cameraArgs);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
139 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 void OverlayDialog::slot_fpath()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142 {
984
a7b6f987d269 null -> nullptr
Teemu Piippo <crimsondusk64@gmail.com>
parents: 981
diff changeset
143 ui->filename->setText (QFileDialog::getOpenFileName (nullptr, "Overlay image"));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146 void OverlayDialog::slot_help()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 showDocumentation (g_docs_overlays);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151 void OverlayDialog::slot_dimensionsChanged()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 {
840
d077dd19bf9a - changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents: 816
diff changeset
153 bool enable = (ui->width->value() != 0) or (ui->height->value() != 0);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
154 ui->buttonBox->button (QDialogButtonBox::Ok)->setEnabled (enable);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
155 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
157 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158 // =============================================================================
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
159 ExtProgPathPrompt::ExtProgPathPrompt (QString progName, QWidget* parent, Qt::WindowFlags f) :
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
160 QDialog (parent, f),
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
161 ui (new Ui_ExtProgPath)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
162 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
163 ui->setupUi (this);
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
164 QString labelText = ui->m_label->text();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
165 labelText.replace ("<PROGRAM>", progName);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
166 ui->m_label->setText (labelText);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167 connect (ui->m_findPath, SIGNAL (clicked (bool)), this, SLOT (findPath()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
168 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
169
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172 ExtProgPathPrompt::~ExtProgPathPrompt()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174 delete ui;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
175 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
176
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
178 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
179 void ExtProgPathPrompt::findPath()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180 {
984
a7b6f987d269 null -> nullptr
Teemu Piippo <crimsondusk64@gmail.com>
parents: 981
diff changeset
181 QString path = QFileDialog::getOpenFileName (nullptr, "", "", g_extProgPathFilter);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
183 if (not path.isEmpty())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
184 ui->m_path->setText (path);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
188 // =============================================================================
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
189 QString ExtProgPathPrompt::getPath() const
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
190 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
191 return ui->m_path->text();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
192 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
193
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
194 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
196 AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) :
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 QDialog (parent, f)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 Ui::AboutUI ui;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
200 ui.setupUi (this);
948
3a91828475fd Replaced updaterevision with a python script, more renames, clang fixes
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
201 ui.versionInfo->setText (APPNAME " " + QString (fullVersionString()));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 QPushButton* mailButton = new QPushButton;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204 mailButton->setText (tr ("Contact"));
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
205 mailButton->setIcon (GetIcon ("mail"));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
206 ui.buttonBox->addButton (static_cast<QAbstractButton*> (mailButton), QDialogButtonBox::HelpRole);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
207 connect (ui.buttonBox, SIGNAL (helpRequested()), this, SLOT (slot_mail()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
208
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
209 setWindowTitle (format (tr ("About %1"), APPNAME));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
210 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
212 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
213 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
214 void AboutDialog::slot_mail()
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
215 {
844
11587d419d2f - changed copyright lines to use my legal name instead of my nickname
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
216 QDesktopServices::openUrl (QUrl ("mailto:Teemu Piippo <arezey@gmail.com>?subject=LDForge"));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
217 }

mercurial