File indexing completed on 2024-04-21 15:08:24

0001 /***************************************************************************
0002                           cstatus.h - manages status bar
0003     This file is a part of KMuddy distribution.
0004                              -------------------
0005     begin                : Ne Jul 7 2002
0006     copyright            : (C) 2002 by Tomas Mecir
0007     email                : kmuddy@kmuddy.com
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either version 2 of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  ***************************************************************************/
0018 
0019 #ifndef CSTATUS_H
0020 #define CSTATUS_H
0021 
0022 #include <qobject.h>
0023 #include <qtimer.h>
0024 
0025 #include <cactionbase.h>
0026 #include <kmuddy_export.h>
0027 
0028 class QLabel;
0029 class QStatusBar;
0030 
0031 /**
0032  This class manages the status bar.
0033  @author Tomas Mecir
0034   */
0035 
0036 class KMUDDY_EXPORT cStatus : public QObject, public cActionBase {
0037    Q_OBJECT
0038 public: 
0039   cStatus (int sess, QStatusBar *statusbar);
0040   ~cStatus() override;
0041   void showTimer ();
0042   void hideTimer ();
0043   /** shows a message for 2 seconds */
0044   void showMessage (const QString & message);
0045   const QString connTimeString ();
0046   void displayVariables (const QString varText);
0047   void clearPartialLine ();
0048   QStatusBar *statusBar() { return sb; };
0049 
0050 protected:
0051   void eventNothingHandler (QString event, int session) override;
0052   void eventStringHandler (QString event, int session,
0053       QString &par1, const QString &) override;
0054   void eventIntHandler (QString event, int session, int par1, int par2) override;
0055 
0056   void dimensionsChanged (int x, int y);
0057   void timerStart ();
0058   void timerStop ();
0059   void timerReset ();
0060   void connected ();
0061   void disconnected ();
0062   void partialLine (const QString &line);
0063   void gotCommand ();
0064 
0065   QStatusBar *sb;
0066   QLabel *labelDimension, *labelTimer, *labelIdle, *labelConnected, *labelVariables, *labelPartial;
0067   QTimer *timer, *timer1;
0068   bool timing;
0069   int conntime;
0070   int idletime1;
0071   bool timerShown;
0072 protected slots:
0073   void timerTick ();
0074   void timer1Tick ();
0075 };
0076 
0077 #endif