console_window.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2015, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL Southwest Research Institute® BE LIABLE 
00021 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00022 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00023 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00024 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00025 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00026 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00027 // DAMAGE.
00028 //
00029 // *****************************************************************************
00030 
00031 #ifndef SWRI_CONSOLE_CONSOLE_WINDOW_H_
00032 #define SWRI_CONSOLE_CONSOLE_WINDOW_H_
00033 
00034 #include <QtWidgets/QMainWindow>
00035 #include <QColor>
00036 #include <QPushButton>
00037 #include <QSettings>
00038 #include "ui_console_window.h"
00039 
00040 namespace swri_console
00041 {
00042 class LogDatabase;
00043 class LogDatabaseProxyModel;
00044 class NodeListModel;
00045 class ConsoleWindow : public QMainWindow {
00046   Q_OBJECT
00047   
00048  public:
00049   ConsoleWindow(LogDatabase *db);
00050   ~ConsoleWindow();
00051   
00052   void closeEvent(QCloseEvent *event);  // Overloaded function
00053 
00054  Q_SIGNALS:
00055   void createNewWindow();
00056   void readBagFile();
00057   void selectFont();
00058                                        
00059  public Q_SLOTS:
00060   void clearAll();
00061   void clearMessages();
00062   void saveLogs();
00063   void connected(bool);
00064   void setSeverityFilter();
00065   void nodeSelectionChanged();
00066   void messagesAdded();
00067   void showLogContextMenu(const QPoint& point);
00068   void selectAllLogs();
00069   void copyLogs();
00070   void copyExtendedLogs();
00071   void setFollowNewest(bool);
00072   void toggleAlternateRowColors(bool);
00073   
00074   void userScrolled(int);
00075 
00076   void includeFilterUpdated(const QString &);
00077   void excludeFilterUpdated(const QString &);
00078   void searchIndex();  // VM 4/13/2017
00079   void updateIncludeLabel();
00080   void updateExcludeLabel();
00081 
00082   void setFont(const QFont &font);
00083 
00084   void setDebugColor();
00085   void setInfoColor();
00086   void setWarnColor();
00087   void setErrorColor();
00088   void setFatalColor();
00089   void prevIndex();
00090   void nextIndex();
00091 
00092 private:
00093   enum function{NEXT,PREV,SEARCH};
00094   function searchFunction_;
00095   void updateCurrentIndex(function sF);
00096   void chooseButtonColor(QPushButton* widget);
00097   QColor getButtonColor(const QPushButton* button) const;
00098   void updateButtonColor(QPushButton* widget, const QColor& color);
00099 
00100   template <typename T>
00101   void loadBooleanSetting(const QString& key, T* element){
00102     QSettings settings;
00103     bool val = settings.value(key, element->isChecked()).toBool();
00104     if (val != element->isChecked()) {
00105       element->setChecked(val);
00106     }
00107   };
00108   void loadColorButtonSetting(const QString& key, QPushButton* button);
00109   void loadSettings();
00110 
00111 
00112   Ui::ConsoleWindow ui;
00113   LogDatabase *db_;
00114   LogDatabaseProxyModel *db_proxy_;
00115   NodeListModel *node_list_model_;
00116 };  // class ConsoleWindow
00117 }  // namespace swri_console
00118 
00119 #endif  // SWRI_CONSOLE_CONSOLE_WINDOW_H_


swri_console
Author(s): Elliot Johnson
autogenerated on Tue Sep 12 2017 03:09:35