--- /dev/null
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
+// QCoreApplication info
+#define APPLICATION_NAME "xbmcnetmoviesremote"
+#define ORGANIZATION_NAME "Ionutz Borcoman"
+
+// QSettings keys
+#define SETUP_XBMC_SERVER "xbmc/server"
+#define SETUP_XBMC_SERVER_DEFAULT "localhost"
+#define SETUP_XBMC_PORT "xbmc/port"
+#define SETUP_XBMC_PORT_DEFAULT "9090"
+
+#endif // SETTINGS_H
#include "mainwindow.h"
+#include "constants.h"
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
+ app.setOrganizationName(APPLICATION_NAME);
+ app.setApplicationName(ORGANIZATION_NAME);
MainWindow mainWindow;
mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
#include "mainwindow.h"
#include "ui_mainwindow.h"
+#include <setupdialog.h>
+
#include <QtCore/QCoreApplication>
#if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK)
show();
#endif
}
+
+void MainWindow::on_actionSetup_triggered()
+{
+ SetupDialog dialog;
+ dialog.load();
+ if(dialog.exec() == QDialog::Accepted) {
+ dialog.save();
+ }
+}
void setOrientation(ScreenOrientation orientation);
void showExpanded();
+private slots:
+ void on_actionSetup_triggered();
+
private:
Ui::MainWindow *ui;
};
+<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow" >
- <property name="geometry" >
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>320</height>
</rect>
</property>
- <property name="windowTitle" >
- <string>MainWindow</string>
+ <property name="windowTitle">
+ <string>XBMC Net Movies RC</string>
</property>
- <widget class="QMenuBar" name="menuBar" />
- <widget class="QWidget" name="centralWidget" />
+ <widget class="QWidget" name="centralWidget"/>
+ <widget class="QMenuBar" name="menuBar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>200</width>
+ <height>25</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuSetup">
+ <property name="title">
+ <string>MainMenu</string>
+ </property>
+ <addaction name="actionSetup"/>
+ </widget>
+ <addaction name="menuSetup"/>
+ </widget>
+ <action name="actionSetup">
+ <property name="text">
+ <string>Setup</string>
+ </property>
+ </action>
</widget>
- <layoutDefault spacing="6" margin="11" />
- <pixmapfunction></pixmapfunction>
+ <layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
--- /dev/null
+#include "setupdialog.h"
+#include "ui_setupdialog.h"
+
+#include "constants.h"
+
+#include <QSettings>
+
+SetupDialog::SetupDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::SetupDialog)
+{
+ ui->setupUi(this);
+}
+
+SetupDialog::~SetupDialog()
+{
+ delete ui;
+}
+
+void SetupDialog::save()
+{
+ QSettings settings;
+ settings.setValue(SETUP_XBMC_SERVER, ui->xbmcServerEdit->text());
+ settings.setValue(SETUP_XBMC_PORT, ui->xbmcPortEdit->text());
+}
+
+void SetupDialog::load()
+{
+ QSettings settings;
+ ui->xbmcServerEdit->setText(settings.value(SETUP_XBMC_SERVER, SETUP_XBMC_SERVER_DEFAULT).toString());
+ ui->xbmcPortEdit->setText(settings.value(SETUP_XBMC_PORT, SETUP_XBMC_PORT_DEFAULT).toString());
+}
--- /dev/null
+#ifndef SETUPDIALOG_H
+#define SETUPDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+ class SetupDialog;
+}
+
+class SetupDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit SetupDialog(QWidget *parent = 0);
+ ~SetupDialog();
+ void save();
+ void load();
+
+private:
+ Ui::SetupDialog *ui;
+};
+
+#endif // SETUPDIALOG_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SetupDialog</class>
+ <widget class="QDialog" name="SetupDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>329</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>XBMC</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="xbmcServerLabel">
+ <property name="text">
+ <string>Server:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="xbmcServerEdit"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="xbmcPortLabel">
+ <property name="text">
+ <string>Port:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="xbmcPortEdit"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>SetupDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>SetupDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
# CONFIG += mobility
# MOBILITY +=
-SOURCES += main.cpp mainwindow.cpp
-HEADERS += mainwindow.h
-FORMS += mainwindow.ui
+SOURCES += main.cpp mainwindow.cpp \
+ setupdialog.cpp
+HEADERS += mainwindow.h \
+ setupdialog.h \
+ constants.h
+FORMS += mainwindow.ui \
+ setupdialog.ui
# Please do not modify the following two lines. Required for deployment.
include(deployment.pri)