PageRenderTime 36ms CodeModel.GetById 8ms app.highlight 22ms RepoModel.GetById 1ms app.codeStats 1ms

/inc/mainwindow.h

https://code.google.com/p/dwarftherapist/
C++ Header | 144 lines | 92 code | 22 blank | 30 comment | 0 complexity | 5de5175b1a90694be64f3cca0dd7d411 MD5 | raw file
  1/*
  2Dwarf Therapist
  3Copyright (c) 2009 Trey Stout (chmod)
  4
  5Permission is hereby granted, free of charge, to any person obtaining a copy
  6of this software and associated documentation files (the "Software"), to deal
  7in the Software without restriction, including without limitation the rights
  8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9copies of the Software, and to permit persons to whom the Software is
 10furnished to do so, subject to the following conditions:
 11
 12The above copyright notice and this permission notice shall be included in
 13all copies or substantial portions of the Software.
 14
 15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 21THE SOFTWARE.
 22*/
 23#ifndef MAINWINDOW_H
 24#define MAINWINDOW_H
 25
 26#include <QtCore>
 27#include <QtGui>
 28#include <QtNetwork>
 29
 30class StateTableView;
 31class DFInstance;
 32class DwarfModel;
 33class DwarfModelProxy;
 34class Dwarf;
 35class AboutDialog;
 36class CustomProfession;
 37class ViewManager;
 38class Scanner;
 39class ScriptDialog;
 40
 41namespace Ui
 42{
 43    class MainWindow;
 44}
 45
 46class MainWindow : public QMainWindow
 47{
 48    Q_OBJECT
 49
 50public:
 51    MainWindow(QWidget *parent = 0);
 52    ~MainWindow();
 53
 54    QSettings *get_settings() {return m_settings;}
 55    QToolBar *get_toolbar();
 56    DwarfModel *get_model() {return m_model;}
 57    DwarfModelProxy *get_proxy() {return m_proxy;}
 58    ViewManager *get_view_manager() {return m_view_manager;}
 59    DFInstance *get_DFInstance() {return m_df;}
 60
 61    Ui::MainWindow *ui;
 62
 63    public slots:
 64        // DF related
 65        void connect_to_df();
 66        void read_dwarves();
 67        void scan_memory();
 68        void new_pending_changes(int);
 69        void lost_df_connection();
 70
 71        //settings
 72        void set_group_by(int);
 73        void export_custom_professions();
 74        void import_custom_professions();
 75        void export_gridviews();
 76        void import_gridviews();
 77        void clear_user_settings();
 78
 79        // dialogs
 80        void show_about();
 81        void list_pending();
 82        void draw_professions();
 83        void draw_custom_profession_context_menu(const QPoint &);
 84        void add_new_filter_script();
 85        void print_gridview();
 86
 87        // version check
 88        void check_latest_version(bool show_result_on_equal=false);
 89        void version_check_finished(bool error);
 90
 91        // layout check
 92        void check_for_layout(const QString & checksum);
 93        void layout_check_finished(bool error);
 94
 95        // links
 96        void go_to_forums();
 97        void go_to_donate();
 98        void go_to_project_home();
 99        void go_to_new_issue();
100
101        // progress
102        void set_progress_message(const QString &msg);
103        void set_progress_range(int min, int max);
104        void set_progress_value(int value);
105
106        // misc
107        void show_dwarf_details_dock(Dwarf *d = 0);
108        void new_filter_script_chosen(const QString &script_name);
109        void redraw_filter_scripts_cb();
110
111
112private:
113    DFInstance *m_df;
114    QLabel *m_lbl_status;
115    QProgressBar *m_progress;
116    QSettings *m_settings;
117    ViewManager *m_view_manager;
118    DwarfModel *m_model;
119    DwarfModelProxy *m_proxy;
120    AboutDialog *m_about_dialog;
121    CustomProfession *m_temp_cp;
122    Scanner *m_scanner;
123    ScriptDialog *m_script_dialog;
124    QHttp *m_http;
125    bool m_reading_settings;
126    bool m_show_result_on_equal; //! used during version checks
127    QCompleter *m_dwarf_name_completer;
128    QStringList m_dwarf_names_list;
129    bool m_force_connect;
130    bool m_try_download;
131    QString m_tmp_checksum;
132    bool m_deleting_settings;
133
134    void closeEvent(QCloseEvent *evt); // override;
135
136    void read_settings();
137    void write_settings();
138
139    private slots:
140        void set_interface_enabled(bool);
141
142};
143
144#endif // MAINWINDOW_H