Thu, 23 Feb 2017 21:02:14 +0200
Moved all UI files from ui/ into src/dialogs/.
957
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1072 | 3 | * Copyright (C) 2013 - 2017 Teemu Piippo |
957
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include "openprogressdialog.h" |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
957
diff
changeset
|
20 | #include "ui_openprogressdialog.h" |
957
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "../main.h" |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | OpenProgressDialog::OpenProgressDialog (QWidget* parent, Qt::WindowFlags f) : |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | QDialog (parent, f), |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | ui (*new Ui_OpenProgressUI), |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | m_progress (0), |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | m_numLines (0) |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | { |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | ui.setupUi (this); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | ui.progressText->setText ("Parsing..."); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | } |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | OpenProgressDialog::~OpenProgressDialog() |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | { |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | delete &ui; |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | } |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | void OpenProgressDialog::setNumLines (int a) |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | { |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | m_numLines = a; |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | ui.progressBar->setRange (0, numLines()); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | updateValues(); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | } |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | void OpenProgressDialog::updateValues() |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | { |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | ui.progressText->setText (format ("Parsing... %1 / %2", progress(), numLines())); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | ui.progressBar->setValue (progress()); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | } |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | void OpenProgressDialog::setProgress (int progress) |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | { |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | m_progress = progress; |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | updateValues(); |
429c7ed3cc54
Refactor OpenProgressDialog out of dialogs.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | } |