diff options
-rw-r--r-- | src/gui/mainWindow.cpp | 111 | ||||
-rw-r--r-- | src/gui/mainWindow.h | 1 |
2 files changed, 106 insertions, 6 deletions
diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index 1e60ab9..7c8a686 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -107,7 +107,34 @@ MainWindow::MainWindow(QWidget *parent) : #endif #ifdef MAINWINDOW_USE_TOUCHGUI //only used for the touchgui + // group actions (zoom, refresh and quality) so we get radio-buttons + QActionGroup *zoomActionGroup = new QActionGroup(this); + zoomActionGroup->addAction(ui->action_zoom_25); + zoomActionGroup->addAction(ui->action_zoom_50); + zoomActionGroup->addAction(ui->action_zoom_75); + zoomActionGroup->addAction(ui->action_zoom_100); + zoomActionGroup->addAction(ui->action_zoom_125); + zoomActionGroup->addAction(ui->action_zoom_150); + zoomActionGroup->addAction(ui->action_zoom_175); + zoomActionGroup->addAction(ui->action_zoom_200); + QActionGroup *refreshActionGroup = new QActionGroup(this); + refreshActionGroup->addAction(ui->action_refresh_100); + refreshActionGroup->addAction(ui->action_refresh_200); + refreshActionGroup->addAction(ui->action_refresh_300); + refreshActionGroup->addAction(ui->action_refresh_400); + refreshActionGroup->addAction(ui->action_refresh_500); + refreshActionGroup->addAction(ui->action_refresh_600); + refreshActionGroup->addAction(ui->action_refresh_700); + refreshActionGroup->addAction(ui->action_refresh_800); + refreshActionGroup->addAction(ui->action_refresh_900); + refreshActionGroup->addAction(ui->action_refresh_1000); + QActionGroup *qualityActionGroup = new QActionGroup(this); + qualityActionGroup->addAction(ui->action_quality_High); + qualityActionGroup->addAction(ui->action_quality_Medium); + qualityActionGroup->addAction(ui->action_quality_Low); + // define the slots we want to use + connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->action_Manage_Profiles, SIGNAL(triggered()), this, SLOT(createProfile())); connect(ui->action_Reset, SIGNAL(triggered()), this, SLOT(resetall())); connect(ui->action_Lock, SIGNAL(triggered()), this, SLOT(locksingle())); @@ -126,12 +153,55 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->action_Save_Profile, SIGNAL(triggered()), _profileDialog, SLOT(save())); connect(ui->action_Backgroundimage, SIGNAL(triggered()), this, SLOT(backgroundpicture())); - // TODO: change to actions!!! -// connect(ui->horizontalSlider, SIGNAL(valueChanged (int)), this, SLOT(changeRatio(int))); -// connect(ui->vncQuality, SIGNAL(currentIndexChanged (int)), this, SLOT(setVNCQuality(int))); -// connect(ui->thumbStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(changeStatus(int))); - - + // using QSignalMapper to get advanced signals&slots (Zoom, Refresh and Quality) + QSignalMapper *zoomSignalMapper = new QSignalMapper(this); + zoomSignalMapper->setMapping(ui->action_zoom_25, 25); + zoomSignalMapper->setMapping(ui->action_zoom_50, 50); + zoomSignalMapper->setMapping(ui->action_zoom_75, 75); + zoomSignalMapper->setMapping(ui->action_zoom_100, 100); + zoomSignalMapper->setMapping(ui->action_zoom_125, 125); + zoomSignalMapper->setMapping(ui->action_zoom_150, 150); + zoomSignalMapper->setMapping(ui->action_zoom_175, 175); + zoomSignalMapper->setMapping(ui->action_zoom_200, 200); + connect(ui->action_zoom_25, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_50, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_75, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_100, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_125, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_150, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_175, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(ui->action_zoom_200, SIGNAL(triggered()), zoomSignalMapper, SLOT (map())); + connect(zoomSignalMapper, SIGNAL(mapped(int)), this, SLOT(changeRatio(int))); + QSignalMapper *refreshSignalMapper = new QSignalMapper(this); + refreshSignalMapper->setMapping(ui->action_refresh_100, 100); + refreshSignalMapper->setMapping(ui->action_refresh_200, 200); + refreshSignalMapper->setMapping(ui->action_refresh_300, 300); + refreshSignalMapper->setMapping(ui->action_refresh_400, 400); + refreshSignalMapper->setMapping(ui->action_refresh_500, 500); + refreshSignalMapper->setMapping(ui->action_refresh_600, 600); + refreshSignalMapper->setMapping(ui->action_refresh_700, 700); + refreshSignalMapper->setMapping(ui->action_refresh_800, 800); + refreshSignalMapper->setMapping(ui->action_refresh_900, 900); + refreshSignalMapper->setMapping(ui->action_refresh_1000, 1000); + connect(ui->action_refresh_100, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_200, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_300, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_400, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_500, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_600, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_700, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_800, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_900, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(ui->action_refresh_1000, SIGNAL(triggered()), refreshSignalMapper, SLOT (map())); + connect(refreshSignalMapper, SIGNAL(mapped(int)), this, SLOT(changeRefresh(int))); + QSignalMapper *qualitySignalMapper = new QSignalMapper(this); + qualitySignalMapper->setMapping(ui->action_quality_High, 0); + qualitySignalMapper->setMapping(ui->action_quality_Medium, 1); + qualitySignalMapper->setMapping(ui->action_quality_Low, 2); + connect(ui->action_quality_High, SIGNAL(triggered()), qualitySignalMapper, SLOT (map())); + connect(ui->action_quality_Medium, SIGNAL(triggered()), qualitySignalMapper, SLOT (map())); + connect(ui->action_quality_Low, SIGNAL(triggered()), qualitySignalMapper, SLOT (map())); + connect(qualitySignalMapper, SIGNAL(mapped(int)), this, SLOT(setVNCQuality(int))); #else // toolbar and actions in pvsmgr @@ -991,6 +1061,35 @@ else } } +void MainWindow::changeRefresh(int refresh) +{ + int updatefreq = (refresh*500)/100; + QString str; + str.append(QString("%1").arg(updatefreq)); + std::list<QString>* selClients = getConnectionList()->getSelectedClients(); + if (selClients->size() > 0) + { + for (std::list<QString>::iterator client = selClients->begin(); client + != selClients->end(); client++) + { + PVSClient* pvsClient = + PVSConnectionManager::getManager()->getClientFromIp( + (*client).toUtf8().data()); + if (pvsClient->getVNCConnection()) + pvsClient->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); + } + } + else + { + std::list<PVSClient*> clients = PVSConnectionManager::getManager()->getConnections(); + foreach (PVSClient* client, clients) + { + if (client->getVNCConnection()) + client->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); + } + } +} + /* * We can change the status for the action that we want to assign to the thumbnails. * The actions are to be perform over the horizontalslider from QSlider only on the not dummies clients. diff --git a/src/gui/mainWindow.h b/src/gui/mainWindow.h index 46b3b9a..2776bf8 100644 --- a/src/gui/mainWindow.h +++ b/src/gui/mainWindow.h @@ -201,6 +201,7 @@ private slots: void showip(); void incomingFile(); void changeRatio(int ratio); + void changeRefresh(int refresh); void changeStatus (int index); void setVNCQuality(int quality); void setPasswordForConnection(int enabled); |