diff options
Diffstat (limited to 'src/gui/mainWindow.cpp')
-rw-r--r-- | src/gui/mainWindow.cpp | 119 |
1 files changed, 70 insertions, 49 deletions
diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index b6878e8..1376851 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -99,7 +99,7 @@ MainWindow::MainWindow(QWidget *parent) : #ifdef MAINWINDOW_USE_TOUCHGUI //only used for the touchgui // define the slots we want to use - connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(combobox1(int))); // Combobox 1 verknüpfen mit IndexChangend Signal + connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(combobox1(int))); // Combobox 1 verkn��pfen mit IndexChangend Signal connect(ui->comboBox_touch1, SIGNAL(currentIndexChanged(int)), this, SLOT(setindexback())); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(createProfile())); // profile button @@ -715,61 +715,82 @@ void MainWindow::closeUp() { std::list<QString>* selectedClients = MainWindow::getConnectionList()->getSelectedClients(); - if (!is_closeup) + + if(selectedClients->size() != 1) + // Cannot closeUp zero or more than one frames. + return; + + PVSClient* pvsClient = PVSConnectionManager::getManager()->getClientFromIp(selectedClients->front()); + + closeUp(pvsClient->getConnectionFrame(), pvsClient); +} + +void MainWindow::closeUp(ConnectionFrame* connFrame, PVSClient* pvsClient) +{ + std::list<QString>* selectedClients = + MainWindow::getConnectionList()->getSelectedClients(); + + if(selectedClients->size() != 1) + // Cannot closeUp zero or more than one frames. + return; + + if(!pvsClient) + pvsClient = connFrame->getConnection(); + + // Do we already have a closeUp Frame? + ConnectionFrame* closeupFrame = conWin->getCloseupFrame(); + + if(closeupFrame) { - if (selectedClients->size() == 1) - { - PVSClient * pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str()); - _framePosOnCloseUp = pvsClient->getConnectionFrame()->pos();//get the actualy position before run closeup - if (pvsClient->getVNCConnection()) - { - conWin->setCloseupFrame(pvsClient->getConnectionFrame()); - _updatefreq - = pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->getUpdatefreq(); - pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq( - 50); - pvsClient->getConnectionFrame()->move(5, 5); - pvsClient->getConnectionFrame()->setWindowFlags( - Qt::WindowStaysOnTopHint); - pvsClient->getConnectionFrame()->raise(); - pvsClient->getConnectionFrame()->paintCloseUp( - ui->widget->width(), ui->widget->height()); - - is_closeup = true; - conWin->setCloseupFrame(pvsClient->getConnectionFrame()); - } - } + // Is it the same as the sender one? + if(connFrame == closeupFrame) + // Then it already is close up. + return; else - { - QString - message = - QString( - tr( - "This operation can only be performed for one selected Client!")); - QMessageBox::information(this, "PVS", message); - } + // We need to un-closeUp the currently selected closeUp-Frame. + unCloseUp(closeupFrame); } - else if (conWin->getCloseupFrame()) + + _framePosOnCloseUp = connFrame->pos();//get the actualy position before run closeup + if (pvsClient->getVNCConnection()) { - /*PVSClient* pvsClient = - PVSConnectionManager::getManager()->getClientFromIp( - selectedClients->front().toStdString().c_str());*/ - conWin->getCloseupFrame()->setWindowFlags(Qt::Widget); - conWin->getCloseupFrame()->paintCloseUp( - conWin->getCloseupFrame()->getPrevWidth(), - conWin->getCloseupFrame()->getPrevHeight()); - conWin->getCloseupFrame()->move(_framePosOnCloseUp);//back to the position before the closeup - if (conWin->getCloseupFrame()->getConnection()->getVNCConnection()) - conWin->getCloseupFrame()->getFrame()->getVNCClientThread()->setUpdatefreq( - _updatefreq); - - is_closeup = false; - conWin->setCloseupFrame(NULL); + conWin->setCloseupFrame(connFrame); + _updatefreq = connFrame->getFrame()->getVNCClientThread()->getUpdatefreq(); + connFrame->getFrame()->getVNCClientThread()->setUpdatefreq( + 50); + connFrame->move(5, 5); + connFrame->setWindowFlags(Qt::WindowStaysOnTopHint); + connFrame->raise(); + connFrame->paintCloseUp(ui->widget->width(), ui->widget->height()); + + conWin->setCloseupFrame(connFrame); + + Frame* frame = connFrame->getFrame(); + if(frame) + frame->setCloseUp(true); } } +void MainWindow::unCloseUp(ConnectionFrame* connFrame) +{ + if(!connFrame) + return; + + connFrame->setWindowFlags(Qt::Widget); + connFrame->paintCloseUp( + connFrame->getPrevWidth(), + connFrame->getPrevHeight()); + connFrame->move(_framePosOnCloseUp);//back to the position before the closeup + if (connFrame->getConnection()->getVNCConnection()) + connFrame->getFrame()->getVNCClientThread()->setUpdatefreq(_updatefreq); + + Frame* frame = connFrame->getFrame(); + if(frame) + frame->setCloseUp(false); + + conWin->setCloseupFrame(NULL); +} + /* Perform some action if actionShowProcesses button was pressed * */ |