#include "mainwindow.h"
+#include "preferences.h"
#include "vncview.h"
#include <QtMaemo5>
show_toolbar->setCheckable(true);
show_toolbar->setChecked(settings.value("show_toolbar", true).toBool());
menu->addAction(show_toolbar);
+ QAction *pref_action = new QAction("Preferences", this);
+ menu->addAction(pref_action);
QAction *about_action = new QAction("About", this);
menu->addAction(about_action);
connect(about_action, SIGNAL(triggered()),
this, SLOT(about()));
+ connect(pref_action, SIGNAL(triggered()),
+ this, SLOT(showPreferences()));
connect(connect_action, SIGNAL(triggered()),
this, SLOT(connectDialog()));
connect(disconnect_action, SIGNAL(triggered()),
setCentralWidget(scroll_area);
grabZoomKeys(true);
- setAttribute(Qt::WA_Maemo5AutoOrientation, true);
- //setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
+ loadPreferences();
connect(QApplication::desktop(), SIGNAL(resized(int)),
this, SLOT(forceResize()));
std::cout << "unhandled action?\n";
}
}
+
+void MainWindow::showPreferences()
+{
+ Preferences *p = new Preferences(this);
+ p->exec();
+ delete p;
+
+ loadPreferences();
+}
+
+void MainWindow::loadPreferences()
+{
+ QSettings settings;
+ int rotation = settings.value("screen_rotation", 0).toInt();
+ setAttribute(Qt::WA_Maemo5AutoOrientation, rotation == 0);
+ setAttribute(Qt::WA_Maemo5LandscapeOrientation, rotation == 1);
+ setAttribute(Qt::WA_Maemo5PortraitOrientation, rotation == 2);
+}
void sendPgUp() { vnc_view->sendKey(Qt::Key_PageUp); }
void sendPgDn() { vnc_view->sendKey(Qt::Key_PageDown); }
void showModifierMenu();
+ void showPreferences();
void statusChanged(RemoteView::RemoteStatus status);
void toggleFullscreen();
protected:
void closeEvent(QCloseEvent*);
private:
void grabZoomKeys(bool grab);
+ void loadPreferences();
VncView *vnc_view;
QScrollArea *scroll_area;
//QWidget *menu;
--- /dev/null
+/*
+ Presence VNC
+ Copyright (C) 2010 Christian Pulvermacher
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include <QtGui>
+#include <QMaemo5ValueButton>
+#include <QMaemo5ListPickSelector>
+
+#include "preferences.h"
+
+Preferences::Preferences(QWidget *parent):
+ QDialog(parent)
+{
+ setWindowTitle("Preferences");
+
+ QHBoxLayout *layout1 = new QHBoxLayout();
+ QVBoxLayout *layout2 = new QVBoxLayout();
+
+ QMaemo5ValueButton *rotation = new QMaemo5ValueButton(tr("Screen Rotation"), this);
+ //rotation->setValueText(settings.value("sound_filename", SOUND_FILE).toString());
+ rotation_selector = new QMaemo5ListPickSelector(this);
+ QStandardItemModel *model = new QStandardItemModel(0, 1, this);
+ model->appendRow(new QStandardItem(tr("Automatic")));
+ model->appendRow(new QStandardItem(tr("Landscape")));
+ model->appendRow(new QStandardItem(tr("Portrait")));
+ rotation_selector->setModel(model);
+ rotation_selector->setCurrentIndex(settings.value("screen_rotation", 0).toInt());
+ rotation->setPickSelector(rotation_selector);
+ rotation->setValueLayout(QMaemo5ValueButton::ValueBesideText);
+ layout2->addWidget(rotation);
+
+ QPushButton *ok = new QPushButton("OK");
+
+ layout1->addLayout(layout2);
+ layout1->addWidget(ok);
+
+ setLayout(layout1);
+
+ connect(ok, SIGNAL(clicked()),
+ this, SLOT(accept()));
+ connect(this, SIGNAL(accepted()),
+ this, SLOT(save()));
+}
+
+Preferences::~Preferences()
+{
+
+}
+
+
+void Preferences::save()
+{
+ settings.setValue("screen_rotation", rotation_selector->currentIndex());
+
+ settings.sync();
+}
--- /dev/null
+/*
+ Presence VNC
+ Copyright (C) 2010 Christian Pulvermacher
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef PREFERENCES_H
+#define PREFERENCES_H
+
+#include <QtGui>
+
+class QMaemo5ListPickSelector;
+
+class Preferences : public QDialog {
+ Q_OBJECT
+public:
+ Preferences(QWidget *parent);
+ ~Preferences();
+private slots:
+ void save();
+private:
+ QSettings settings;
+ QMaemo5ListPickSelector *rotation_selector;
+};
+#endif
kDebug(5011) << "Quit VNC thread success:" << quitSuccess;
delete [] frameBuffer;
+ delete cl;
}
void VncClientThread::checkOutputErrorMessage()
LIBS += -Llibvnc/libvncclient/.libs -lvncclient
DEFINES += QTONLY
QT += maemo5
-CONFIG += silent
+CONFIG += silent debug
OBJECTS_DIR = $${PWD}/tmp
MOC_DIR = $${PWD}/tmp
VPATH = $${PWD}/src
INCLUDEPATH = $${PWD}/src
-HEADERS += remoteview.h vncclientthread.h vncview.h mainwindow.h
-SOURCES += main.cpp remoteview.cpp vncclientthread.cpp vncview.cpp mainwindow.cpp
+HEADERS += remoteview.h vncclientthread.h vncview.h mainwindow.h preferences.h
+SOURCES += main.cpp remoteview.cpp vncclientthread.cpp vncview.cpp mainwindow.cpp preferences.cpp