console_window.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2015, Southwest Research Institute® (SwRI®)
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE
21 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 // DAMAGE.
28 //
29 // *****************************************************************************
30 
31 #ifndef SWRI_CONSOLE_CONSOLE_WINDOW_H_
32 #define SWRI_CONSOLE_CONSOLE_WINDOW_H_
33 
34 #include <QtWidgets/QMainWindow>
35 #include <QColor>
36 #include <QPushButton>
37 #include <QSettings>
38 #include "ui_console_window.h"
39 
40 #include "node_click_handler.h"
41 
42 namespace swri_console
43 {
44 class LogDatabase;
45 class LogDatabaseProxyModel;
46 class NodeListModel;
47 class ConsoleWindow : public QMainWindow {
48  Q_OBJECT
49 
50  public:
53 
54  void closeEvent(QCloseEvent *event); // Overloaded function
55 
56  Q_SIGNALS:
57  void createNewWindow();
58  void readBagFile();
59  void readLogFile();
60  void readLogDirectory();
61  void selectFont();
62 
63  public Q_SLOTS:
64  void clearAll();
65  void clearMessages();
66  void saveLogs();
67  void connected(bool);
68  void setSeverityFilter();
69  void nodeSelectionChanged();
70  void messagesAdded();
71  void showLogContextMenu(const QPoint& point);
72  void selectAllLogs();
73  void copyLogs();
74  void copyExtendedLogs();
75  void setFollowNewest(bool);
76  void toggleAlternateRowColors(bool);
77 
78  void userScrolled(int);
79 
80  void includeFilterUpdated(const QString &);
81  void excludeFilterUpdated(const QString &);
82  void searchIndex(); // VM 4/13/2017
83  void updateIncludeLabel();
84  void updateExcludeLabel();
85 
86  void setFont(const QFont &font);
87 
88  void setDebugColor();
89  void setInfoColor();
90  void setWarnColor();
91  void setErrorColor();
92  void setFatalColor();
93  void prevIndex();
94  void nextIndex();
95 
96 private:
97  enum function{NEXT,PREV,SEARCH};
98  function searchFunction_;
99  void updateCurrentIndex(function sF);
100  void chooseButtonColor(QPushButton* widget);
101  QColor getButtonColor(const QPushButton* button) const;
102  void updateButtonColor(QPushButton* widget, const QColor& color);
103 
104  template <typename T>
105  void loadBooleanSetting(const QString& key, T* element){
106  QSettings settings;
107  bool val = settings.value(key, element->isChecked()).toBool();
108  if (val != element->isChecked()) {
109  element->setChecked(val);
110  }
111  };
112  void loadColorButtonSetting(const QString& key, QPushButton* button);
113  void loadSettings();
114 
115 
116  Ui::ConsoleWindow ui;
121 }; // class ConsoleWindow
122 } // namespace swri_console
123 
124 #endif // SWRI_CONSOLE_CONSOLE_WINDOW_H_
void showLogContextMenu(const QPoint &point)
ConsoleWindow(LogDatabase *db)
NodeListModel * node_list_model_
void closeEvent(QCloseEvent *event)
QColor getButtonColor(const QPushButton *button) const
LogDatabaseProxyModel * db_proxy_
void loadColorButtonSetting(const QString &key, QPushButton *button)
void loadBooleanSetting(const QString &key, T *element)
void updateButtonColor(QPushButton *widget, const QColor &color)
NodeClickHandler * node_click_handler_
void setFont(const QFont &font)
void excludeFilterUpdated(const QString &)
void includeFilterUpdated(const QString &)
void updateCurrentIndex(function sF)
void chooseButtonColor(QPushButton *widget)


swri_console
Author(s):
autogenerated on Wed Jun 5 2019 21:25:59