diff options
author | Johann Latocha | 2010-12-01 00:07:38 +0100 |
---|---|---|
committer | Johann Latocha | 2010-12-01 00:07:38 +0100 |
commit | 46e6de96f5ad44432a3f9465d28286b68b8acce3 (patch) | |
tree | 147bcee389a30ce5fcb87db38d8c438e77fc267d | |
parent | [PVSMGR] Selected clients become highlighted (diff) | |
download | pvs-46e6de96f5ad44432a3f9465d28286b68b8acce3.tar.gz pvs-46e6de96f5ad44432a3f9465d28286b68b8acce3.tar.xz pvs-46e6de96f5ad44432a3f9465d28286b68b8acce3.zip |
[PVSMGR] Bugfixing (zoom, background-image)
-rw-r--r-- | src/gui/connectionFrame.cpp | 3 | ||||
-rw-r--r-- | src/gui/connectionFrame.h | 4 | ||||
-rw-r--r-- | src/gui/mainWindow.cpp | 174 |
3 files changed, 38 insertions, 143 deletions
diff --git a/src/gui/connectionFrame.cpp b/src/gui/connectionFrame.cpp index bedd29b..b618668 100644 --- a/src/gui/connectionFrame.cpp +++ b/src/gui/connectionFrame.cpp @@ -52,13 +52,11 @@ ConnectionFrame::ConnectionFrame(QWidget *parent) : _hLayoutInCfTaskbar = new QHBoxLayout(); _ip = new QLabel(_conFrameTaskbar); - _ip->setStyleSheet(QString::fromUtf8("background-color: rgb(150, 150, 168);")); _ip->setAlignment(Qt::AlignCenter); _hLayoutInCfTaskbar->addWidget(_ip); _dozentContaimner = new QLabel(_conFrameTaskbar); - _dozentContaimner->setStyleSheet(QString::fromUtf8("background-color: rgb(150, 150, 168);")); _dozentContaimner->setAlignment(Qt::AlignRight); _dozentContaimner->setMaximumSize(QSize(20, 20)); _dozentContaimner->setScaledContents(true); @@ -68,7 +66,6 @@ ConnectionFrame::ConnectionFrame(QWidget *parent) : _dozentContaimner->setDisabled(true); _status = new QLabel(_conFrameTaskbar); - _status->setStyleSheet(QString::fromUtf8("background-color: rgb(150, 150, 168);")); _status->setAlignment(Qt::AlignRight); _status->setMaximumSize(QSize(22, 21)); diff --git a/src/gui/connectionFrame.h b/src/gui/connectionFrame.h index 9e8bd7e..235d0fc 100644 --- a/src/gui/connectionFrame.h +++ b/src/gui/connectionFrame.h @@ -16,8 +16,8 @@ extern "C" } #define PROFILE -#define STYLE_DEFAULT "QGroupBox{margin: 2px; border: 1px solid black; border-radius: 8px; padding: 2px; padding-top: 1.5em;}" -#define STYLE_SELECTED "QGroupBox{margin: 2px; border: 1px solid red; border-radius: 8px; padding: 2px; padding-top: 1.5em;}" +#define STYLE_DEFAULT "QGroupBox{background-color: rgb(150, 150, 150); margin: 2px; border: 1px solid black; border-radius: 8px; padding: 2px; padding-top: 1.5em;}" +#define STYLE_SELECTED "QGroupBox{background-color: rgb(150, 150, 150); margin: 2px; border: 1px solid red; border-radius: 8px; padding: 2px; padding-top: 1.5em;}" #include <src/util/timeUtil.h> diff --git a/src/gui/mainWindow.cpp b/src/gui/mainWindow.cpp index e07e283..6bb84a4 100644 --- a/src/gui/mainWindow.cpp +++ b/src/gui/mainWindow.cpp @@ -986,109 +986,41 @@ void MainWindow::incomingFile() void MainWindow::changeRatio(int ratio) // needed the change the size of the vnc-screens { - if (!_isThumbnailrate) { +#ifdef MAINWINDOW_USE_NORMALGUI QString str; str.append(QString("%1").arg(ratio)); -#ifdef MAINWINDOW_USE_NORMALGUI ui->label_2->setText(str); #endif - - 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()); - ConnectionFrame *frame = pvsClient->getConnectionFrame(); - int w = (frame->init_w * ratio) / 100; - int h = (frame->init_h * ratio) / 100; - frame->setPrevWidth(w); - frame->setPrevHeight(h); - frame->paintCloseUp(w, h); - frame->setRatio(ratio); - } - } - else - { - QList<ConnectionFrame *> frameList = - MainWindow::getConnectionWindow()->getFrameList(); - ConnectionFrame *frame; -foreach (frame, frameList) - { - int w = (frame->init_w * ratio) / 100; - int h = (frame->init_h * ratio) / 100; - frame->setPrevWidth(w); - frame->setPrevHeight(h); - frame->paintCloseUp(w, h); - } - } -} -else -{ - int updatefreq = (ratio*500)/100; - QString str; - str.append(QString("%1").arg(updatefreq)); -#ifdef MAINWINDOW_USE_NORMALGUI - ui->label_2->setText(str); -#endif - 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); - } - } - -} + QList<ConnectionFrame*> clients = MainWindow::getConnectionWindow()->getAllFrameOnWindow(); + foreach (ConnectionFrame *client, clients) + { + int w = (client->init_w * ratio) / 100; + int h = (client->init_h * ratio) / 100; + client->setPrevWidth(w); + client->setPrevHeight(h); + client->paintCloseUp(w, h); + client->setRatio(ratio); + } + } + else + changeRefresh(ratio); } void MainWindow::changeRefresh(int refresh) { int updatefreq = (refresh*500)/100; +#ifdef MAINWINDOW_USE_NORMALGUI QString str; str.append(QString("%1").arg(updatefreq)); - std::list<QString>* selClients = getConnectionList()->getSelectedClients(); - if (selClients->size() > 0) + ui->label_2->setText(str); +#endif + std::list<PVSClient*> clients = PVSConnectionManager::getManager()->getConnections(); + foreach (PVSClient* client, clients) { - 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); - } + if (client->getVNCConnection()) + client->getConnectionFrame()->getFrame()->getVNCClientThread()->setUpdatefreq(updatefreq); } } @@ -1163,32 +1095,14 @@ void MainWindow::changeStatus(int index) */ void MainWindow::setVNCQuality(int quality) { - 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()); - pvsClient->getConnectionFrame()->resetConnectionWithQuality(quality); - pvsClient->getConnectionFrame()->update(); - } - } - else - { - QList<ConnectionFrame*> FrameList = - MainWindow::getConnectionWindow()->getFrameList(); -foreach (ConnectionFrame* frame, FrameList) + QList<ConnectionFrame*> FrameList = MainWindow::getConnectionWindow()->getFrameList(); + foreach (ConnectionFrame* frame, FrameList) { frame->resetConnectionWithQuality(quality); frame->update(); } } -} - void MainWindow::setPasswordForConnection(bool enabled) { if (enabled) @@ -1339,42 +1253,26 @@ void MainWindow::unprojecttoolbar() // unproject all in toolbar void MainWindow::backgroundpicture() { - - fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), "/home", + fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), QDir::homePath(), tr("Image Files (*.png *.jpg *.svg)")); // user chooses a file - - QImage img("" + fileName + ""); // set image - QString test("/tmp/test.png"); // set path for saving the scaled picture - QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, - Qt::FastTransformation); // scale it - - img2.save("" + test + ""); // save it - - ui->widget->setStyleSheet( - "background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); //set the picture as background - foreach (ConnectionFrame* cf, MainWindow::getConnectionWindow()->getAllFrameOnWindow()) - { - cf->setStyleSheet(QString::fromUtf8("background-color: rgb(150, 150, 168);")); - } - + QImage img(fileName); // set image + QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); // scale it + QString tmp("/tmp/tmp.png"); // set path for saving the scaled picture + img2.save(tmp); // save it + ui->widget->setStyleSheet("QWidget#widget {background-image: url(/tmp/tmp.png);" + "background-repeat:no-repeat; background-position:center;}"); //set the picture as background bgimage = true; // for the resize event, set background true - - } void MainWindow::repaintbackgroundpicture() // same as backgroundpicture but called when mainwindow is resized { - QImage img("/tmp/test.png"); - QString test("/tmp/test.png"); - QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, - Qt::FastTransformation); - - img2.save("" + test + ""); - - ui->widget->setStyleSheet( - "background-image: url(/tmp/test.png);background-repeat:no-repeat; background-position:center;"); - + QImage img("/tmp/tmp.png"); + QString tmp("/tmp/tmp.png"); + QImage img2 = img.scaled(ui->widget->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + img2.save(tmp); + ui->widget->setStyleSheet("QWidget#widget {background-image: url(/tmp/tmp.png);" + "background-repeat:no-repeat; background-position:center;}"); //set the picture as background } void MainWindow::setdozenttoolbar() // set the dozents pc which is not locked with lockedall |