Receptacle
 All Classes Files Functions Variables Pages
select_launcher.h
1 /*
2 
3 Copyright 2014 William Wedler
4 
5 This file is part of Receptacle
6 
7 Receptacle is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser 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 Receptacle 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 Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with Receptacle. If not, see <http://www.gnu.org/licenses/>.
19 
20 */
21 
22 #ifndef SELECT_LAUNCHER_H
23 #define SELECT_LAUNCHER_H
24 
25 #include <QtWidgets/QMainWindow>
26 #include <QWidget>
27 #include <QAction>
28 #include <QMenu>
29 #include <QMenuBar>
30 #include <QTabWidget>
31 #include <QVBoxLayout>
32 #include <QFileDialog>
33 #include <QDir>
34 #include <QHash>
35 #include <QSystemTrayIcon>
36 #include "util_collection.h"
37 #include "job_selection_form.h"
38 #include "log_text.h"
39 #include "log_emitter.h"
40 #include "signal_counter.h"
41 #include "widgets/about_dialog.h"
42 
43 class SelectLauncher : public QMainWindow{
44  Q_OBJECT
45 
46 public:
48  bool populate_command_options(UtilCollection* utils);
49  bool connect_logger(LogEmitter* log_emitter);
50  bool connect_errwarn_flag(SignalCounter* err_flag, SignalCounter* fatal_flag, SignalCounter* warn_flag);
51 
52  static const char WARN_NOTIFY_STYLE[];
53  static const char ERR_NOTIFY_STYLE[];
54  static const char SUCCESS_NOTIFY_STYLE[];
55 
65  bool attach_widget(QWidget* w, const QString &type);
66 
67  void select_job(QString command);
68  bool load_job_widget(QWidget* job_ui_widget);
69  bool set_is_running_bg(bool is_running);
70  bool get_is_pending_close();
71 
72 
73  void setVisible(bool visible);
74 
75 signals:
80  void close_requested();
81 
82  void selected(QString cmd);
83 
84 public slots:
85 
93  void show_msg_level(QtMsgType type, bool is_notification);
94 
102  void show_me();
103 
104  // void show_warning(QString str);
105  // void show_err(QString str);
106 
107 protected slots:
108  void command_selected(QString cmd);
109  void command_rejected(QString cmd);
110  void command_pending();
111  void save_log_text();
112  void save_err_warn_text();
113 
114  void indicate_error();
115  void indicate_warning();
116 
117  void about();
118 
119 protected:
120 
121  //menubar
122  QMenuBar* menubar;
123  //menufile
124  QMenu* menu_file;
125  //menuhelp
126  QMenu* menu_help;
127 
128  //menu actions
129 
130  //status bar
131  QStatusBar* statusbar;
132 
133  //central widget and layout
134  QWidget* central_widget;
135  QVBoxLayout* central_layout;
136 
137  //job selection form
138  JobSelectionForm* select_form;
139 
140  // Plugin UI widget
141  QWidget* plugin_widget;
142 
143  //tabs
144  QTabWidget* tabs_widget;
145 
146  //log text page
147  LogText* msg_log;
148 
149  //err/warn text page
150  LogText* err_log;
151 
152  LogEmitter* logger;
153 
154 
155 
156  QStringList pluginFileNames;
157  QDir pluginsDir;
158 
160  QAction* exitAct;
161  QAction* saveLogText;
162  QAction* saveErrWarnText;
163  QAction* aboutAct;
164  QAction* aboutQtAct;
165  QAction* aboutPluginsAct;
166 
167 
172 
177 
178  SignalCounter* err_flag;
179  SignalCounter* warn_flag;
180  SignalCounter* fatal_flag;
181 
182 
183 protected:
184  void create_menus();
185  void create_actions();
186  void closeEvent(QCloseEvent *event);
187 
188 };
189 
190 #endif // SELECT_LAUNCHER_H
The SignalCounter class is a simplified version of QSignalSpy.
Definition: signal_counter.h:33
Definition: log_emitter.h:41
Definition: util_collection.h:34
bool is_pending_close
pending_close indicates a close event has been sent but not yet accepted
Definition: select_launcher.h:176
QAction * exitAct
Menu Actions.
Definition: select_launcher.h:160
Definition: log_text.h:42
bool attach_widget(QWidget *w, const QString &type)
attach_widget adds the given widget to the host GUI
Definition: select_launcher.cpp:287
bool is_running_bg
is_running_bg True when a background worker is running
Definition: select_launcher.h:171
void show_msg_level(QtMsgType type, bool is_notification)
Visual indication that the message type has been published.
Definition: select_launcher.cpp:90
void close_requested()
close_requested broadcasts when a close event is requested but ignored because a bg worker is still r...
Definition: job_selection_form.h:38
void show_me()
show_me is a wrapper around showNormal that also raises the window into the forground.
Definition: select_launcher.cpp:79
Definition: select_launcher.h:43