| 1 | /* |
| 2 | * File: Psw.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Aug 7, 2009 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * This object managed display of the psw |
| 11 | * |
| 12 | * This program is free software: you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation, either version 3 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef PSW_H_ |
| 28 | #define PSW_H_ |
| 29 | |
| 30 | #include <StatusUpdateCollector.h> |
| 31 | |
| 32 | #include <QWidget> |
| 33 | #include <QLabel> |
| 34 | #include <QStatusBar> |
| 35 | |
| 36 | class Psw: public StatusUpdateCollector, public QLabel |
| 37 | { |
| 38 | public: |
| 39 | enum PswMode |
| 40 | { |
| 41 | Docked = 0, |
| 42 | StatusBar |
| 43 | }; |
| 44 | Psw( QStatusBar * statusBar ); |
| 45 | virtual ~Psw(); |
| 46 | |
| 47 | virtual bool notify(const QByteArray& ); |
| 48 | void setFont(); |
| 49 | inline bool isActive() const { return mActive; } |
| 50 | void setMode(PswMode mode); |
| 51 | void standby(); |
| 52 | void setDormant(); |
| 53 | using QLabel::setVisible; |
| 54 | virtual void setVisible(bool visible, bool modern); |
| 55 | virtual bool visible(); |
| 56 | |
| 57 | private: |
| 58 | void setStatusBar(); |
| 59 | // visible - make status bar visible |
| 60 | // modern - full status (including man/wait/sys) - used in modern panel |
| 61 | void setStatusVisible(bool visible, bool modern); |
| 62 | |
| 63 | QString mLine; |
| 64 | bool mHasStatusBar; |
| 65 | bool mVisible; |
| 66 | bool mActive; |
| 67 | QStatusBar * mStatusBar; |
| 68 | Psw::PswMode mMode; |
| 69 | QLabel * mCpu; |
| 70 | QLabel * mInstCount; |
| 71 | QLabel * mSys; |
| 72 | QLabel * mWait; |
| 73 | QLabel * mMan; |
| 74 | QFont * mFontCourier; |
| 75 | }; |
| 76 | |
| 77 | #endif /* PSW_H_ */ |