summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/server_normal/mainwindow.ui16
-rw-r--r--src/server/mainwindow/mainwindow.cpp79
-rw-r--r--src/server/mainwindow/mainwindow.h2
3 files changed, 18 insertions, 79 deletions
diff --git a/gui/server_normal/mainwindow.ui b/gui/server_normal/mainwindow.ui
index 135544d..9bf32aa 100644
--- a/gui/server_normal/mainwindow.ui
+++ b/gui/server_normal/mainwindow.ui
@@ -53,12 +53,6 @@
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
- <property name="maximumSize">
- <size>
- <width>129000</width>
- <height>12900</height>
- </size>
- </property>
<property name="windowTitle">
<string>toolBar</string>
</property>
@@ -71,11 +65,11 @@
<property name="movable">
<bool>false</bool>
</property>
- <property name="toolButtonStyle">
- <enum>Qt::ToolButtonIconOnly</enum>
- </property>
- <property name="floatable">
- <bool>false</bool>
+ <property name="iconSize">
+ <size>
+ <width>64</width>
+ <height>64</height>
+ </size>
</property>
<attribute name="toolBarArea">
<enum>LeftToolBarArea</enum>
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index ce24227..60295a3 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -37,6 +37,7 @@
// Auto-generated ui class
#include "ui_mainwindow.h"
+
const QString MainWindow::sStrTutorNdef = tr("No tutor defined.");
const QString MainWindow::sStrTutorOffline = tr("Tutor is offline.");
const QString MainWindow::sStrSourceNdef = tr("Please select a projection source.");
@@ -133,17 +134,12 @@ MainWindow::MainWindow(QString ipListUrl, QWidget* parent) :
_tileWidth = 10;
_tileHeight = 10;
- _timerId = 0;
- _timerTimeout = 0;
-
_listenServer = new ListenServer(CLIENT_PORT);
connect(_listenServer, SIGNAL(newClient(Client*)), this, SLOT(onClientConnected(Client*)));
_discoveryListener = new DiscoveryListener();
// Finally
this->onSessionNameUpdate();
- _timerId = startTimer(10);
- _timerTimeout = 8;
}
MainWindow::~MainWindow()
@@ -292,12 +288,20 @@ void MainWindow::changeEvent(QEvent* e)
*/
void MainWindow::resizeEvent(QResizeEvent* e)
{
- QMainWindow::resizeEvent(e);
- if (_timerId == 0)
+ // Resize all connection windows
+ if (ui->frmRoom->size().width() < 100 || ui->frmRoom->size().height() < 100 || _tilesX <= 0 || _tilesY <= 0)
+ return;
+ const int nw = ui->frmRoom->size().width() / _tilesX;
+ const int nh = ui->frmRoom->size().height() / _tilesY;
+ for (QList<ConnectionFrame*>::iterator it = _clientFrames.begin(); it != _clientFrames.end(); ++it)
{
- _timerId = startTimer(5);
+ const QPoint &oldpos = (*it)->frameGeometry().topLeft();
+ qDebug("Move C");
+ (*it)->move((oldpos.x() / _tileWidth) * nw, (oldpos.y() / _tileHeight) * nh);
+ (*it)->setSize(nw, nh);
}
- _timerTimeout = 8;
+ _tileWidth = nw;
+ _tileHeight = nh;
}
/***************************************************************************//**
@@ -324,63 +328,6 @@ void MainWindow::mouseReleaseEvent(QMouseEvent* e)
}
}
-/***************************************************************************//**
- * Handle TimerEvent.
- * If timerId of event equals _timerId reduce _timerTimeout by 1.
- * If _timerTimeout equals 1 move toolbar if necessary, otherwise kill timer.
- * @param event
- */
-void MainWindow::timerEvent(QTimerEvent* event)
-{
- if (event->timerId() == _timerId)
- {
- _timerTimeout -= 1;
- if (_timerTimeout == 1)
- {
- // Move toolbar if necessary
- const int iconSize = this->size().width() / 30 + 14;
- const int barSpace = ui->toolBar->actions().size() * (iconSize + 8);
- const Qt::ToolBarArea area =
- (barSpace < this->size().height() ? Qt::LeftToolBarArea : Qt::TopToolBarArea);
- if (_tbIconSize != iconSize)
- {
- _tbIconSize = iconSize;
- ui->toolBar->setIconSize(QSize(iconSize, iconSize));
- }
- if (_tbArea != area)
- {
- _tbArea = area;
- this->addToolBar(area, ui->toolBar);
- }
- return;
- }
- // Kill timer when done
- if (_timerTimeout <= 0)
- {
- killTimer(_timerId);
- _timerId = 0;
- // Resize all connection windows
- if (ui->frmRoom->size().width() < 100 || ui->frmRoom->size().height() < 100 || _tilesX <= 0 || _tilesY <= 0)
- return;
- const int nw = ui->frmRoom->size().width() / _tilesX;
- const int nh = ui->frmRoom->size().height() / _tilesY;
- for (QList<ConnectionFrame*>::iterator it = _clientFrames.begin(); it != _clientFrames.end(); ++it)
- {
- const QPoint &oldpos = (*it)->frameGeometry().topLeft();
- qDebug("Move C");
- (*it)->move((oldpos.x() / _tileWidth) * nw, (oldpos.y() / _tileHeight) * nh);
- (*it)->setSize(nw, nh);
- }
- _tileWidth = nw;
- _tileHeight = nh;
- }
- }
- else
- {
- // Unknown timer ID, kill
- killTimer(event->timerId());
- }
-}
/*
* Slots
diff --git a/src/server/mainwindow/mainwindow.h b/src/server/mainwindow/mainwindow.h
index 02e9bac..d6b0265 100644
--- a/src/server/mainwindow/mainwindow.h
+++ b/src/server/mainwindow/mainwindow.h
@@ -49,7 +49,6 @@ private:
// Internal stuff
QList<ConnectionFrame*> _clientFrames;
- int _timerId, _timerTimeout;
ListenServer *_listenServer;
DiscoveryListener *_discoveryListener;
FileDownloader _fileDownloader;
@@ -77,7 +76,6 @@ private:
void changeEvent(QEvent *e);
void resizeEvent(QResizeEvent *e);
void mouseReleaseEvent(QMouseEvent* e);
- void timerEvent(QTimerEvent* event);
protected slots: