| 1 | /* |
| 2 | * File: DeviceMenuProcessor.cpp |
| 3 | * |
| 4 | * Author: Jacob Dekel |
| 5 | * Created on: Oct, 14 2009 |
| 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 "HerculesStudio.h"cxx . . $ `<file>/HercStudio/HerculesStudio.h`/ |
| 26 | #include "DeviceMenuProcessor.h"cxx . . $ `<file>/HercConfiguration/DeviceMenuProcessor.h`/ |
| 27 | #include "GenericDeviceProperties.h"cxx . . $ `<file>/HercConfiguration/GenericDeviceProperties.h`/ |
| 28 | #include "NewReaderFile.h"cxx . . $ `<file>/HercConfiguration/NewReaderFile.h`/ |
| 29 | |
| 30 | #include <QMouseEvent> |
| 31 | |
| 32 | DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#DeviceMenuProcessor(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget# *parent) : |
| 33 | QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent), mClickRowcxx . . $ DeviceMenuProcessor#mClickRow.(-1) |
| 34 | { |
| 35 | |
| 36 | } |
| 37 | |
| 38 | DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::~cxx . . $ DeviceMenuProcessor#`~DeviceMenuProcessor`(49f6e7a06ebc5aa8).DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#() |
| 39 | { |
| 40 | |
| 41 | } |
| 42 | |
| 43 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::devicesClickcxx . . $ DeviceMenuProcessor#devicesClick(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# * event) |
| 44 | { |
| 45 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, "devicesClick(" << mClickRow << "): " << |
| 46 | (event->button() == Qt::RightButton ? "Right " : " ?" ) |
| 47 | << " at" << event->x()); |
| 48 | mLastClickcxx . . $ DeviceMenuProcessor#mLastClick. = mClickRowcxx . . $ DeviceMenuProcessor#mClickRow.; |
| 49 | |
| 50 | if ( event->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::RightButtoncxx . . $ Qt/RightButton. ) |
| 51 | { |
| 52 | mMenucxx . . $ DeviceMenuProcessor#mMenu..clearcxx . . $ QMenu#clear(49f6e7a06ebc5aa8).(); |
| 53 | |
| 54 | QMenucxx . . $ QMenu# * mMenuAdd; |
| 55 | mMenuAdd = mMenucxx . . $ DeviceMenuProcessor#mMenu..addMenucxx . . $ QMenu#addMenu(7bd5d996bbe37ddf).("Add..."cxx . . $ QString#QString(85c52e162fed56f9).); |
| 56 | mMenuAdd->clearcxx . . $ QMenu#clear(49f6e7a06ebc5aa8).(); |
| 57 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Terminal"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddTerminal())); |
| 58 | if (canAddSYSGcxx . . $ DeviceMenuProcessor#canAddSYSG(c9857a73d68e59ba).()) |
| 59 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("SYSG"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddSYSG())); |
| 60 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Console"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddConsole())); |
| 61 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Printer"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddPrinter())); |
| 62 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Card Reader"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddCardReader())); |
| 63 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Card Punch"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddCardPunch())); |
| 64 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Tape Drives"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddTape())); |
| 65 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("CTC"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddCTC())); |
| 66 | mMenuAdd->addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Dasd"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuAddDasd())); |
| 67 | |
| 68 | if (realDevicecxx . . $ DeviceMenuProcessor#realDevice(c9857a73d68e59ba).()) |
| 69 | { |
| 70 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Delete"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuDelete())); |
| 71 | if (!isConfigcxx . . $ DeviceMenuProcessor#isConfig(c9857a73d68e59ba).()) |
| 72 | { |
| 73 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Rename"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuRename())); |
| 74 | if (hasConfigcxx . . $ DeviceMenuProcessor#hasConfig(c9857a73d68e59ba).()) |
| 75 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Re-Initialize..."cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuProperties())); |
| 76 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Attention Interrupt"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuInterrupt())); |
| 77 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Subchannel Status"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuStatus())); |
| 78 | if (tracedcxx . . $ DeviceMenuProcessor#traced(c9857a73d68e59ba).()) |
| 79 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(f5cd3b2bf41abf4e).(*new QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/16x16/check.png"cxx . . $ QString#QString(85c52e162fed56f9).),"Trace CCW"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuTraceCCW())); |
| 80 | else |
| 81 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Trace CCW"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuTraceCCW())); |
| 82 | if (this->getTypecxx . . $ DeviceMenuProcessor#getType(cc50a7541878da72).(mClickRowcxx . . $ DeviceMenuProcessor#mClickRow.) == DeviceTypescxx . . $ DeviceTypes#::Tapecxx . . $ DeviceTypes#Tape.) |
| 83 | { |
| 84 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(3, "TAPE"); |
| 85 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 86 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Load Tape"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuLoad())); |
| 87 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Unload Tape"cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuUnload())); |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(3, "not tape"); |
| 92 | } |
| 93 | } |
| 94 | else |
| 95 | { |
| 96 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 97 | mMenucxx . . $ DeviceMenuProcessor#mMenu..addActioncxx . . $ QMenu#addAction(d6b084a86bd9035f).("Properties..."cxx . . $ QString#QString(85c52e162fed56f9)., this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(menuProperties())); |
| 98 | mMenucxx . . $ DeviceMenuProcessor#mMenu..movecxx . . $ QWidget#move(3e454b8ccf442868).(event->globalXcxx . . $ QMouseEvent#globalX(455f465bc33b4cdf).(), event->globalYcxx . . $ QMouseEvent#globalY(455f465bc33b4cdf).()); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | mMenucxx . . $ DeviceMenuProcessor#mMenu..movecxx . . $ QWidget#move(3e454b8ccf442868).(event->globalXcxx . . $ QMouseEvent#globalX(455f465bc33b4cdf).(), event->globalYcxx . . $ QMouseEvent#globalY(455f465bc33b4cdf).()); |
| 103 | mMenucxx . . $ DeviceMenuProcessor#mMenu..setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(true); |
| 104 | mClickRowcxx . . $ DeviceMenuProcessor#mClickRow. = -1; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddTerminalcxx . . $ DeviceMenuProcessor#menuAddTerminal(49f6e7a06ebc5aa8).() |
| 109 | { |
| 110 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::Terminalcxx . . $ DeviceTypes#Terminal.); |
| 111 | } |
| 112 | |
| 113 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddConsolecxx . . $ DeviceMenuProcessor#menuAddConsole(49f6e7a06ebc5aa8).() |
| 114 | { |
| 115 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::Consolecxx . . $ DeviceTypes#Console.); |
| 116 | } |
| 117 | |
| 118 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddPrintercxx . . $ DeviceMenuProcessor#menuAddPrinter(49f6e7a06ebc5aa8).() |
| 119 | { |
| 120 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::Printercxx . . $ DeviceTypes#Printer.); |
| 121 | } |
| 122 | |
| 123 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddCardReadercxx . . $ DeviceMenuProcessor#menuAddCardReader(49f6e7a06ebc5aa8).() |
| 124 | { |
| 125 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::CardReadercxx . . $ DeviceTypes#CardReader.); |
| 126 | } |
| 127 | |
| 128 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddCardPunchcxx . . $ DeviceMenuProcessor#menuAddCardPunch(49f6e7a06ebc5aa8).() |
| 129 | { |
| 130 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::CardPunchcxx . . $ DeviceTypes#CardPunch.); |
| 131 | } |
| 132 | |
| 133 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddTapecxx . . $ DeviceMenuProcessor#menuAddTape(49f6e7a06ebc5aa8).() |
| 134 | { |
| 135 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::Tapecxx . . $ DeviceTypes#Tape.); |
| 136 | } |
| 137 | |
| 138 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddCTCcxx . . $ DeviceMenuProcessor#menuAddCTC(49f6e7a06ebc5aa8).() |
| 139 | { |
| 140 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::CTCcxx . . $ DeviceTypes#CTC.); |
| 141 | } |
| 142 | |
| 143 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddDasdcxx . . $ DeviceMenuProcessor#menuAddDasd(49f6e7a06ebc5aa8).() |
| 144 | { |
| 145 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::DASDcxx . . $ DeviceTypes#DASD.); |
| 146 | } |
| 147 | |
| 148 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddSYSGcxx . . $ DeviceMenuProcessor#menuAddSYSG(49f6e7a06ebc5aa8).() |
| 149 | { |
| 150 | menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(DeviceTypescxx . . $ DeviceTypes#::Sysgcxx . . $ DeviceTypes#Sysg.); |
| 151 | } |
| 152 | |
| 153 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuAddItemcxx . . $ DeviceMenuProcessor#menuAddItem(d4f767463ce0a6b3).(int iType) |
| 154 | { |
| 155 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(5, "add Item" << mClickRow); |
| 156 | if (iType < 0 || iType > DeviceTypescxx . . $ DeviceTypes#::Commcxx . . $ DeviceTypes#Comm.) return; |
| 157 | DeviceTypescxx . . $ DeviceTypes#::Typecxx . . $ DeviceTypes#Type# type = static_cast<DeviceTypescxx . . $ DeviceTypes#::Typecxx . . $ DeviceTypes#Type#> (iType); |
| 158 | mCandidateLinecxx . . $ DeviceMenuProcessor#mCandidateLine. = new DeviceConfigLinecxx . . $ DeviceConfigLine#("\n"); |
| 159 | mCandidateLinecxx . . $ DeviceMenuProcessor#mCandidateLine.->setNewcxx . . $ ConfigLine#setNew(b45ddcbc8423892c).(true); |
| 160 | |
| 161 | GenericDevicePropertiescxx . . $ GenericDeviceProperties# * mProp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 162 | |
| 163 | try |
| 164 | { |
| 165 | mProp = GenericDevicePropertiescxx . . $ GenericDeviceProperties#::classFactorycxx . . $ GenericDeviceProperties#classFactory(a94d470fa14a4f70).(*mCandidateLinecxx . . $ DeviceMenuProcessor#mCandidateLine.,this,type); |
| 166 | } |
| 167 | catch (...) |
| 168 | { |
| 169 | hOutDebugcxx . . $ `HercStudio/HerculesStudio.h:49:9`!(2,"exception caught in class factory (add)"); |
| 170 | } |
| 171 | |
| 172 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(mProp, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(updateLine(bool)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(doAddDevice(bool))); |
| 173 | mProp->setVisiblecxx . . $ QDialog#setVisible(b45ddcbc8423892c).(true); |
| 174 | |
| 175 | mClickRowcxx . . $ DeviceMenuProcessor#mClickRow.=-1; |
| 176 | } |
| 177 | |
| 178 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuLoadcxx . . $ DeviceMenuProcessor#menuLoad(49f6e7a06ebc5aa8).() |
| 179 | { |
| 180 | NewReaderFilecxx . . $ NewReaderFile# * newTapeFile = new NewReaderFilecxx . . $ NewReaderFile#(this); |
| 181 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(newTapeFile, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(okPressed(QString&)), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(newTapeFileOK(QString&))); |
| 182 | newTapeFile->execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 183 | } |
| 184 | |
| 185 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::menuUnloadcxx . . $ DeviceMenuProcessor#menuUnload(49f6e7a06ebc5aa8).() |
| 186 | { |
| 187 | QStringcxx . . $ QString# scxx . . $ QString#QString(85c52e162fed56f9).("*"); |
| 188 | if (!isConfigcxx . . $ DeviceMenuProcessor#isConfig(c9857a73d68e59ba).()) doLoadTapecxx . . $ DeviceMenuProcessor#doLoadTape(4c89b026053e4d32).(s); |
| 189 | } |
| 190 | |
| 191 | |
| 192 | void DeviceMenuProcessorcxx . . $ DeviceMenuProcessor#::newTapeFileOKcxx . . $ DeviceMenuProcessor#newTapeFileOK(4c89b026053e4d32).(QStringcxx . . $ QString#& tapeFileName) |
| 193 | { |
| 194 | if (!isConfigcxx . . $ DeviceMenuProcessor#isConfig(c9857a73d68e59ba).()) doLoadTapecxx . . $ DeviceMenuProcessor#doLoadTape(4c89b026053e4d32).(tapeFileName); |
| 195 | } |
| 196 |