StatusbarInterface.hh 7.01 KB
 Jan Möbius committed Aug 05, 2009 1 /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 2 3 * * * OpenFlipper *  Martin Schultz committed Jul 16, 2015 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  * Copyright (c) 2001-2015, RWTH-Aachen University * * Department of Computer Graphics and Multimedia * * All rights reserved. * * www.openflipper.org * * * *---------------------------------------------------------------------------* * This file is part of OpenFlipper. * *---------------------------------------------------------------------------* * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * * * 1. Redistributions of source code must retain the above copyright notice, * * this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. Neither the name of the copyright holder nor the names of its * * contributors may be used to endorse or promote products derived from * * this software without specific prior written permission. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  Jan Möbius committed Nov 25, 2010 39 * *  Jan Möbius committed Aug 05, 2009 40 41 \*===========================================================================*/  Jan Möbius committed Jan 08, 2019 42 #pragma once  Jan Möbius committed Aug 29, 2008 43   Matthias Möller committed Aug 25, 2014 44 #include  Matthias Möller committed Jul 19, 2013 45   Jan Möbius committed Jan 08, 2019 46 #include  Jan Möbius committed Aug 29, 2008 47   Jan Möbius committed Feb 25, 2011 48 49 50 51 52 53 54 55 56  /** \file StatusbarInterface.hh * * Interface for controlling OpenFlippers statusbar .\ref statusbarInterfacePage */ /** Namespace for Application status enum * */  Jan Möbius committed Aug 29, 2008 57 58 namespace ApplicationStatus {  Jan Möbius committed Feb 25, 2011 59 60 61 62 63 64 65 66 67 68  /** \brief Enum for the statusBar Status Icon * * This enum is used to controll the small activity icon of OpenFlipper. * See \ref statusbarInterfacePage */ enum applicationStatus { READY, //!< Status is ready (green light) PROCESSING,//!< Status is processing but system will allow interaction (yellow light) BLOCKED //!< Status is processing and blocked system will not allow interaction (red light) };  Jan Möbius committed Aug 29, 2008 69 70 71 72  }  Jan Möbius committed Feb 25, 2011 73 74 75 76 77 78 79  /** \brief Control OpenFlippers status bar * * \ref statusbarInterfacePage "Detailed description" * \n * * This interface can be used to send messages to OpenFlippers statusbar. * It is also possible to add your own widget to the bar.  Jan Möbius committed Aug 29, 2008 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96  */ class StatusbarInterface { private slots : public : /// Destructor virtual ~StatusbarInterface() {}; signals : /** \brief Show a message in the status bar * * You can specify a timeout if the message should be removed after * _timeout milliseconds */  Jan Möbius committed Feb 25, 2011 97  virtual void showStatusMessage(QString _message, int _timeout = 0) {};  Jan Möbius committed Aug 29, 2008 98 99   Jan Möbius committed Feb 25, 2011 100 101 102 103  /** \brief Sets the status icon of the StatusBar * * OpenFlipper statusbar contains a small icon in the statusbar which can be used to indicate * the current status of the application. The valid values are defined in the enum ApplicationStatus::applicationStatus.  Jan Möbius committed Aug 29, 2008 104  *  Jan Möbius committed Feb 25, 2011 105  * @param _status New status  Jan Möbius committed Aug 29, 2008 106  */  Jan Möbius committed Feb 25, 2011 107  void setStatus( ApplicationStatus::applicationStatus _status) {};  Jan Möbius committed Aug 29, 2008 108 109 110 111 112 113  /** \brief Removes the current message from the statusBar * */ void clearStatusMessage() {};  Dirk Wilden committed Feb 09, 2010 114 115  /** \brief Add a widget on the right side of the statusBar *  Jan Möbius committed Feb 25, 2011 116 117 118 119  * Use this function if you want to add an additional widget to the statusbar. * It will be added on the right side. * * @param _widget The widget that should be added to the statusbar  Dirk Wilden committed Feb 09, 2010 120  */  Jan Möbius committed Feb 25, 2011 121  void addWidgetToStatusbar(QWidget* _widget) {};  Dirk Wilden committed Feb 09, 2010 122   Jan Möbius committed Aug 29, 2008 123 124 };  Jan Möbius committed Feb 25, 2011 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139  /** \page statusbarInterfacePage Statusbar Interface \image html StatusbarInterface.png \n The StatusbarInterface can be used by plugins to send messages to OpenFlippers statusbar. The statusbar is located below the GL viewer. Messages can be controlled via StatusbarInterface::setStatus(),StatusbarInterface::clearStatusMessage() Additionally it is possible to add small widgets to it ( StatusbarInterface::addWidgetToStatusbar). A small icon can be controlled to indicate OpenFlippers status via StatusbarInterface::setStatus(). To use the StatusbarInterface:
 Jan Möbius committed Mar 01, 2011 140 
• include StatusbarInterface.hh in your plugins header file  Jan Möbius committed Feb 25, 2011 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 
The following code shows a simple example to send a message to the statusbar. \code void ExamplePlugin::function() { ... // Print the text "Your Status Message" for 4 seconds in the statusBar emit showStatusMessage( tr("Your Status Message"), 4000 ); ... } \endcode The following code shows a simple example to add a widget to the statusbar. Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup your widget for the status bar. \code void ExamplePlugin::pluginsInitialized() { // Create the widget QWidget* infoBar = new QWidget(); // Setup buttons or anything else in your widget ... // Add the new widget to the statusBar emit addWidgetToStatusbar(infoBar); } \endcode */  Jan Möbius committed Aug 29, 2008 182 183 Q_DECLARE_INTERFACE(StatusbarInterface,"OpenFlipper.StatusbarInterface/1.0")