--- /dev/null
+/* VLC-REMOTE for MAEMO 5
+* Copyright (C) 2010 Schutz Sacha <istdasklar@gmail.com>, Dru Moore <usr@dru-id.co.uk>, Yann Nave <yannux@onbebop.net>
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2,
+* or (at your option) any later version, as published by the Free
+* Software Foundation
+*
+* 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 "appsettings.h"
+// initialize static storage for settings reference
+//QSettings AppSettings::settings;
+
+AppSettings::AppSettings() {
+}
+
+AppSettings::~AppSettings() {
+ ;
+}
+
+QString AppSettings::getCurrentKey() {
+ QSettings sets;
+ return sets.value("config/currentKey", "").toString();
+}
+QString AppSettings::getCurrentIp() {
+ QSettings sets;
+ return sets.value("account/" + getCurrentKey(), "").toString();
+}
+VlcDirectory AppSettings::getHomeDirectory() {
+ QSettings sets;
+ VlcDirectory home;
+ home.name = sets.value("config/accounts/" + getCurrentKey() + "/homeDirName", "Default").toString();
+ home.path = sets.value("config/accounts/" + getCurrentKey() + "/homeDirPath", "~/").toString();
+ return home;
+}
+bool AppSettings::setHomeDirectory(VlcDirectory dir) {
+ QSettings sets;
+ sets.setValue("config/accounts/" + getCurrentKey() + "/homeDirName", dir.name);
+ sets.setValue("config/accounts/" + getCurrentKey() + "/homeDirPath", dir.path);
+ return true;
+}
+QList<VlcDirectory>* AppSettings::getFavourites() { return new QList<VlcDirectory>(); }
+bool AppSettings::addFavourite(VlcDirectory dir) { return true; }
+bool AppSettings::deleteFavourite(VlcDirectory dir) { return true; }
--- /dev/null
+/* VLC-REMOTE for MAEMO 5
+* Copyright (C) 2010 Schutz Sacha <istdasklar@gmail.com>, Dru Moore <usr@dru-id.co.uk>, Yann Nave <yannux@onbebop.net>
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2,
+* or (at your option) any later version, as published by the Free
+* Software Foundation
+*
+* 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 APPSETTINGS_H
+#define APPSETTINGS_H
+#include <QSettings>
+
+struct VlcDirectory {
+ QString name;
+ QString path;
+};
+
+class AppSettings {
+public:
+ explicit AppSettings();
+ ~AppSettings();
+ static QString getCurrentKey();
+ static QString getCurrentIp();
+ static VlcDirectory getHomeDirectory();
+ static QList<VlcDirectory>* getFavourites();
+ static bool addFavourite(VlcDirectory dir);
+ static bool deleteFavourite(VlcDirectory dir);
+ static bool setHomeDirectory(VlcDirectory dir);
+//private:
+ //static QSettings settings;
+};
+
+#endif // APPSETTINGS_H
#include "configdialog.h"
#include "aboutdialog.h"
#include "vlcbrowseelement.h"
-#include "accountdialog.h"
+#include "appsettings.h"
BrowseMainWindow::BrowseMainWindow(QWidget *parent) :
QMainWindow(parent),
{
ui->setupUi(this);
- mCurrentDir = "~/"; // This works on win as well as linux, would guess mac too.
+ mCurrentDir = "~/"; //AppSettings::getHomeDirectory().path; // This works on win as well as linux, would guess mac too.
setWindowTitle("Vlc remote");
connect(ui->playButton,SIGNAL(clicked()),this,SLOT(onPlay()));
connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
+ connect(ui->actionGoHome, SIGNAL(triggered()), this, SLOT(showHomeFolder()));
+ connect(ui->actionSetHome, SIGNAL(triggered()), this, SLOT(setHomeFolder()));
+ connect(ui->actionViewFavourites, SIGNAL(triggered()), this, SLOT(showFavourites()));
+ connect(ui->actionSetFavourite, SIGNAL(triggered()), this, SLOT(setFavourite()));
+
init();
}
void BrowseMainWindow::init() // THIS METHOD IS CALLED WHEN CONFIG CHANGED...
{
- mIp = AccountDialog::currentIp();
+ mIp = AppSettings::getCurrentIp(); // AccountDialog::currentIp();
+ setHomeDirectory();
+}
+void BrowseMainWindow::setHomeDirectory()
+{
+ mCurrentDir = AppSettings::getHomeDirectory().path;
}
void BrowseMainWindow::showCurrentDirectory() // THIS METHOD IS CALLED WHEN WINDOW IS OPENED...
{
}
}
+void BrowseMainWindow::showHomeFolder() {
+ browseDirectory(AppSettings::getHomeDirectory().path);
+}
+void BrowseMainWindow::setHomeFolder() {
+ if (0 < mCurrentDir.length()) {
+ VlcDirectory dir;
+ dir.name = "Home";
+ dir.path = mCurrentDir;
+ AppSettings::setHomeDirectory(dir);
+ }
+}
+void BrowseMainWindow::showFavourites() {}
+void BrowseMainWindow::setFavourite() {}
+
void BrowseMainWindow::onListSelectionChanged() {
QList<QListWidgetItem *> items = ui->listWidget->selectedItems();
if (0 < items.count()) {
void finished(QNetworkReply * reply);
void readReady();
void showCurrentDirectory();
+ void setHomeFolder();
+ void showHomeFolder();
+ void setFavourite();
+ void showFavourites();
+ void setHomeDirectory();
protected slots:
void parseXmlDirectory();
<string>menu</string>
</property>
</widget>
- <addaction name="menuMenu"/>
+ <addaction name="actionGoHome"/>
+ <addaction name="actionSetHome"/>
+ <addaction name="actionViewFavourites"/>
+ <addaction name="actionSetFavourite"/>
</widget>
- <action name="actionPortrait">
+ <action name="actionGoHome">
<property name="text">
- <string>Portrait Mode</string>
+ <string>Home</string>
</property>
</action>
- <action name="actionLandscape">
+ <action name="actionSetHome">
<property name="text">
- <string>Landscape Mode</string>
+ <string>Set as Home</string>
+ </property>
+ </action>
+ <action name="actionViewFavourites">
+ <property name="text">
+ <string>Favourites</string>
+ </property>
+ </action>
+ <action name="actionSetFavourite">
+ <property name="text">
+ <string>Add to Favourite</string>
</property>
</action>
</widget>
#include <QTranslator>
#include <QDebug>
#include "playermainwindow.h"
-#include "accountdialog.h"
+#include "appsettings.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
- qDebug() << AccountDialog::currentIp();
+ qDebug() << AppSettings::getCurrentIp();
PlayerMainWindow * mainwindow = new PlayerMainWindow;
#include <QSettings>
#include "configdialog.h"
#include "aboutdialog.h"
-#include "accountdialog.h"
+#include "appsettings.h"
#include "vlcstatus.h"
PlayListMainWindow::PlayListMainWindow(QWidget *parent) :
}
void PlayListMainWindow::init() // CALL WHEN CONFIG CHANGES
{
- mIp = AccountDialog::currentIp();
+ mIp = AppSettings::getCurrentIp(); // AccountDialog::currentIp();
}
void PlayListMainWindow::showPlayList() // CALL WHEN SHOWN
{
browsemainwindow.cpp \
vlcbrowseelement.cpp \
vlcplaylistelementsimple.cpp \
- vlcstatus.cpp
+ vlcstatus.cpp \
+ appsettings.cpp
HEADERS += playlistmainwindow.h \
playermainwindow.h \
configdialog.h \
browsemainwindow.h \
vlcbrowseelement.h \
vlcplaylistelementsimple.h \
- vlcstatus.h
+ vlcstatus.h \
+ appsettings.h
FORMS += playlistmainwindow.ui \
playermainwindow.ui \
configdialog.ui \
browsemainwindow.ui
OTHER_FILES += vlc-remote.desktop
RESOURCES += ressources.qrc
-
TRANSLATIONS = vlcremote_fr_FR.ts