ZIMA CAD Parts
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
mainwindow.h
Go to the documentation of this file.
1 /*
2  ZIMA-CAD-Parts
3  http://www.zima-construction.cz/software/ZIMA-Parts
4 
5  Copyright (C) 2011-2012 Jakub Skokan <aither@havefun.cz>
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef MAINWINDOW_H
22 #define MAINWINDOW_H
23 
24 #include <QMainWindow>
25 #include <QModelIndex>
26 #include <QLabel>
27 #include <QUrl>
28 #include <QThread>
29 #include <QTranslator>
30 #include <QButtonGroup>
31 #include <QLineEdit>
32 #include <QToolBar>
33 #include <QToolButton>
34 #include <QHBoxLayout>
35 #include <QSignalMapper>
36 
37 #include "settingsdialog.h"
38 #include "filemodel.h"
39 #include "zima-cad-parts.h"
40 #include "filefiltermodel.h"
41 
42 class WorkingDirWidget;
43 
44 namespace Ui
45 {
46 class MainWindowClass;
47 }
48 
49 class MainWindow : public QMainWindow
50 {
51  Q_OBJECT
52 
53 public:
54  MainWindow(QTranslator *translator, QWidget *parent = 0);
55  ~MainWindow();
56 
57 private:
58  Ui::MainWindowClass *ui;
59 
60  QLabel *statusDir; // status bar
61  QTranslator *translator;// app ui
62  WorkingDirWidget *m_wdirWidget;
63 
64  // History
65  QList<QModelIndex> history;
66  int historyCurrentIndex;
67  int historySize;
68 
69  QModelIndex lastFoundIndex;
70 
71  void setupDeveloperMode(); // WTF?
72 
73  void changeEvent(QEvent *event);
74  void closeEvent(QCloseEvent*);
75 
76 public slots:
78  void searchClicked();
79  void updateStatus(const QString &message);
80  void errorOccured(const QString &error);
81  void filesDownloaded();
82 
83 private slots:
84  void settingsChanged();
85  void autoDescentProgress(const QModelIndex &index);
86  void autoDescendComplete(const QModelIndex &index);
87  void autoDescentNotFound();
88  void trackHistory(const QModelIndex &index);
89  void historyBack();
90  void historyForward();
91 };
92 
93 class SleeperThread : public QThread
94 {
95 public:
96  static void msleep(unsigned long msecs)
97  {
98  QThread::msleep(msecs);
99  }
100 };
101 
102 #endif // MAINWINDOW_H
MainWindow(QTranslator *translator, QWidget *parent=0)
Definition: mainwindow.cpp:48
void showSettings(SettingsDialog::Section section=SettingsDialog::General)
Definition: mainwindow.cpp:176
Section
Definition: settingsdialog.h:47
~MainWindow()
Definition: mainwindow.cpp:151
static void msleep(unsigned long msecs)
Definition: mainwindow.h:96
The web-browser-like line edit widget to display up-to-date working dir.
Definition: workingdirwidget.h:16
void searchClicked()
Definition: mainwindow.cpp:220
Definition: mainwindow.h:93
Definition: settingsdialog.h:48
void filesDownloaded()
Definition: mainwindow.cpp:236
void errorOccured(const QString &error)
Definition: mainwindow.cpp:230
Definition: mainwindow.h:49
void updateStatus(const QString &message)
Definition: mainwindow.cpp:225