diff options
Diffstat (limited to 'src/gui/frame.cpp')
-rw-r--r-- | src/gui/frame.cpp | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/src/gui/frame.cpp b/src/gui/frame.cpp index 1b80c3d..561f3ce 100644 --- a/src/gui/frame.cpp +++ b/src/gui/frame.cpp @@ -19,7 +19,6 @@ */ #include <src/input/inputEvent.h> -#include <src/input/inputHandlerChain.h> #include "frame.h" #include <src/gui/mainWindow.h> #include <iostream> @@ -48,10 +47,12 @@ Frame::Frame(const QString & text, QWidget * parent) : _isLocked = false; _dozent = false; _uy = _ux = 0; + _isCloseUp = false; //QIcon icon; //icon.addFile(QString::fromUtf8(), QSize(), QIcon::Normal, QIcon::Off); button_closeUp = createToolButton(tr("View"), QIcon(":/restore"),SLOT(closeUp())); + button_closeUp->setCheckable(true); button_foto = createToolButton(tr("Foto"), QIcon(":/photos"),SLOT(foto())); button_lock = createToolButton(tr("Lock this client"), QIcon(":/lock"),SLOT(setLock())); //button_unlock = createToolButton(tr("Unlock this client"), QIcon(":/lock"),SLOT(setLock())); @@ -334,7 +335,11 @@ QImage Frame::getImageForFoto() void Frame::closeUp() { emit clicked(); - MainWindow::getWindow()->closeUp(); + + if(_isCloseUp) + MainWindow::getWindow()->unCloseUp(getConFrame()); + else + MainWindow::getWindow()->closeUp(getConFrame()); } void Frame::foto() @@ -378,6 +383,12 @@ void Frame::setDozent() } } +void Frame::setCloseUp(bool value) +{ + _isCloseUp = value; + button_closeUp->setChecked(value); +} + void Frame::remoteControlClicked() { if(_remoteControlEnabled) @@ -434,19 +445,18 @@ void Frame::sendInputEvent(InputEvent const& evt) { QString str; eventToString(evt, str); - std::string evtStr = evt.toString(); PVSMsg msg(PVSCOMMAND, "INPUTEVENT", str); if(_remoteControlEnabled) { if(_remoteControlToAll) { - ConsoleLog writeLine(QString("sendInputEvent(%1) to one").arg(evtStr.c_str())); + ConsoleLog writeLine(QString("sendInputEvent(%1) to one").arg(evt.toString())); PVSConnectionManager::getManager()->getServer()->sendToAll(msg); } else { - ConsoleLog writeLine(QString("sendInputEvent(%1) to all").arg(evtStr.c_str())); + ConsoleLog writeLine(QString("sendInputEvent(%1) to all").arg(evt.toString())); _cFrame->getConnection()->sendMessage(msg); } } @@ -519,7 +529,30 @@ void Frame::keyPressEvent(QKeyEvent* event) { // The action of the keyboard may depend on the position of the pointer sendMouseMotionEvent(); - sendInputEvent(InputEvent::keyboardPress(event->key(), event->modifiers())); + + int key = event->key(); + + if(key >= ' ' && key < 0x100) + { + // the key is a Latin1 key. We need to find out the correct code to send. + QString text = event->text(); + if(text.length() == 1 && text.at(0).row() == 0) + { + QChar c = text.at(0); + + // The next problem is that it may be a control character. + // This happens when Ctrl is pressed, so we only + // modify keys if they are lowercase or uppercase + // versions of the keycode. + + if(c.toLower().toLatin1() == (char)key || c.toUpper().toLatin1() == (char)key) + { + // We found a Latin1 char and pray it is the correct case. + key = c.cell(); + } + } + } + sendInputEvent(InputEvent::keyboardPress(key, event->modifiers())); } } else @@ -592,14 +625,14 @@ void Frame::showSpecialEventMenu() { qDebug("Trying to show menu..."); QMenu* menu = new QMenu(this); - QList<SpecialInputEventDescription> specialEvents = privileged_handler_chain::describe(); - QList<SpecialInputEventDescription>::iterator iter; + QList<SpecialInputEventDescription> specialEvents = SpecialInputEventDescription::describeSpecialEvents(); + QListIterator<SpecialInputEventDescription> iter(specialEvents); int i; - for(i = 0, iter = specialEvents.begin(); - iter != specialEvents.end(); - iter++, i++) + for(i = 0; + iter.hasNext(); + i++) { - QAction* act = menu->addAction((*iter).descriptionString); + QAction* act = menu->addAction(iter.next().description); act->setData(i); } QAction* selected = menu->exec(QCursor::pos()); |