| 1 | /* |
| 2 | * File: MipsGauge.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Jun 15, 2010 |
| 6 | * |
| 7 | * Copyright (c) 2009-2013 Jacob Dekel |
| 8 | * $Id$ |
| 9 | * |
| 10 | * This program is free software: you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation, either version 3 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include "MipsGauge.h"cxx . . $ `<file>/HercStudio/MipsGauge.h`/ |
| 26 | #include "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 27 | |
| 28 | #include <QPaintEvent> |
| 29 | #include <QPainter> |
| 30 | |
| 31 | MipsGaugecxx . . $ MipsGauge#::MipsGaugecxx . . $ MipsGauge#MipsGauge(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# * parent) |
| 32 | : Mipscxx . . $ Mips#(parent) |
| 33 | { |
| 34 | mHwmcxx . . $ MipsGauge#mHwm. = 0.0; |
| 35 | resizecxx . . $ QWidget#resize(3e454b8ccf442868).(120,120); |
| 36 | mPenColorcxx . . $ MipsGauge#mPenColor. =cxx . . $ QColor#`operator=`(8671044fd9e31b1b). QColorcxx . . $ QColor#::fromRgbcxx . . $ QColor#fromRgb(785b6f35cae7fe1c).(250,250,250,50); |
| 37 | } |
| 38 | |
| 39 | MipsGaugecxx . . $ MipsGauge#::~cxx . . $ MipsGauge#`~MipsGauge`(49f6e7a06ebc5aa8).MipsGaugecxx . . $ MipsGauge#() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | void MipsGaugecxx . . $ MipsGauge#::movecxx . . $ MipsGauge#move(3e454b8ccf442868).(int x, int y) |
| 44 | { |
| 45 | QWidgetcxx . . $ QWidget#::movecxx . . $ QWidget#move(3e454b8ccf442868).(x,y); |
| 46 | } |
| 47 | |
| 48 | void MipsGaugecxx . . $ MipsGauge#::displaycxx . . $ MipsGauge#display(ba8836b59fb42830).(double value) |
| 49 | { |
| 50 | mValuecxx . . $ MipsGauge#mValue. = value; |
| 51 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5,"mValue=" << mValue); |
| 52 | if (mValuecxx . . $ MipsGauge#mValue. > mHwmcxx . . $ MipsGauge#mHwm.) |
| 53 | mHwmcxx . . $ MipsGauge#mHwm. = mValuecxx . . $ MipsGauge#mValue.; |
| 54 | static QRectcxx . . $ QRect# rectcxx . . $ QRect#QRect(748afa4755bc9595).(0,0,120,120); |
| 55 | updatecxx . . $ QWidget#update(22ba0428947158b).(rect); |
| 56 | } |
| 57 | |
| 58 | void MipsGaugecxx . . $ MipsGauge#::setActivecxx . . $ MipsGauge#setActive(b45ddcbc8423892c).(bool active) |
| 59 | { |
| 60 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, "MipsGauge " << (active? "Active" : "NotActive")); |
| 61 | if (active) |
| 62 | mPenColorcxx . . $ MipsGauge#mPenColor. =cxx . . $ QColor#`operator=`(8671044fd9e31b1b). QColorcxx . . $ QColor#::fromRgbcxx . . $ QColor#fromRgb(785b6f35cae7fe1c).(250,250,250,255); |
| 63 | else |
| 64 | mPenColorcxx . . $ MipsGauge#mPenColor. =cxx . . $ QColor#`operator=`(8671044fd9e31b1b). QColorcxx . . $ QColor#::fromRgbcxx . . $ QColor#fromRgb(785b6f35cae7fe1c).(250,250,250,50); |
| 65 | this->repaintcxx . . $ QWidget#repaint(49f6e7a06ebc5aa8).(); |
| 66 | } |
| 67 | |
| 68 | void MipsGaugecxx . . $ MipsGauge#::setToolTipcxx . . $ MipsGauge#setToolTip(3520e46b33348bf6).(const QStringcxx . . $ QString# & tip) |
| 69 | { |
| 70 | QWidgetcxx . . $ QWidget#::setToolTipcxx . . $ QWidget#setToolTip(3520e46b33348bf6).(tip); |
| 71 | } |
| 72 | |
| 73 | void MipsGaugecxx . . $ MipsGauge#::paintEventcxx . . $ MipsGauge#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent# *) |
| 74 | { |
| 75 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5,"Gauge paint" << std::endl); |
| 76 | QPaintercxx . . $ QPainter# paintercxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this); |
| 77 | painter.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(mPenColorcxx . . $ MipsGauge#mPenColor.); |
| 78 | |
| 79 | painter.drawArccxx . . $ QPainter#drawArc(4df37d5d0c1dcce).(0,10,120,120,30*16,120*16); |
| 80 | painter.translatecxx . . $ QPainter#translate(bc12c9ec15586e6a).(60,70); |
| 81 | |
| 82 | painter.rotatecxx . . $ QPainter#rotate(ba8836b59fb42830).(30.0); |
| 83 | for (int angle=30; angle<=150; angle+=10) |
| 84 | { |
| 85 | painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(-65,0,-60,0); |
| 86 | painter.rotatecxx . . $ QPainter#rotate(ba8836b59fb42830).(10.0); |
| 87 | } |
| 88 | painter.rotatecxx . . $ QPainter#rotate(ba8836b59fb42830).(-160.0); |
| 89 | mPrevAnglecxx . . $ MipsGauge#mPrevAngle. = 30.0; |
| 90 | |
| 91 | double angle = 30.0 ; |
| 92 | if (mHwmcxx . . $ MipsGauge#mHwm. > 0.0) |
| 93 | angle = 30 + (mValuecxx . . $ MipsGauge#mValue./mHwmcxx . . $ MipsGauge#mHwm.*120); |
| 94 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5,"angle="<<angle << " hwm=" << mHwm << std::endl); |
| 95 | |
| 96 | painter.rotatecxx . . $ QPainter#rotate(ba8836b59fb42830).(angle); |
| 97 | painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(-50,0,-20,0); |
| 98 | } |
| 99 | |
| 100 | void MipsGaugecxx . . $ MipsGauge#::deleteLatercxx . . $ MipsGauge#deleteLater(49f6e7a06ebc5aa8).() |
| 101 | { |
| 102 | QWidgetcxx . . $ QWidget#::deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 103 | } |
| 104 | |
| 105 | bool MipsGaugecxx . . $ MipsGauge#::isVisiblecxx . . $ MipsGauge#isVisible(c9857a73d68e59ba).() |
| 106 | { |
| 107 | return QWidgetcxx . . $ QWidget#::isVisiblecxx . . $ QWidget#isVisible(50ce9a9e25b4a850).(); |
| 108 | } |