From: yannux Date: Fri, 27 Aug 2010 15:55:02 +0000 (+0200) Subject: New structure for project. X-Git-Tag: v0.6~26 X-Git-Url: https://vcs.maemo.org/git/?p=vlc-remote;a=commitdiff_plain;h=92131c9881aed5a71cd7922f62b05051f7451bcb New structure for project. Delete unused files todo --- diff --git a/AboutDialog.ui b/AboutDialog.ui deleted file mode 100644 index 2cf6ba0..0000000 --- a/AboutDialog.ui +++ /dev/null @@ -1,64 +0,0 @@ - - - Dialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/Maemo_VLC_remote.svg b/Maemo_VLC_remote.svg deleted file mode 100644 index 83ad807..0000000 --- a/Maemo_VLC_remote.svg +++ /dev/null @@ -1,453 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index 3bdf506..0000000 --- a/TODO.txt +++ /dev/null @@ -1 +0,0 @@ -TODO diff --git a/aboutdialog.cpp b/aboutdialog.cpp deleted file mode 100644 index e1606ea..0000000 --- a/aboutdialog.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "aboutdialog.h" -#include "ui_aboutdialog.h" - -AboutDialog::AboutDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::AboutDialog) -{ - ui->setupUi(this); -} - -AboutDialog::~AboutDialog() -{ - delete ui; -} - -void AboutDialog::changeEvent(QEvent *e) -{ - QDialog::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/aboutdialog.h b/aboutdialog.h deleted file mode 100644 index c92ce70..0000000 --- a/aboutdialog.h +++ /dev/null @@ -1,40 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 ABOUTDIALOG_H -#define ABOUTDIALOG_H - -#include - -namespace Ui { - class AboutDialog; -} - -class AboutDialog : public QDialog { - Q_OBJECT -public: - explicit AboutDialog(QWidget *parent = 0); - ~AboutDialog(); - -protected: - void changeEvent(QEvent *e); - -private: - Ui::AboutDialog *ui; -}; - -#endif // ABOUTDIALOG_H diff --git a/aboutdialog.ui b/aboutdialog.ui deleted file mode 100644 index ad5fdd1..0000000 --- a/aboutdialog.ui +++ /dev/null @@ -1,81 +0,0 @@ - - - AboutDialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> -<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OMed </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application by Sacha schutz </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">istdasklar@gmail.com</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">http://omedsoft.blogspot.com/</span></a></p></td></tr></table></body></html> - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - AboutDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - AboutDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/accountdialog.cpp b/accountdialog.cpp deleted file mode 100644 index ecdb02f..0000000 --- a/accountdialog.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "accountdialog.h" -#include "ui_accountdialog.h" -#include "newaccountdialog.h" -#include -#include -#include -#include -#include -#include - - - -QListWidgetItem asyncTestItem(const QListWidgetItem &item) -{ - - QListWidgetItem item2= item; - item2.setText("boby"); - - return item; - -} - - - - -AccountDialog::AccountDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::AccountDialog) -{ - ui->setupUi(this); - - mFuturWatcher = new QFutureWatcher(this); - connect(mFuturWatcher,SIGNAL(resultReadyAt(int)),this,SLOT(setAsyncItem(int))); - - connect(ui->addButton,SIGNAL(clicked()),this,SLOT(add())); - connect(ui->editButton,SIGNAL(clicked()),this,SLOT(edit())); - connect(ui->remButton,SIGNAL(clicked()),this,SLOT(rem())); - connect(ui->useButton,SIGNAL(clicked()),this,SLOT(use())); - connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(enableUi())); - - load(); - -} - -AccountDialog::~AccountDialog() -{ - delete ui; -} - -void AccountDialog::add() -{ - - NewAccountDialog *dialog = new NewAccountDialog(this); - dialog->exec(); - load(); -} -QString AccountDialog::currentIp() -{ - - QSettings settings; - QString useKey = settings.value("config/currentKey").toString(); - QString useIp ; - if ( !useKey.isEmpty()) - useIp = settings.value("account/"+useKey).toString(); - - else return QString(); - - return useIp; -} - -void AccountDialog::load() -{ - ui->editButton->setEnabled(false); - ui->remButton->setEnabled(false); - ui->useButton->setEnabled(false); - ui->listWidget->clear(); // tjr effacer , sinon on rajoute - - QSettings settings; - - QString useKey = settings.value("config/currentKey").toString(); - - QList asycItems; - - settings.beginGroup("account"); - foreach ( QString key, settings.allKeys()) - { - QListWidgetItem * item = new QListWidgetItem; - - item->setText(key); - item->setData(Qt::UserRole, settings.value(key)); - if (useKey == key) { - QFont font = item->font(); - font.setBold(true); - item->setFont(font); - } - ui->listWidget->addItem(item); - asycItems.append(*item); - } - settings.endGroup(); - - - // ... create and add in the list widget - - // QFuture itemFutur = QtConcurrent::mapped(asycItems, asyncTestItem); - - - mFuturWatcher->setFuture(QtConcurrent::mapped(asycItems, asyncTestItem)); -} - -QListWidgetItem AccountDialog::asyncTestItem(const QListWidgetItem& item) -{ - //==========> NEED TO USE POINTER TO AVOID setAsyncItem! But I don't know how;.. - QListWidgetItem newItem = item; - - QTcpSocket * socket = new QTcpSocket; - QSettings settings; - QString host = settings.value("account/"+item.text()).toString(); - - if(host.contains(":")) - { - QStringList hostSplit = host.split(":"); - QString ip = hostSplit.at(0); - QString port = hostSplit.at(1); - socket->connectToHost(ip,port.toInt()); - } - - else - socket->connectToHost(host,8080); - - if (socket->waitForConnected(1000)) - newItem.setIcon(QIcon::fromTheme("widgets_tickmark_list")); - else - newItem.setIcon(QIcon::fromTheme("statusarea_presence_busy_error")); - - return newItem; - - -} - - - -void AccountDialog::setAsyncItem(int row) // EDIT THE ROW AFTER ASYNC FUNCTION FINISHED -{ - QListWidgetItem newItem = mFuturWatcher->resultAt(row); - QListWidgetItem * item = ui->listWidget->item(row); - - item->setIcon(newItem.icon()); - - - -} - - - -void AccountDialog::edit() -{ - QString currentIp = ui->listWidget->currentItem()->data(Qt::UserRole).toString(); - QString currentKey = ui->listWidget->currentItem()->text(); - - NewAccountDialog *dialog = new NewAccountDialog(this); - dialog->edit(currentKey, currentIp); - dialog->exec(); - - load(); -} - -void AccountDialog::rem() -{ - QString key = ui->listWidget->currentItem()->text(); - - QSettings settings; - settings.beginGroup("account"); - settings.remove(key); - settings.endGroup(); - - load(); // On recharge les compte -} - -void AccountDialog::use() -{ - QString currentKey = ui->listWidget->currentItem()->text(); - QSettings settings; - settings.setValue("config/currentKey", currentKey); - load(); - emit accept(); -} - -void AccountDialog::enableUi() -{ - ui->editButton->setEnabled(true); - ui->remButton->setEnabled(true); - ui->useButton->setEnabled(true); -} diff --git a/accountdialog.h b/accountdialog.h deleted file mode 100644 index e9468dd..0000000 --- a/accountdialog.h +++ /dev/null @@ -1,53 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 ACCOUNTDIALOG_H -#define ACCOUNTDIALOG_H - -#include -#include -#include -namespace Ui { - class AccountDialog; -} - -class AccountDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AccountDialog(QWidget *parent = 0); - ~AccountDialog(); - static QListWidgetItem asyncTestItem(const QListWidgetItem& item); - - -static QString currentIp(); - -public slots: - void add(); - void edit(); - void rem(); - void use(); - void load(); - void enableUi(); - void setAsyncItem(int row); -private: - Ui::AccountDialog *ui; - QFutureWatcher * mFuturWatcher; -}; - -#endif // ACCOUNTDIALOG_H diff --git a/accountdialog.ui b/accountdialog.ui deleted file mode 100644 index 8b0dd97..0000000 --- a/accountdialog.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - AccountDialog - - - - 0 - 0 - 400 - 300 - - - - Accounts - - - - - - - test - - - - - - - - - - Add - - - - - - - false - - - Edit - - - - - - - false - - - Remove - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - false - - - Use - - - - - - - - - - diff --git a/accountnewdialog.ui b/accountnewdialog.ui deleted file mode 100644 index 0ac856e..0000000 --- a/accountnewdialog.ui +++ /dev/null @@ -1,67 +0,0 @@ - - Dialog - - - - 0 - 0 - 320 - 240 - - - - Dialog - - - - - 10 - 200 - 301 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/appsettings.cpp b/appsettings.cpp deleted file mode 100644 index babef8c..0000000 --- a/appsettings.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 -#include "appsettings.h" - -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* AppSettings::getFavourites() { - QSettings sets; - QList * favourites = new QList(); - - sets.beginGroup("config/accounts/" + getCurrentKey() + "/favourites"); - foreach ( QString key, sets.allKeys()) - { - VlcDirectory dir; - // key is name - dir.name = key; - // value is path - dir.path = sets.value(key, "~/").toString(); - favourites->append(dir); - } - sets.endGroup(); - return favourites; -} -bool AppSettings::addFavourite(VlcDirectory dir) { - QSettings sets; - // should check for existing first otherwise it overwrites - if (0 < sets.value("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name, "").toString().length()) { - dir.name = "_" + dir.name; - return addFavourite(dir); - } - sets.setValue("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name, dir.path); - return true; -} -bool AppSettings::deleteFavourite(VlcDirectory dir) { - QSettings sets; - sets.remove("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name); - return true; -} -Orientation AppSettings::setOrientation(Orientation orientation) { - QSettings sets; - sets.setValue("config/orientation", (int)orientation); - return orientation; -} -Orientation AppSettings::getOrientation() { - QSettings sets; - return (Orientation)(sets.value("config/orientation", AUTO_ROTATE).toInt()); -} - diff --git a/appsettings.h b/appsettings.h deleted file mode 100644 index 407b5a2..0000000 --- a/appsettings.h +++ /dev/null @@ -1,49 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 - -struct VlcDirectory { - QString name; - QString path; -}; -enum Orientation { - AUTO_ROTATE = 0, - LANDSCAPE, - PORTRAIT -}; - -class AppSettings { -public: - explicit AppSettings(); - ~AppSettings(); - static QString getCurrentKey(); - static QString getCurrentIp(); - static VlcDirectory getHomeDirectory(); - static QList* getFavourites(); - static bool addFavourite(VlcDirectory dir); - static bool deleteFavourite(VlcDirectory dir); - static bool setHomeDirectory(VlcDirectory dir); - static Orientation setOrientation(Orientation orientation); - static Orientation getOrientation(); -//private: - //static QSettings settings; -}; - -#endif // APPSETTINGS_H diff --git a/browsemainwindow.cpp b/browsemainwindow.cpp deleted file mode 100644 index a07b131..0000000 --- a/browsemainwindow.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "browsemainwindow.h" -#include "ui_browsemainwindow.h" -#include -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) -#include -#endif -#include "configdialog.h" -#include "aboutdialog.h" -#include "vlcbrowseelement.h" -#include "appsettings.h" -#include "favouritesmainwindow.h" - -BrowseMainWindow::BrowseMainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::BrowseMainWindow) -{ - - ui->setupUi(this); - mFavouritesMainWindow = new FavouritesMainWindow; - mCurrentDir = "~/"; //AppSettings::getHomeDirectory().path; // This works on win as well as linux, would guess mac too. - setWindowTitle("Vlc remote"); - - - mNetManager = new QNetworkAccessManager(this); - - mContents = new QList(); - - ui->listWidget->setTextElideMode(Qt::ElideMiddle); - ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - ui->playButton->setIcon(QIcon::fromTheme("camera_playback")); - ui->addButton->setIcon(QIcon::fromTheme("general_add")); - ui->browseButton->setIcon(QIcon::fromTheme("filemanager_media_folder")); - ui->browseButton->setDisabled(true); - ui->playButton->setDisabled(true); - ui->addButton->setDisabled(true); - - -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - - mFavouritesMainWindow->setParent(this); - mFavouritesMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); - setAttribute(Qt::WA_Maemo5StackedWindow, true); - mFavouritesMainWindow->setWindowFlags(mFavouritesMainWindow->windowFlags() | Qt::Window); - -#endif - - connect(ui->browseButton,SIGNAL(clicked()),this,SLOT(onBrowse())); - connect(ui->addButton,SIGNAL(clicked()),this,SLOT(onAddToPlaylist())); - connect(ui->playButton,SIGNAL(clicked()),this,SLOT(onPlay())); - connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); - - connect(ui->actionGoUserHome, SIGNAL(triggered()), this, SLOT(showUserHomeFolder())); - 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())); - - connect(this->mFavouritesMainWindow, SIGNAL(browseDirectory(QString)), this, SLOT(browseDirectory(QString))); - - init(); - - -} -void BrowseMainWindow::init() // THIS METHOD IS CALLED WHEN CONFIG CHANGED... -{ - mIp = AppSettings::getCurrentIp(); // AccountDialog::currentIp(); - setHomeDirectory(); -} -void BrowseMainWindow::setHomeDirectory() -{ - mCurrentDir = AppSettings::getHomeDirectory().path; -} -void BrowseMainWindow::showCurrentDirectory() // THIS METHOD IS CALLED WHEN WINDOW IS OPENED... -{ - browseDirectory(mCurrentDir); -} - -BrowseMainWindow::~BrowseMainWindow() -{ - delete ui; -} - -void BrowseMainWindow::changeEvent(QEvent *e) -{ - QMainWindow::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -void BrowseMainWindow::showHomeFolder() { - browseDirectory(AppSettings::getHomeDirectory().path); -} -void BrowseMainWindow::showUserHomeFolder() { - browseDirectory("~/"); -} -void BrowseMainWindow::setHomeFolder() { - if (0 < mCurrentElement.name.length() && (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type))) { - VlcDirectory dir; - dir.name = mCurrentElement.name; - dir.path = mCurrentElement.path; - AppSettings::setHomeDirectory(dir); - } - else if (0 < mCurrentDir.length()) { - VlcDirectory dir; - QString name = mCurrentDir; - int idx = mCurrentDir.lastIndexOf('/'); - if (0 > idx) idx = mCurrentDir.lastIndexOf('\\'); - if (0 < idx) { - name = mCurrentDir.right(mCurrentDir.length() - (idx + 1)); - } - dir.name = name; - dir.path = mCurrentDir; - AppSettings::setHomeDirectory(dir); - } -} -void BrowseMainWindow::showFavourites() { - mFavouritesMainWindow->show(); - mFavouritesMainWindow->init(); -} -void BrowseMainWindow::setFavourite() { - if (0 < mCurrentElement.name.length() && (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type))) { - VlcDirectory dir; - dir.name = mCurrentElement.name; - dir.path = mCurrentElement.path; - AppSettings::addFavourite(dir); - } - else if (0 < mCurrentDir.length()) { - VlcDirectory dir; - QString name = mCurrentDir; - int idx = mCurrentDir.lastIndexOf('/'); - if (0 > idx) idx = mCurrentDir.lastIndexOf('\\'); - if (0 < idx) { - name = mCurrentDir.right(mCurrentDir.length() - (idx + 1)); - } - dir.name = name; - dir.path = mCurrentDir; - AppSettings::addFavourite(dir); - } -} - -void BrowseMainWindow::onListSelectionChanged() { - QList items = ui->listWidget->selectedItems(); - if (0 < items.count()) { - mCurrentElement = getElementFromText(items.at(0)->text()); - // are we up dir? - if (0 == QString::compare("..", mCurrentElement.name)) { - ui->browseButton->setDisabled(true); - ui->playButton->setDisabled(true); - ui->addButton->setDisabled(true); - mCurrentDir = mCurrentElement.path; - browseDirectory(mCurrentDir); - } - else { - // can we browse? - if (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type)) { - ui->browseButton->setDisabled(false); - } - else { - ui->browseButton->setDisabled(true); - } - // can we play? - ui->playButton->setDisabled(false); - // can we playlist? - ui->addButton->setDisabled(false); - } - } -} - -VlcBrowseElement BrowseMainWindow::getElementFromText(QString text) { - for (int idx = 0; idx < mContents->count(); ++idx) { - if (0 == QString::compare(text, mContents->at(idx).name)) { - return mContents->at(idx); - } - } - return *(new VlcBrowseElement()); -} - -void BrowseMainWindow::onBrowse() { - // check for directory - if (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type)) { - // call browseDirectory - mCurrentDir = mCurrentElement.path; - browseDirectory(mCurrentDir); - } - else { - ui->browseButton->setDisabled(true); - } -} - -void BrowseMainWindow::onAddToPlaylist() { - QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=in_enqueue"); - url.addEncodedQueryItem(QByteArray("input"), QUrl::toPercentEncoding(mCurrentElement.path.replace("\\", "\\\\").replace("'", "\\'"))); - mNetManager->get(QNetworkRequest(url)); - //mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=in_enqueue&input=" + mCurrentElement.path.replace("\\", "\\\\")))); -} - -void BrowseMainWindow::onPlay() { - QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=in_play"); - url.addEncodedQueryItem(QByteArray("input"), QUrl::toPercentEncoding(mCurrentElement.path.replace("\\", "\\\\").replace("'", "\\'"))); - mNetManager->get(QNetworkRequest(url)); - //mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=in_play&input=" + mCurrentElement.path.replace("\\", "\\\\")))); -} - -void BrowseMainWindow::browseDirectory(QString dir) { - if (mFavouritesMainWindow) { - setParent(this->parentWidget()); -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - setAttribute(Qt::WA_Maemo5StackedWindow, true); -#endif - mFavouritesMainWindow->hide(); - } - mResponse.clear(); - QUrl url = QUrl("http://"+mIp+"/requests/browse.xml"); - url.addEncodedQueryItem(QByteArray("dir"), QUrl::toPercentEncoding(dir)); - QNetworkReply * reply = mNetManager->get(QNetworkRequest(url)); - //QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/browse.xml?dir=" + dir.replace("&", "%26").replace("\\", "\\\\")))); -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true); -#endif - connect(reply,SIGNAL(readyRead()),this,SLOT(readReady())); - connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); - connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); -} -void BrowseMainWindow::error(QNetworkReply::NetworkError code) { -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); -#endif - qDebug() << code; -} -void BrowseMainWindow::readReady() { - QNetworkReply * reply = qobject_cast(sender()); - // append to buffer - mResponse += reply->readAll(); -} -void BrowseMainWindow::finished(QNetworkReply * reply) { - // now we can call parseXmlDirectory to process the full buffers - this->parseXmlDirectory(); - // only interested in finished signals - disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); -#endif - delete reply; -} -void BrowseMainWindow::parseXmlDirectory() { - QDomDocument doc; - doc.setContent(this->mResponse); - QDomElement docElem = doc.documentElement(); - QDomNodeList elements = docElem.elementsByTagName("element"); - // we can sort by folders then files alphabetically by running to lists and appending them at the end - // vlc alpha sorts everything in the incoming stream, we just need to seperate files from folders. - if (0 < elements.count()) { - QList* files = new QList(); - int idx = 0; - mContents->clear(); - do { - QDomNode node = elements.at(idx); - VlcBrowseElement* dir = new VlcBrowseElement(); - dir->type = node.attributes().namedItem("type").nodeValue(); - dir->size = node.attributes().namedItem("size").nodeValue().toInt(); - dir->date = QDate::fromString(node.attributes().namedItem("date").nodeValue()); - dir->path = node.attributes().namedItem("path").nodeValue(); - dir->name = node.attributes().namedItem("name").nodeValue(); - dir->extension = getExtension(dir->path, node.attributes().namedItem("extension").nodeValue()); - ++idx; - if (0 != QString::compare("directory", dir->type) && 0 != QString::compare("dir", dir->type)) { - files->append(*dir); - } - else if (0 == QString::compare("..", dir->name)) { - this->mContents->prepend(*dir); - } - else { - this->mContents->append(*dir); - } - delete dir; - } while (idx < elements.count()); - if (0 < files->count()) { - mContents->append(*files); - } - delete files; - // Update UI - this->updateList(); - } - else { - // alert user of error / empty directory - qDebug() << "can't browse dir: " << mCurrentDir; -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - QMaemo5InformationBox::information(this, tr("Directory could not be browsed!"), QMaemo5InformationBox::DefaultTimeout); -#endif - } - mResponse.clear(); - -} - -QString BrowseMainWindow::getExtension(QString path, QString extension) { - // return extension if exists - if (!extension.isNull() && !extension.isEmpty()) return extension; - // return blank if no path - if (path.isNull() || path.isEmpty()) return ""; - // otherwise extract the extension - int dot_pos = path.lastIndexOf('.'); - if (0 < dot_pos) { - return path.right(path.length() - (dot_pos + 1)); - } - else { // no dot - return ""; - } -} - -void BrowseMainWindow::updateList() { - ui->listWidget->clear(); - int ct = this->mContents->count(); - if (0 < ct) { - QIcon icon_up = QIcon::fromTheme("filemanager_folder_up"); - QIcon icon_folder = QIcon::fromTheme("general_folder"); - QIcon icon_audio = QIcon::fromTheme("general_audio_file"); - QIcon icon_video = QIcon::fromTheme("general_video_file"); - QIcon icon_image = QIcon::fromTheme("general_image"); - QIcon icon_flash = QIcon::fromTheme("filemanager_flash_file"); - QIcon icon_real = QIcon::fromTheme("filemanager_real_music"); - QIcon icon_playl = QIcon::fromTheme("filemanager_playlist"); - QIcon icon_unknown= QIcon::fromTheme("filemanager_unknown_file"); - for (int idx = 0; idx < ct; ++idx) { - VlcBrowseElement dir = mContents->at(idx); - QListWidgetItem* item; - bool item_good = false; - if (0 == QString::compare("directory", dir.type) || 0 == QString::compare("dir", dir.type)) { - if (0 == QString::compare("..", dir.name)) { - item = new QListWidgetItem(icon_up, dir.name, ui->listWidget, 0); - item_good = true; - } - else { - item = new QListWidgetItem(icon_folder, dir.name, ui->listWidget, 0); - item_good = true; - } - } - else if (0 == QString::compare("file", dir.type)) { - if ( 0 == QString::compare(dir.extension, "jpg") || - 0 == QString::compare(dir.extension, "jpeg") || - 0 == QString::compare(dir.extension, "gif") || - 0 == QString::compare(dir.extension, "png") || - 0 == QString::compare(dir.extension, "bmp") ) { - item_good = true; - item = new QListWidgetItem(icon_image, dir.name, ui->listWidget, 0); // .jpg, .jpeg, .gif, .png, .bmp - } - else if ( 0 == QString::compare(dir.extension, "mp3") || - 0 == QString::compare(dir.extension, "m4a") || - 0 == QString::compare(dir.extension, "ogg") || - 0 == QString::compare(dir.extension, "oga") || - 0 == QString::compare(dir.extension, "wav") || - 0 == QString::compare(dir.extension, "flac") ) { - item_good = true; - item = new QListWidgetItem(icon_audio, dir.name, ui->listWidget, 0); // .mp3, .m4a, .ogg, .oga, .wav, .flac - } - else if ( 0 == QString::compare(dir.extension, "m3u") || - 0 == QString::compare(dir.extension, "wpl") || - 0 == QString::compare(dir.extension, "pls") || - 0 == QString::compare(dir.extension, "asx") || - 0 == QString::compare(dir.extension, "xspf") || - 0 == QString::compare(dir.extension, "cmml") ) { - item_good = true; - item = new QListWidgetItem(icon_playl, dir.name, ui->listWidget, 0); // .m3u, .wpl, .pls, .asx, .xspf, .cmml - } - else if ( 0 == QString::compare(dir.extension, "avi") || - 0 == QString::compare(dir.extension, "mpeg") || - 0 == QString::compare(dir.extension, "mpg") || - 0 == QString::compare(dir.extension, "mov") || - 0 == QString::compare(dir.extension, "mp4") || - 0 == QString::compare(dir.extension, "m4v") || - 0 == QString::compare(dir.extension, "wmv") || - 0 == QString::compare(dir.extension, "mkv") || - 0 == QString::compare(dir.extension, "ogv") ) { - item_good = true; - item = new QListWidgetItem(icon_video, dir.name, ui->listWidget, 0); // .avi, .mpg, .mpeg, .mov, .mp4, .m4v, .wmv, .mkv, .ogv - } - else if ( 0 == QString::compare(dir.extension, "rm") || - 0 == QString::compare(dir.extension, "ra") || - 0 == QString::compare(dir.extension, "ram") ) { - item = new QListWidgetItem(icon_real, dir.name, ui->listWidget, 0); // .ram, 'rm, 'ra - } - else if ( 0 == QString::compare(dir.extension, "flv") ) { - item_good = true; - item = new QListWidgetItem(icon_flash, dir.name, ui->listWidget, 0); // .flv - } - else { - if (dir.name.startsWith("Flash")) { - item_good = true; - item = new QListWidgetItem(icon_flash, dir.name, ui->listWidget, 0); - } - else { - item_good = false; - //item = new QListWidgetItem(icon_unknown, dir.name, ui->listWidget, 0); - } - } - } - if (item_good) { - ui->listWidget->addItem(item); - } - // other types ignored - } - } -} - - diff --git a/browsemainwindow.h b/browsemainwindow.h deleted file mode 100644 index 052421a..0000000 --- a/browsemainwindow.h +++ /dev/null @@ -1,76 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 BROWSEMAINWINDOW_H -#define BROWSEMAINWINDOW_H - -#include -#include -#include -#include -#include "vlcbrowseelement.h" -#include "favouritesmainwindow.h" - -namespace Ui { - class BrowseMainWindow; -} - -class BrowseMainWindow : public QMainWindow { - Q_OBJECT -public: - explicit BrowseMainWindow(QWidget *parent = 0); - ~BrowseMainWindow(); - -public slots: - void init(); - void browseDirectory(QString); - void onBrowse(); - void onPlay(); - void onAddToPlaylist(); - void onListSelectionChanged(); - void finished(QNetworkReply * reply); - void readReady(); - void error(QNetworkReply::NetworkError code); - void showCurrentDirectory(); - void setHomeFolder(); - void showHomeFolder(); - void showUserHomeFolder(); - void setFavourite(); - void showFavourites(); - void setHomeDirectory(); - -protected slots: - void parseXmlDirectory(); - void updateList(); - -protected: - void changeEvent(QEvent *e); - VlcBrowseElement getElementFromText(QString text); - QString getExtension(QString path, QString extension); - -private: - Ui::BrowseMainWindow *ui; - FavouritesMainWindow *mFavouritesMainWindow; - QNetworkAccessManager * mNetManager; - QString mCurrentDir; - QString mIp; - QList* mContents; - VlcBrowseElement mCurrentElement; - QByteArray mResponse; -}; - -#endif // BROWSEMAINWINDOW_H diff --git a/browsemainwindow.ui b/browsemainwindow.ui deleted file mode 100644 index 6ae1aee..0000000 --- a/browsemainwindow.ui +++ /dev/null @@ -1,97 +0,0 @@ - - - BrowseMainWindow - - - - 0 - 0 - 800 - 600 - - - - MainWindow - - - - - - - - - - - - - Play - - - - - - - Enqueue - - - - - - - Browse - - - - - - - - - - - 0 - 0 - 800 - 27 - - - - - menu - - - - - - - - - - - User Folder - - - - - Home - - - - - Set as Home - - - - - Favourites - - - - - Add to Favourite - - - - - - diff --git a/config-vlc.jpg b/config-vlc.jpg deleted file mode 100644 index b4610f0..0000000 Binary files a/config-vlc.jpg and /dev/null differ diff --git a/configdialog.cpp b/configdialog.cpp deleted file mode 100644 index 9888666..0000000 --- a/configdialog.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "configdialog.h" -#include "ui_configdialog.h" -#include - -ConfigDialog::ConfigDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::ConfigDialog) -{ - ui->setupUi(this); - load(); - connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(save())); -} - -ConfigDialog::~ConfigDialog() -{ - delete ui; -} - -void ConfigDialog::changeEvent(QEvent *e) -{ - QDialog::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} -void ConfigDialog::load() -{ - QSettings settings; - ui->lineEdit->setText(settings.value("ip").toString()); - -} - -void ConfigDialog::save() -{ - - QSettings settings; - settings.setValue("ip",ui->lineEdit->text()); - - emit accept(); -} diff --git a/configdialog.h b/configdialog.h deleted file mode 100644 index e6c4f67..0000000 --- a/configdialog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 CONFIGDIALOG_H -#define CONFIGDIALOG_H - -#include - -namespace Ui { - class ConfigDialog; -} - -class ConfigDialog : public QDialog { - Q_OBJECT -public: - explicit ConfigDialog(QWidget *parent = 0); - ~ConfigDialog(); -public slots: -void load(); -void save(); -protected: - void changeEvent(QEvent *e); - -private: - Ui::ConfigDialog *ui; -}; - -#endif // CONFIGDIALOG_H diff --git a/configdialog.ui b/configdialog.ui deleted file mode 100644 index c3dd6f0..0000000 --- a/configdialog.ui +++ /dev/null @@ -1,69 +0,0 @@ - - - ConfigDialog - - - - 0 - 0 - 442 - 304 - - - - Dialog - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> -<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Enter IP of VLC server. </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Example : <span style=" font-weight:600;">192.168.0.8:8080</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Be sure you have properly configured Vlc</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> and allows connection by adding this IP in /vlc/http/.hosts</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">More information on my blog : <a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">omed.blogspot.com</span></a><br /></p></td></tr></table></body></html> - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - rejected() - ConfigDialog - reject() - - - 295 - 284 - - - 286 - 274 - - - - - diff --git a/favouritesmainwindow.cpp b/favouritesmainwindow.cpp deleted file mode 100644 index a578deb..0000000 --- a/favouritesmainwindow.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "favouritesmainwindow.h" -#include "ui_favouritesmainwindow.h" -#include -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) -#include -#endif -#include "appsettings.h" -//#include "browsemainwindow.h" - -FavouritesMainWindow::FavouritesMainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::FavouritesMainWindow) -{ - - ui->setupUi(this); - - setWindowTitle("Vlc remote"); - mCurrentItemIndex = -1; - - ui->listWidget->setTextElideMode(Qt::ElideMiddle); - ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - ui->deleteButton->setIcon(QIcon::fromTheme("general_delete")); - ui->editButton->setIcon(QIcon::fromTheme("general_sketch")); - ui->browseButton->setIcon(QIcon::fromTheme("filemanager_media_folder")); - ui->saveButton->setIcon(QIcon::fromTheme("notes_save")); - ui->browseButton->setDisabled(true); - ui->editButton->setDisabled(true); - ui->deleteButton->setDisabled(true); - ui->actionSetHome->setDisabled(true); - ui->label->setVisible(false); - ui->lineEdit->setVisible(false); - ui->saveButton->setVisible(false); - ui->saveButton->setDisabled(true); - - connect(ui->browseButton,SIGNAL(clicked()),this,SLOT(onBrowse())); - connect(ui->deleteButton,SIGNAL(clicked()),this,SLOT(onDelete())); - connect(ui->editButton,SIGNAL(clicked()),this,SLOT(onEdit())); - connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); - connect(ui->actionSetHome, SIGNAL(triggered()), this, SLOT(setHomeFolder())); - connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(onEditSave())); - connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(onLineEditTextChanged(QString))); - - init(); - - -} -void FavouritesMainWindow::init() // THIS METHOD IS CALLED WHEN CONFIG CHANGED AND WINDOW SHOWN... -{ - mFavourites = AppSettings::getFavourites(); - updateList(); -} - -FavouritesMainWindow::~FavouritesMainWindow() -{ - delete mFavourites; - delete ui; -} - -void FavouritesMainWindow::changeEvent(QEvent *e) -{ - QMainWindow::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} -void FavouritesMainWindow::updateList() { - ui->listWidget->clear(); - if (NULL != mFavourites && 0 < mFavourites->count()) { - for (int idx = 0; idx < mFavourites->count(); ++idx) { - QListWidgetItem* item = new QListWidgetItem(QIcon::fromTheme("imageviewer_favourite"), mFavourites->at(idx).name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + idx); - ui->listWidget->addItem(item); - } - } -} -void FavouritesMainWindow::setHomeFolder() { - if (-1 < mCurrentItemIndex) { - AppSettings::setHomeDirectory(mCurrentFavourite); - } -} -void FavouritesMainWindow::onListSelectionChanged() { - ui->label->setVisible(false); - ui->lineEdit->setVisible(false); - ui->saveButton->setVisible(false); - ui->saveButton->setDisabled(true); - QList items = ui->listWidget->selectedItems(); - if (0 < items.count()) { - mCurrentItemIndex = ui->listWidget->currentIndex().row(); - mCurrentFavourite = mFavourites->at(items.at(0)->type() - LIST_ITEM_TYPE_OFFSET); // Qt reserves types up to 1000, we use an offset beyond that for index tracking. May prove to be too hacky! - ui->browseButton->setDisabled(false); - ui->editButton->setDisabled(false); - ui->deleteButton->setDisabled(false); - ui->actionSetHome->setDisabled(false); - } - else { - mCurrentItemIndex = -1; - ui->browseButton->setDisabled(true); - ui->editButton->setDisabled(true); - ui->deleteButton->setDisabled(true); - ui->actionSetHome->setDisabled(true); - } -} -void FavouritesMainWindow::onLineEditTextChanged(QString text) { - if (0 < text.length()) { - ui->saveButton->setDisabled(false); - } - else { - ui->saveButton->setDisabled(true); - } -} -void FavouritesMainWindow::onEditSave() { - if (-1 < mCurrentItemIndex && 0 < ui->lineEdit->text().length()) { - ui->label->setVisible(false); - ui->lineEdit->setVisible(false); - ui->saveButton->setVisible(false); - ui->saveButton->setDisabled(true); - AppSettings::deleteFavourite(mCurrentFavourite); - mCurrentFavourite.name = ui->lineEdit->text(); - AppSettings::addFavourite(mCurrentFavourite); - ui->lineEdit->setText(""); - ui->listWidget->itemAt(mCurrentItemIndex, 0)->setText(mCurrentFavourite.name); - init(); - } -} -void FavouritesMainWindow::onEdit() { - if (-1 < mCurrentItemIndex) { - ui->label->setVisible(true); - ui->lineEdit->setVisible(true); - ui->saveButton->setVisible(true); - ui->saveButton->setDisabled(false); - ui->lineEdit->setText(mCurrentFavourite.name); - ui->browseButton->setDisabled(true); - ui->editButton->setDisabled(true); - ui->deleteButton->setDisabled(true); - } -} -void FavouritesMainWindow::onBrowse() { - if (-1 < mCurrentItemIndex) { - emit browseDirectory(mCurrentFavourite.path); - //this->close(); - //((BrowseMainWindow *)this->parent())->browseDirectory(mCurrentFavourite.path); - } -} -void FavouritesMainWindow::onDelete() { - if (-1 < mCurrentItemIndex) { - AppSettings::deleteFavourite(mCurrentFavourite); - init(); - } -} diff --git a/favouritesmainwindow.h b/favouritesmainwindow.h deleted file mode 100644 index 76964b0..0000000 --- a/favouritesmainwindow.h +++ /dev/null @@ -1,67 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 FAVOURITESMAINWINDOW_H -#define FAVOURITESMAINWINDOW_H - -#include -#include -#include -#include -#include "appsettings.h" - -#ifndef LIST_ITEM_TYPE_OFFSET -#define LIST_ITEM_TYPE_OFFSET 1000 -#endif - -namespace Ui { - class FavouritesMainWindow; -} - -class FavouritesMainWindow : public QMainWindow { - Q_OBJECT -public: - explicit FavouritesMainWindow(QWidget *parent = 0); - ~FavouritesMainWindow(); - -public slots: - void init(); - void onListSelectionChanged(); - void onLineEditTextChanged(QString text); - void onBrowse(); - void onEdit(); - void onDelete(); - void setHomeFolder(); - void onEditSave(); - -protected slots: - -signals: - void browseDirectory(QString path); - -protected: - void changeEvent(QEvent *e); - void updateList(); - -private: - Ui::FavouritesMainWindow *ui; - int mCurrentItemIndex; - QList* mFavourites; - VlcDirectory mCurrentFavourite; -}; - -#endif // FAVOURITESMAINWINDOW_H diff --git a/favouritesmainwindow.ui b/favouritesmainwindow.ui deleted file mode 100644 index b379237..0000000 --- a/favouritesmainwindow.ui +++ /dev/null @@ -1,88 +0,0 @@ - - - FavouritesMainWindow - - - - 0 - 0 - 798 - 598 - - - - MainWindow - - - - - - - - - - - - Name - - - - - - - - - - Save - - - - - - - - - - - Delete - - - - - - - Edit - - - - - - - Browse - - - - - - - - - - - 0 - 0 - 798 - 20 - - - - - - - Set as Home - - - - - - diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 8e21758..0000000 --- a/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 -#include -#include -#include -#include -#include -#include "playermainwindow.h" -#include "appsettings.h" -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - - QCoreApplication::setOrganizationName("Omed"); - QCoreApplication::setOrganizationDomain("medsoft.blogspot.com/"); - QCoreApplication::setApplicationName("Maemo VLC remote"); - - QString locale = QLocale::system().name(); - QTranslator translator; - translator.load(QString(":/languages/vlcremote_") + locale); - a.installTranslator(&translator); - - QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); - - - qDebug() << AppSettings::getCurrentIp(); - - - PlayerMainWindow * mainwindow = new PlayerMainWindow; - - //mainwindow->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); - //mainwindow->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); - //mainwindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true); - - mainwindow->showMaximized(); - #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - Orientation o = AppSettings::getOrientation(); - switch (o) { - case AUTO_ROTATE: - mainwindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true); - break; - case LANDSCAPE: - mainwindow->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); - break; - case PORTRAIT: - mainwindow->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); - break; - default: - mainwindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true); - break; - } -#endif - return a.exec(); -} diff --git a/newaccountdialog.cpp b/newaccountdialog.cpp deleted file mode 100644 index 3a3acd3..0000000 --- a/newaccountdialog.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "newaccountdialog.h" -#include -#include -#include -//#include - -NewAccountDialog::NewAccountDialog(QWidget *parent) -{ - Q_UNUSED(parent); - this->setWindowTitle(tr("Add account")); - - mKeyLineEdit = new QLineEdit; - mIpLineEdit = new QLineEdit; - mPortLineEdit = new QLineEdit; - mPortLineEdit->setText("8080"); - mPortLineEdit->setReadOnly(false); - - mButtonBox = new QDialogButtonBox; - mButtonBox->addButton(QDialogButtonBox::Save); - mButtonBox->addButton(QDialogButtonBox::Cancel); - - connect(mButtonBox, SIGNAL(accepted()), this, SLOT(save())); - connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject())); - - QFormLayout *layout = new QFormLayout; - layout->expandingDirections(); - layout->addRow(tr("Name:"), mKeyLineEdit); - layout->addRow(tr("Ip:"), mIpLineEdit); - layout->addRow(tr("Port:"), mPortLineEdit); - layout->addWidget(mButtonBox); - - setLayout(layout); -} - -void NewAccountDialog::save() -{ - QString myKey = mKeyLineEdit->text(); - QString myIp = mIpLineEdit->text(); - QString myPort = mPortLineEdit->text(); - - QSettings settings; - settings.beginGroup("account"); - if (!mEditKey.isEmpty()) { - settings.remove(mEditKey); - } - - if (!myIp.isEmpty() && !myKey.isEmpty()) { - if (myPort.isEmpty()) { - myPort = "8080"; - } - settings.setValue(myKey, myIp+":"+myPort); - // Rajouter des tests pour vérifier qu'on est sur Maemo - //QMaemo5InformationBox::information(this, tr("Account saved"), QMaemo5InformationBox::DefaultTimeout); - } - settings.endGroup(); - - emit accept(); -} - -void NewAccountDialog::edit(QString &key, QString &ip) -{ - Q_UNUSED(ip); - this->setWindowTitle(tr("Edit account")); - - QSettings settings; - settings.beginGroup("account"); - QString value = settings.value(key).toString(); - settings.endGroup(); - - QStringList values = value.split(":"); - - mEditKey = key; - mEditIp = values.first(); - mEditPort = values.last(); - - mKeyLineEdit->setText(mEditKey); - mKeyLineEdit->setDisabled(true); - mIpLineEdit->setText(mEditIp); - mPortLineEdit->setText(mEditPort); -} - diff --git a/newaccountdialog.h b/newaccountdialog.h deleted file mode 100644 index 70794ab..0000000 --- a/newaccountdialog.h +++ /dev/null @@ -1,50 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 NEWACCOUNTDIALOG_H -#define NEWACCOUNTDIALOG_H - -#include -#include -#include -#include - -class NewAccountDialog : public QDialog -{ - Q_OBJECT - -public: - explicit NewAccountDialog(QWidget *parent = 0); - void edit(QString &key, QString &ip); - -public slots: - void save(); - -private: - QLineEdit *mKeyLineEdit; - QLineEdit *mIpLineEdit; - QLineEdit *mPortLineEdit; - QPushButton *mSavePushButton; - QPushButton *mCancelPushButton; - QDialogButtonBox *mButtonBox; - - QString mEditKey; - QString mEditIp; - QString mEditPort; -}; - -#endif // NEWACCOUNTDIALOG_H diff --git a/playermainwindow.cpp b/playermainwindow.cpp deleted file mode 100644 index 33d001c..0000000 --- a/playermainwindow.cpp +++ /dev/null @@ -1,511 +0,0 @@ - /* VLC-REMOTE for MAEMO 5 - * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave - * 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 - #include - #include - #include "playermainwindow.h" - #include "ui_playermainwindow.h" - #include "configdialog.h" - #include "aboutdialog.h" - #include "accountdialog.h" - #include "appsettings.h" - //#include "vlcstatus.h" - - PlayerMainWindow::PlayerMainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::PlayerMainWindow) - { - ui->setupUi(this); - setWindowTitle("Vlc remote"); - - - - mTimer = new QTimer(this); - mNetManager = new QNetworkAccessManager(this); - mPlayListMainWindow = new PlayListMainWindow; - mBrowserMainWindow = new BrowseMainWindow; - - mVolume = 100; - mMuted = false; - - mIsLandscape = true; - - ui->playlistButton->setIcon(QIcon::fromTheme("notes_bullets")); - ui->browseButton->setIcon(QIcon::fromTheme("filemanager_media_folder")); - - ui->previousButton->setIcon(QIcon::fromTheme("pdf_viewer_first_page")); - ui->nextButton->setIcon(QIcon::fromTheme("pdf_viewer_last_page")); - ui->playpauseButton->setIcon(QIcon::fromTheme("camera_playback")); - ui->stopButton->setIcon(QIcon::fromTheme("camera_video_stop")); - //ui->pauseButton->setIcon(QIcon::fromTheme("camera_video_pause")); - ui->fullscreenButton->setIcon(QIcon::fromTheme("general_fullsize")); - ui->volDown->setIcon(QIcon::fromTheme("statusarea_volumelevel1")); - ui->volUp->setIcon(QIcon::fromTheme("statusarea_volumelevel4")); - ui->volMute->setIcon(QIcon::fromTheme("statusarea_volume_mute")); - - ui->labelArtPortrait->setVisible(false); - ui->labelArtLandscape->setVisible(false); - - ui->labelTitle->setTextFormat(Qt::RichText); - ui->labelArtist->setTextFormat(Qt::RichText); - ui->labelAlbum->setTextFormat(Qt::RichText); - - - #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - - mPlayListMainWindow->setParent(this); - mPlayListMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); - setAttribute(Qt::WA_Maemo5StackedWindow, true); - mPlayListMainWindow->setWindowFlags(mPlayListMainWindow->windowFlags() | Qt::Window); - - mBrowserMainWindow->setParent(this); - mBrowserMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); - setAttribute(Qt::WA_Maemo5StackedWindow, true); - mBrowserMainWindow->setWindowFlags(mBrowserMainWindow->windowFlags() | Qt::Window); - - connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged())); - - #endif - - connect(mTimer,SIGNAL(timeout()),this,SLOT(askStatus())); - connect(ui->actionConfiguration,SIGNAL(triggered()),this,SLOT(showConfig())); - connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout())); - connect(ui->actionPortrait,SIGNAL(triggered()),this,SLOT(setPortrait())); - connect(ui->actionLandscape,SIGNAL(triggered()),this,SLOT(setLandscape())); - connect(ui->actionAutoRotate,SIGNAL(triggered()),this,SLOT(setAutoRotate())); - connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(show())); - connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(showPlayList())); - connect(ui->browseButton,SIGNAL(clicked()),mBrowserMainWindow,SLOT(show())); - connect(ui->browseButton,SIGNAL(clicked()),mBrowserMainWindow,SLOT(showCurrentDirectory())); - - connect(ui->playpauseButton,SIGNAL(clicked()),this,SLOT(playpause())); - connect(ui->stopButton,SIGNAL(clicked()),this,SLOT(stop())); - connect(ui->previousButton,SIGNAL(clicked()),this,SLOT(previous())); - connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(next())); - connect(ui->fullscreenButton,SIGNAL(clicked()),this,SLOT(fullscreen())); - connect(ui->volUp,SIGNAL(clicked()),this,SLOT(volUp())); - connect(ui->volDown,SIGNAL(clicked()),this,SLOT(volDown())); - connect(ui->volMute,SIGNAL(clicked()),this,SLOT(volMute())); - connect(ui->slider,SIGNAL(sliderMoved(int)),this,SLOT(slide(int))); - - connect(mPlayListMainWindow, SIGNAL(idUpdated(int,bool,QString)), this, SLOT(playlistIdUpdated(int, bool, QString))); - - - // check if last used connection is still valid or showConfig - QSettings settings; - QString last_ip = AccountDialog::currentIp(); - if (!last_ip.isNull() && !last_ip.isEmpty()) { - QTcpSocket * socket = new QTcpSocket; - if(last_ip.contains(":")) - { - QStringList hostSplit = last_ip.split(":"); - QString ip = hostSplit.at(0); - QString port = hostSplit.at(1); - socket->connectToHost(ip,port.toInt()); - } - else { - socket->connectToHost(last_ip,8080); - } - if (!socket->waitForConnected(1000)) { - showConfig(); - } - else { - mIp= last_ip; - - mPlayListMainWindow->init(); - mBrowserMainWindow->init(); - mTimer->start(5000); - askStatus(); - } - delete socket; - } - else { - showConfig(); - } - - - } - - - PlayerMainWindow::~PlayerMainWindow() - { - delete ui; - } - - void PlayerMainWindow::changeEvent(QEvent *e) - { - QMainWindow::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } - } - - void PlayerMainWindow::setPortrait() - { - #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - AppSettings::setOrientation(PORTRAIT); - this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); - #endif - } - - void PlayerMainWindow::setLandscape() - { - #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - AppSettings::setOrientation(LANDSCAPE); - this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); - #endif - } - - void PlayerMainWindow::setAutoRotate() - { - #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - AppSettings::setOrientation(AUTO_ROTATE); - this->setAttribute(Qt::WA_Maemo5AutoOrientation, true); - #endif - } - - void PlayerMainWindow::orientationChanged() { - QRect screenGeometry = QApplication::desktop()->screenGeometry(); - mIsLandscape = (screenGeometry.width() > screenGeometry.height()); - if (mHasImage) { - if (mIsLandscape) { - ui->labelArtPortrait->setVisible(false); - ui->labelArtLandscape->setVisible(true); - } - else { - ui->labelArtLandscape->setVisible(false); - ui->labelArtPortrait->setVisible(true); - } - } - else { - ui->labelArtLandscape->setVisible(false); - ui->labelArtPortrait->setVisible(false); - } - } - - void PlayerMainWindow::playpause() - { - // NB. There is no guarentee that our current state is the real current state. - // This is due to the polling frequency and possibility of user interaction directly on the server. - // Still this is probably better than nothing and our next real poll will set us straight again. - if (PAUSED == mCurrentStatus.state) { - mCurrentStatus.state = PLAYING; - pause(); - updateUiWithCurrentStatus(); - } - else if (PLAYING == mCurrentStatus.state) { - mCurrentStatus.state = PAUSED; - pause(); - updateUiWithCurrentStatus(); - } - else { - // could be STOP or UNKNOWN, either way there is no guarentee we will enter a playing state next. - // So don't update the current state or UI - // Ideally we would try to find a way to check the current state again but this could lead to an infinite loop! - play(); - } - } - void PlayerMainWindow::play() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_play"))); - } - void PlayerMainWindow::stop() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_stop"))); - } - void PlayerMainWindow::pause() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_pause"))); - } - void PlayerMainWindow::previous() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_previous"))); - } - void PlayerMainWindow::next() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_next"))); - } - void PlayerMainWindow::fullscreen() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=fullscreen"))); - } - void PlayerMainWindow::volUp() - { - QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=volume"); - url.addEncodedQueryItem(QByteArray("val"), QByteArray("%2B10")); - mNetManager->get(QNetworkRequest(url)); - } - void PlayerMainWindow::volDown() - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val=-10"))); - } - void PlayerMainWindow::volMute() - { - this->mMuted = !this->mMuted; - if (this->mMuted) { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val=0"))); - } - else { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val="+QString::number(this->mVolume)))); - } - } - void PlayerMainWindow::slide(int value) - { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=seek&val="+QString::number(value)+"%25"))); - } - - void PlayerMainWindow::showConfig() - { - mTimer->stop(); - AccountDialog * dialog = new AccountDialog; - dialog->exec(); - - mIp= AccountDialog::currentIp(); - - mPlayListMainWindow->init(); - mBrowserMainWindow->init(); - mTimer->start(5000); - askStatus(); - } - void PlayerMainWindow::showAbout() - { - - AboutDialog * dialog = new AboutDialog; - dialog->exec(); - - } - - void PlayerMainWindow::askStatus() - { - //qDebug() << "Status requested. at:" << QTime::currentTime().toString("hh::mm:ss"); - QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml"))); - connect(reply,SIGNAL(readyRead()),this,SLOT(parseXmlStatus())); - } - - void PlayerMainWindow::parseXmlStatus() - { - QNetworkReply * reply = qobject_cast(sender()); - QDomDocument doc; - doc.setContent(reply->readAll()); - delete reply; - QDomElement docElem = doc.documentElement(); - // Get the raw values - int volume = docElem.namedItem("volume").toElement().text().toInt(); - int length = docElem.namedItem("length").toElement().text().toInt(); - int time = docElem.namedItem("time").toElement().text().toInt(); - int position = docElem.namedItem("position").toElement().text().toInt(); - int random = docElem.namedItem("random").toElement().text().toInt(); - int loop = docElem.namedItem("loop").toElement().text().toInt(); - int repeat = docElem.namedItem("repeat").toElement().text().toInt(); - QString state = docElem.namedItem("state").toElement().text(); - QDomNode infoNode = docElem.namedItem("information"); - QDomNode metaInfoNode = infoNode.namedItem("meta-information"); - QString title = metaInfoNode.namedItem("title").toElement().text().replace("\\\\", "\\"); - // if it's a file style title fix it up - if (40 < title.length()) { - if (0 < title.lastIndexOf("\\")) { - title = title.right(title.length() - (title.lastIndexOf("\\") + 1)); - } - else if (0 < title.lastIndexOf("/")) { - title = title.right(title.length() - (title.lastIndexOf("/") + 1)); - } - } - QString artist = metaInfoNode.namedItem("artist").toElement().text(); - QString album = metaInfoNode.namedItem("album").toElement().text(); - QString now_playing = metaInfoNode.namedItem("now_playing").toElement().text(); - QString art_url = metaInfoNode.namedItem("art_url").toElement().text(); - //metaInfoNode.clear(); - //infoNode.clear(); - //docElem.clear(); - //doc.clear(); - // Populate the current status structure - // now would be a good time to work out if we are a new track / file or not. - // key if we are going to look for album art later - // for now we check length and title this will require further examination later - mCurrentStatus.newtrack = true; - if (mCurrentStatus.length == length && !mCurrentStatus.title.isNull() && 0 == QString::compare(mCurrentStatus.title, title)) { - mCurrentStatus.newtrack = false; - } - mCurrentStatus.volume = volume; - mCurrentStatus.length = length; - mCurrentStatus.time = time; - mCurrentStatus.position = position; - mCurrentStatus.random = (1 == random); - mCurrentStatus.loop = (1 == loop); - mCurrentStatus.repeat = (1 == repeat); - mCurrentStatus.title = title; - mCurrentStatus.artist = artist; - mCurrentStatus.album = album; - mCurrentStatus.nowplaying = now_playing; - mCurrentStatus.hasart = (!art_url.isNull() && !art_url.isEmpty()); - if (!state.isNull() && !state.isEmpty()) { - if (0 == QString::compare("playing", state, Qt::CaseInsensitive)) { - mCurrentStatus.state = PLAYING; - } - else if (0 == QString::compare("paused", state, Qt::CaseInsensitive)) { - mCurrentStatus.state = PAUSED; - } - else if (0 == QString::compare("stop", state, Qt::CaseInsensitive)) { - mCurrentStatus.state = STOP; - } - else { - mCurrentStatus.state = UNKNOWN; - } - } - else { - mCurrentStatus.state = UNKNOWN; - } - // What's our mute status? - if (0 < mCurrentStatus.volume) { - this->mVolume = mCurrentStatus.volume; - this->mMuted = false; - } - else { - this->mMuted = true; - } - // Update the UI - updateUiWithCurrentStatus(); - - } - - void PlayerMainWindow::updateUiWithCurrentStatus() { - // position - QTime timePosition(0,0,0) ; - timePosition = timePosition.addSecs(mCurrentStatus.time); - - ui->timeLabel->setText(timePosition.toString("h:mm:ss")); - - // duration - if (0 < mCurrentStatus.length) { - QTime timeDuration(0,0,0) ; - timeDuration = timeDuration.addSecs(mCurrentStatus.length); - - ui->durationLabel->setText(timeDuration.toString("h:mm:ss")); - } - else { - ui->durationLabel->setText("0:00:00"); - } - - - if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100) { - ui->slider->blockSignals(true); - ui->slider->setValue(mCurrentStatus.position); - ui->slider->blockSignals(false); - } - - ui->labelTitle->setText(mCurrentStatus.title); - ui->labelArtist->setText(mCurrentStatus.artist); - ui->labelAlbum->setText(mCurrentStatus.album); - - if (PLAYING == mCurrentStatus.state) { - ui->playpauseButton->setIcon(QIcon::fromTheme("camera_video_pause")); - } - else { - ui->playpauseButton->setIcon(QIcon::fromTheme("camera_playback")); - } - - if (mCurrentStatus.newtrack) { - // potential actions: - // rebuild display layout - // retrieve album art - mHasImage = false; - QTimer::singleShot(500, mPlayListMainWindow, SLOT(requestPlayList())); - } - // Update the buttons on the playlist window - if (NULL != this->mPlayListMainWindow) { - this->mPlayListMainWindow->updateUiWithCurrentStatus(& mCurrentStatus); - } - - } - void PlayerMainWindow::playlistIdUpdated(int id, bool hasart, QString extension) { - Q_UNUSED(extension); - if (hasart) { - getCoverArt(id); - } - else { - ui->labelArtLandscape->setVisible(false); - ui->labelArtPortrait->setVisible(false); - // could use a default graphic from extension here! - // setCoverArtFromPixmap(); - } - } - void PlayerMainWindow::error(QNetworkReply::NetworkError code) { - qDebug() << "Error Code: " << code; - } - void PlayerMainWindow::readReady() { - QNetworkReply * reply = qobject_cast(sender()); - // append to buffer - mResponse += reply->readAll(); - } - void PlayerMainWindow::finished(QNetworkReply * reply) { - // now we can call setCoverArt to process the full buffers - this->setCoverArt(mResponse); - // only interested in finished signals - disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); - delete reply; - } - void PlayerMainWindow::getCoverArt(int id) { - qDebug() << "getCoverArt id=!" << id; - mResponse.clear(); - QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/art?id=" + QString::number(id)))); - connect(reply,SIGNAL(readyRead()),this,SLOT(readReady())); - connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); - connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); - - } - void PlayerMainWindow::setCoverArt(const QByteArray data) { - QPixmap* image = new QPixmap(); - if (image->loadFromData(data)) { - mHasImage = true; - ui->labelArtLandscape->setPixmap(image->scaledToHeight(120, Qt::SmoothTransformation)); - ui->labelArtPortrait->setPixmap(image->scaledToHeight(310, Qt::SmoothTransformation)); - if (mIsLandscape) { - ui->labelArtPortrait->setVisible(false); - ui->labelArtLandscape->setVisible(true); - } - else { - ui->labelArtLandscape->setVisible(false); - ui->labelArtPortrait->setVisible(true); - } - } - else { - qDebug() << "image load failed!"; - qDebug() << "data.length" << data.length(); - ui->labelArtPortrait->setVisible(false); - ui->labelArtLandscape->setVisible(false); - } - delete image; - } - void PlayerMainWindow::setCoverArtFromPixmap(QPixmap image) { - mHasImage = true; - ui->labelArtLandscape->setPixmap(image.scaledToHeight(120, Qt::SmoothTransformation)); - ui->labelArtPortrait->setPixmap(image.scaledToHeight(320, Qt::SmoothTransformation)); - if (mIsLandscape) { - ui->labelArtPortrait->setVisible(false); - ui->labelArtLandscape->setVisible(true); - } - else { - ui->labelArtLandscape->setVisible(false); - ui->labelArtPortrait->setVisible(true); - } - } - diff --git a/playermainwindow.h b/playermainwindow.h deleted file mode 100644 index 73c22b2..0000000 --- a/playermainwindow.h +++ /dev/null @@ -1,90 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 PLAYERMAINWINDOW_H -#define PLAYERMAINWINDOW_H - -#include -#include -#include -#include -#include "playlistmainwindow.h" -#include "browsemainwindow.h" -#include "vlcstatus.h" - -namespace Ui { - class PlayerMainWindow; -} - -class PlayerMainWindow : public QMainWindow { - Q_OBJECT -public: - explicit PlayerMainWindow(QWidget *parent = 0); - ~PlayerMainWindow(); - -public slots: - void askStatus(); - void showConfig(); - void showAbout(); - void play(); - void playpause(); - void stop(); - void pause(); - void previous(); - void next(); - void fullscreen(); - void volUp(); - void volDown(); - void volMute(); - void slide(int value); - void updateUiWithCurrentStatus(); - void setCoverArt(const QByteArray data); - void setCoverArtFromPixmap(QPixmap image); - void getCoverArt(int id); - void finished(QNetworkReply * reply); - void error(QNetworkReply::NetworkError code); - void readReady(); - void orientationChanged(); - void setPortrait(); - void setLandscape(); - void setAutoRotate(); - void playlistIdUpdated(int id, bool hasart, QString extension); - - -protected slots: - void parseXmlStatus(); -protected: - void changeEvent(QEvent *e); - - -private: - Ui::PlayerMainWindow *ui; - PlayListMainWindow * mPlayListMainWindow; - BrowseMainWindow * mBrowserMainWindow; - QNetworkAccessManager * mNetManager; - QString mIp; - QTimer * mTimer; - int mVolume; - int mMuted; - VlcStatus mCurrentStatus; - QByteArray mResponse; - bool mIsLandscape; - bool mHasImage; - -}; - -#endif // PLAYERMAINWINDOW_H diff --git a/playermainwindow.ui b/playermainwindow.ui deleted file mode 100644 index a9d9065..0000000 --- a/playermainwindow.ui +++ /dev/null @@ -1,320 +0,0 @@ - - - PlayerMainWindow - - - - 0 - 0 - 796 - 631 - - - - Vlc-Remote - - - - - - - - 380 - 350 - - - - - 380 - 350 - - - - Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - 0 - 30 - - - - Information - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 30 - - - - Information - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 30 - - - - Information - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - 140 - 140 - - - - - 140 - 140 - - - - Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Vertical - - - - 20 - 100 - - - - - - - - - - color: rgb(201, 201, 201); - - - - - - - - - - color: rgb(201, 201, 201); - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - true - - - 100 - - - Qt::Horizontal - - - - - - - - - < - - - - - - - Play/Pause - - - - - - - > - - - - - - - Stop - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - FS - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - V+ - - - - - - - V- - - - - - - - Mute - - - - - - - - - - - PlayList - - - - - - - Browse - - - - - - - - - - - 0 - 0 - 796 - 20 - - - - - menu - - - - - - - - - - - - Configuration - - - - - About - - - - - Portrait Mode - - - - - Landscape Mode - - - - - Auto Rotate - - - - - - diff --git a/playlistmainwindow.cpp b/playlistmainwindow.cpp deleted file mode 100644 index a6c8a5c..0000000 --- a/playlistmainwindow.cpp +++ /dev/null @@ -1,411 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 - * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave - * 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 "playlistmainwindow.h" -#include "ui_playlistmainwindow.h" -#include -#include -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) -#include -#endif -#include "configdialog.h" -#include "aboutdialog.h" -#include "appsettings.h" -//#include "vlcstatus.h" - -PlayListMainWindow::PlayListMainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::PlayListMainWindow) -{ - - ui->setupUi(this); - mTimer = new QTimer(this); - setWindowTitle("Vlc remote"); - - mCurrentDepth = 0; - mCurrentVlcIndex = 0; - - - mNetManager = new QNetworkAccessManager(this); - - mContents = new QList(); - - ui->listWidget->setTextElideMode(Qt::ElideLeft); - ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - - ui->playButton->setIcon(QIcon::fromTheme("camera_playback")); - ui->clearButton->setIcon(QIcon::fromTheme("general_delete")); - ui->shuffleButton->setIcon(QIcon::fromTheme("mediaplayer_default_shuffle")); - ui->loopButton->setIcon(QIcon::fromTheme("general_refresh")); - ui->repeatButton->setIcon(QIcon::fromTheme("general_redo")); - ui->removeButton->setIcon(QIcon::fromTheme("general_close")); - - ui->clearButton->setDisabled(false); - ui->shuffleButton->setDisabled(false); - ui->loopButton->setDisabled(false); - ui->repeatButton->setDisabled(false); - ui->removeButton->setDisabled(true); - ui->playButton->setDisabled(true); - - connect(ui->playButton,SIGNAL(clicked()),this,SLOT(onPlay())); - connect(ui->removeButton,SIGNAL(clicked()),this,SLOT(onRemove())); - connect(ui->repeatButton,SIGNAL(clicked()),this,SLOT(onRepeat())); - connect(ui->loopButton,SIGNAL(clicked()),this,SLOT(onLoop())); - connect(ui->shuffleButton,SIGNAL(clicked()),this,SLOT(onShuffle())); - connect(ui->clearButton,SIGNAL(clicked()),this,SLOT(onClear())); - connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); - - init(); - -} -void PlayListMainWindow::init() // CALL WHEN CONFIG CHANGES -{ - mIp = AppSettings::getCurrentIp(); // AccountDialog::currentIp(); -} -void PlayListMainWindow::showPlayList() // CALL WHEN SHOWN -{ - requestPlayList(); -} - -PlayListMainWindow::~PlayListMainWindow() -{ - delete ui; -} - -void PlayListMainWindow::changeEvent(QEvent *e) -{ - QMainWindow::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} - -void PlayListMainWindow::onListSelectionChanged() { - QList items = ui->listWidget->selectedItems(); - if (0 < items.count()) { - // TODO VLC doesn't seem to support removing nodes! - // Playing nodes works fine, however. - // should check to see if it is a leaf or not and disable the remove button - mCurrentVlcIndex = items.at(0)->type() - LIST_ITEM_TYPE_OFFSET; // Qt reserves types up to 1000, we use an offset beyond that for index tracking. May prove to be too hacky! - mCurrentElement = getElementFromId(mCurrentVlcIndex); - if (0 == QString::compare("node", mCurrentElement.type)) { - ui->removeButton->setDisabled(true); - ui->playButton->setDisabled(false); - } - else { - ui->removeButton->setDisabled(false); - ui->playButton->setDisabled(false); - } - } - else { - mCurrentVlcIndex = 0; - ui->removeButton->setDisabled(true); - ui->playButton->setDisabled(true); - } -} - -void PlayListMainWindow::onRemove() { - if (0 < this->mCurrentVlcIndex) { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_delete&id=" + QString::number(this->mCurrentVlcIndex)))); - //connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList())); - // don't refresh just clear the item! - delete ui->listWidget->takeItem(ui->listWidget->currentRow()); - } -} -void PlayListMainWindow::onPlay() { - if (0 < this->mCurrentVlcIndex) { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_play&id=" + QString::number(this->mCurrentVlcIndex)))); - } -} -void PlayListMainWindow::onRepeat() { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_repeat"))); -} -void PlayListMainWindow::onLoop() { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_loop"))); -} -void PlayListMainWindow::onShuffle() { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_random"))); -} -void PlayListMainWindow::onClear() { - mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_empty"))); - mContents->clear(); - ui->listWidget->clear(); - //connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList())); -} -void PlayListMainWindow::requestPlayList() { - mResponse.clear(); - ui->removeButton->setDisabled(true); - ui->playButton->setDisabled(true); -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true); -#endif - QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/playlist.xml"))); - disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList())); - connect(reply,SIGNAL(readyRead()),this,SLOT(readReady())); - connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); - connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); -} -void PlayListMainWindow::error(QNetworkReply::NetworkError code) { -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); -#endif - qDebug() << code; -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - QMaemo5InformationBox::information(this, tr("Playlist could not be retrieved."), QMaemo5InformationBox::DefaultTimeout); -#endif -} -void PlayListMainWindow::readReady() { - QNetworkReply * reply = qobject_cast(sender()); - // append to buffer - mResponse += reply->readAll(); -} -void PlayListMainWindow::finished(QNetworkReply * reply) { - // now we can call parseXmlList to process the full buffers - this->parseXmlPlayList(); - // only interested in finished signals - disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); -#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) - this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); -#endif - delete reply; -} - -void PlayListMainWindow::parseXmlPlayList() { - mContents->clear(); - QDomDocument doc; - doc.setContent(this->mResponse); - QDomElement docElem = doc.documentElement(); - QDomNodeList nodes = docElem.elementsByTagName("node"); - int depth = 0; - - int currentLeafId = 0; - bool hasArt = false; - QString extension = ""; - - int ct = nodes.count(); - for (int idx = 0; idx < ct; ++idx) { - QDomNode node = nodes.at(idx); - QString current = ""; - //QString name = node.attributes().namedItem("name").nodeValue().replace("\\\\", "\\"); - int id = node.attributes().namedItem("id").nodeValue().toInt(); - if (4 > id && 0 == QString::compare(node.attributes().namedItem("ro").nodeValue(), "ro")) { - // got the main playlist, let's build it up - if (node.hasChildNodes()) { - QDomNodeList leafs = node.childNodes(); - int leafct = leafs.count(); - if (0 < leafct) { - depth = 1; - for (int jdx = 0; jdx < leafct; ++jdx) { - QDomNode leaf = leafs.at(jdx); - parsePlayListItem(&leaf, &extension, &hasArt, ¤tLeafId, 1); - } - } - } - - } - } - - mResponse.clear(); - - emit this->idUpdated(currentLeafId, hasArt, extension); - this->updateList(); - - -} - - -int PlayListMainWindow::parsePlayListItem(QDomNode *node, QString *extension, bool *hasArt, int *currentLeafId, int depth) { - int leafCt = 0; - if (NULL != node) { - QString current; - VlcPlayListElementSimple* el = new VlcPlayListElementSimple(); - el->id = node->attributes().namedItem("id").nodeValue().toInt(); - el->path = node->attributes().namedItem("uri").nodeValue(); - el->name = node->attributes().namedItem("name").nodeValue().replace("\\\\", "\\"); - current = node->attributes().namedItem("current").nodeValue(); - el->playing = (0 < current.length()); - el->depth = depth; - if (0 != QString::compare(node->nodeName(), "node")) { - el->type = "leaf"; - el->extension = getExtension(el->path, NULL); - if (el->playing) { - *currentLeafId = el->id; - QString art = node->toElement().namedItem("art_url").toElement().text(); - *hasArt = (!art.isNull() && !art.isEmpty()); - *extension = getExtension(el->path, NULL); - } - QString title = node->toElement().namedItem("title").toElement().text(); - QString artist = node->toElement().namedItem("artist").toElement().text(); - QString album = node->toElement().namedItem("album").toElement().text(); - if (0 < artist.length() || 0 < album.length()) { - el->name = "" + title + "\n" + artist + " - " + album; - } - this->mContents->append(*el); - ++leafCt; - delete el; - } - else { - el->type = "node"; - el->extension = getExtension(el->path, NULL); - // empty nodes appear in the playlist when they can't be played! - if (node->hasChildNodes()) { - this->mContents->append(*el); - ++leafCt; - } - delete el; - // now parse the child nodes as leaf. - if (node->hasChildNodes()) { - QDomNodeList items = node->childNodes(); - int itemct = items.count(); - int added = 0; - if (0 < itemct) { - ++depth; - for (int kdx = 0; kdx < itemct; ++kdx) { - QDomNode item = items.at(kdx); - added += parsePlayListItem(&item, extension, hasArt, currentLeafId, depth); - } - if (1 > added) { - // should remove the last PlayListElement - this->mContents->removeLast(); - --leafCt; - } - else { - leafCt += added; - } - } - } - } - } - return leafCt; -} - -QString PlayListMainWindow::getExtension(QString path, QString extension) { - // return extension if exists - if (!extension.isNull() && !extension.isEmpty()) return extension; - // return blank if no path - if (path.isNull() || path.isEmpty()) return ""; - // otherwise extract the extension - int dot_pos = path.lastIndexOf('.'); - if (0 < dot_pos) { - return path.right(path.length() - (dot_pos + 1)); - } - else { // no dot - return ""; - } -} - -VlcPlayListElementSimple PlayListMainWindow::getElementFromId(int id) { - //if (0 != QString::compare("", text)) { - for (int idx = 0; idx < mContents->count(); ++idx) { - if (0 < id && (id == mContents->at(idx).id)) { - return mContents->at(idx); - } - } - //} - return *(new VlcPlayListElementSimple()); -} - -void PlayListMainWindow::updateList() { - ui->listWidget->clear(); - int ct = this->mContents->count(); - if (0 < ct) { - QIcon icon_audio = QIcon::fromTheme("general_audio_file"); - QIcon icon_video = QIcon::fromTheme("general_video_file"); - QIcon icon_image = QIcon::fromTheme("general_image"); - QIcon icon_flash = QIcon::fromTheme("filemanager_flash_file"); - QIcon icon_media = QIcon::fromTheme("filemanager_media_folder"); - QIcon icon_real = QIcon::fromTheme("filemanager_real_music"); - QIcon icon_playl = QIcon::fromTheme("filemanager_playlist"); - QIcon icon_unknown= QIcon::fromTheme("filemanager_unknown_file"); - for (int idx = 0; idx < ct; ++idx) { - VlcPlayListElementSimple el = mContents->at(idx); - QListWidgetItem* item; - if (0 == QString::compare("node", el.type)) { - item = new QListWidgetItem(icon_media, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); - } - else { - if ( 0 == QString::compare(el.extension, "jpg") || - 0 == QString::compare(el.extension, "jpeg") || - 0 == QString::compare(el.extension, "gif") || - 0 == QString::compare(el.extension, "png") || - 0 == QString::compare(el.extension, "bmp") ) { - item = new QListWidgetItem(icon_image, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .jpg, .jpeg, .gif, .png, .bmp - } - else if ( 0 == QString::compare(el.extension, "mp3") || - 0 == QString::compare(el.extension, "m4a") || - 0 == QString::compare(el.extension, "ogg") || - 0 == QString::compare(el.extension, "oga") || - 0 == QString::compare(el.extension, "wav") || - 0 == QString::compare(el.extension, "flac") ) { - item = new QListWidgetItem(icon_audio, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .mp3, .m4a, .ogg, .oga, .wav, .flac - } - else if ( 0 == QString::compare(el.extension, "m3u") || - 0 == QString::compare(el.extension, "wpl") || - 0 == QString::compare(el.extension, "pls") || - 0 == QString::compare(el.extension, "asx") || - 0 == QString::compare(el.extension, "xspf") || - 0 == QString::compare(el.extension, "cmml") ) { - item = new QListWidgetItem(icon_playl, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .m3u, .wpl, .pls, .asx, .xspf, .cmml - } - else if ( 0 == QString::compare(el.extension, "avi") || - 0 == QString::compare(el.extension, "mpeg") || - 0 == QString::compare(el.extension, "mpg") || - 0 == QString::compare(el.extension, "mov") || - 0 == QString::compare(el.extension, "mp4") || - 0 == QString::compare(el.extension, "m4v") || - 0 == QString::compare(el.extension, "wmv") || - 0 == QString::compare(el.extension, "mkv") || - 0 == QString::compare(el.extension, "ogv") ) { - item = new QListWidgetItem(icon_video, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .avi, .mpg, .mpeg, .mov, .m4v, .mp4, .wmv, .mkv, .ogv - } - else if ( 0 == QString::compare(el.extension, "rm") || - 0 == QString::compare(el.extension, "ra") || - 0 == QString::compare(el.extension, "ram") ) { - item = new QListWidgetItem(icon_real, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .ram, 'rm, 'ra - } - else if ( 0 == QString::compare(el.extension, "flv") ) { - item = new QListWidgetItem(icon_flash, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .flv - } - //else if ( 0 == QString::compare(el.extension, "") ) { - // item = new QListWidgetItem(icon_unknown, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .flv - //} - else { - if (el.name.contains("Flash")) { - item = new QListWidgetItem(icon_flash, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); - } - else { - item = new QListWidgetItem(icon_media, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); - } - } - } - item->setSelected(el.playing); - ui->listWidget->addItem(item); - if (el.playing) { - ui->listWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); - } - } - } -} -void PlayListMainWindow::updateUiWithCurrentStatus(VlcStatus * status) { - ui->loopButton->setChecked(status->loop); - ui->repeatButton->setChecked(status->repeat); - ui->shuffleButton->setChecked(status->random); -} diff --git a/playlistmainwindow.h b/playlistmainwindow.h deleted file mode 100644 index a6a444f..0000000 --- a/playlistmainwindow.h +++ /dev/null @@ -1,82 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 PLAYLISTMAINWINDOW_H -#define PLAYLISTMAINWINDOW_H - -#include -#include -#include -#include -#include "vlcplaylistelementsimple.h" -#include "vlcstatus.h" - -#ifndef LIST_ITEM_TYPE_OFFSET -#define LIST_ITEM_TYPE_OFFSET 1000 -#endif - -namespace Ui { - class PlayListMainWindow; -} - -class PlayListMainWindow : public QMainWindow { - Q_OBJECT -public: - explicit PlayListMainWindow(QWidget *parent = 0); - ~PlayListMainWindow(); - void init(); -public slots: - void onClear(); - void onShuffle(); - void onLoop(); - void onPlay(); - void onRepeat(); - void onRemove(); - void requestPlayList(); - void onListSelectionChanged(); - void finished(QNetworkReply * reply); - void readReady(); - void error(QNetworkReply::NetworkError code); - void showPlayList(); - void updateUiWithCurrentStatus(VlcStatus * status); - -protected slots: - void parseXmlPlayList(); - void updateList(); - int parsePlayListItem(QDomNode *node, QString *extension, bool *hasArt, int *currentLeafId, int depth); - -signals: - void idUpdated(int id, bool hasArt, QString extension); - -protected: - void changeEvent(QEvent *e); - VlcPlayListElementSimple getElementFromId(int id); - QString getExtension(QString path, QString extension); - -private: - Ui::PlayListMainWindow *ui; - QTimer * mTimer; - QString mIp; - QNetworkAccessManager * mNetManager; - QList* mContents; - VlcPlayListElementSimple mCurrentElement; - int mCurrentVlcIndex; - int mCurrentDepth; - QByteArray mResponse; -}; - -#endif // PLAYLISTMAINWINDOW_H diff --git a/playlistmainwindow.ui b/playlistmainwindow.ui deleted file mode 100644 index c98d800..0000000 --- a/playlistmainwindow.ui +++ /dev/null @@ -1,140 +0,0 @@ - - - PlayListMainWindow - - - - 0 - 0 - 800 - 600 - - - - Playlist - - - - - - - - not yet done - - - - - not yet done - - - - - not yet done - - - - - - - - - - Play - - - - - - - Shuffle - - - true - - - - - - - Loop - - - true - - - - - - - Repeat - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Clear all - - - - - - - Remove - - - - - - - - - - - 0 - 0 - 800 - 25 - - - - - menu - - - - - - - Portrait Mode - - - - - Landscape Mode - - - - - - diff --git a/resource.qrc b/resource.qrc deleted file mode 100644 index aeea2b6..0000000 --- a/resource.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - config-vlc.jpg - - diff --git a/ressources.qrc b/ressources.qrc deleted file mode 100644 index 0821e0c..0000000 --- a/ressources.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - vlcremote_fr_FR.qm - - diff --git a/scanipdialog.cpp b/scanipdialog.cpp deleted file mode 100644 index 4de0efe..0000000 --- a/scanipdialog.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "scanipdialog.h" -#include "ui_scanipdialog.h" - -ScanIPDialog::ScanIPDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::ScanIPDialog) -{ - ui->setupUi(this); -} - -ScanIPDialog::~ScanIPDialog() -{ - delete ui; -} - -void ScanIPDialog::changeEvent(QEvent *e) -{ - QDialog::changeEvent(e); - switch (e->type()) { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/scanipdialog.h b/scanipdialog.h deleted file mode 100644 index 0e3cdf4..0000000 --- a/scanipdialog.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SCANIPDIALOG_H -#define SCANIPDIALOG_H - -#include - -namespace Ui { - class ScanIPDialog; -} - -class ScanIPDialog : public QDialog { - Q_OBJECT -public: - explicit ScanIPDialog(QWidget *parent = 0); - ~ScanIPDialog(); - -protected: - void changeEvent(QEvent *e); - -private: - Ui::ScanIPDialog *ui; -}; - -#endif // SCANIPDIALOG_H diff --git a/scanipdialog.ui b/scanipdialog.ui deleted file mode 100644 index e5aa69a..0000000 --- a/scanipdialog.ui +++ /dev/null @@ -1,83 +0,0 @@ - - - ScanIPDialog - - - - 0 - 0 - 422 - 360 - - - - Dialog - - - - - - - - - - name - - - - - - - - - - IP - - - - - - - - - - - - - - - - - - - Scan - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Done - - - - - - - - - - diff --git a/src/AboutDialog.ui b/src/AboutDialog.ui new file mode 100644 index 0000000..2cf6ba0 --- /dev/null +++ b/src/AboutDialog.ui @@ -0,0 +1,64 @@ + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/Maemo_VLC_remote.svg b/src/Maemo_VLC_remote.svg new file mode 100644 index 0000000..83ad807 --- /dev/null +++ b/src/Maemo_VLC_remote.svg @@ -0,0 +1,453 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp new file mode 100644 index 0000000..e1606ea --- /dev/null +++ b/src/aboutdialog.cpp @@ -0,0 +1,43 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "aboutdialog.h" +#include "ui_aboutdialog.h" + +AboutDialog::AboutDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::AboutDialog) +{ + ui->setupUi(this); +} + +AboutDialog::~AboutDialog() +{ + delete ui; +} + +void AboutDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/aboutdialog.h b/src/aboutdialog.h new file mode 100644 index 0000000..c92ce70 --- /dev/null +++ b/src/aboutdialog.h @@ -0,0 +1,40 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 ABOUTDIALOG_H +#define ABOUTDIALOG_H + +#include + +namespace Ui { + class AboutDialog; +} + +class AboutDialog : public QDialog { + Q_OBJECT +public: + explicit AboutDialog(QWidget *parent = 0); + ~AboutDialog(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::AboutDialog *ui; +}; + +#endif // ABOUTDIALOG_H diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui new file mode 100644 index 0000000..ad5fdd1 --- /dev/null +++ b/src/aboutdialog.ui @@ -0,0 +1,81 @@ + + + AboutDialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OMed </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application by Sacha schutz </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">istdasklar@gmail.com</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">http://omedsoft.blogspot.com/</span></a></p></td></tr></table></body></html> + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/accountdialog.cpp b/src/accountdialog.cpp new file mode 100644 index 0000000..ecdb02f --- /dev/null +++ b/src/accountdialog.cpp @@ -0,0 +1,210 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "accountdialog.h" +#include "ui_accountdialog.h" +#include "newaccountdialog.h" +#include +#include +#include +#include +#include +#include + + + +QListWidgetItem asyncTestItem(const QListWidgetItem &item) +{ + + QListWidgetItem item2= item; + item2.setText("boby"); + + return item; + +} + + + + +AccountDialog::AccountDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::AccountDialog) +{ + ui->setupUi(this); + + mFuturWatcher = new QFutureWatcher(this); + connect(mFuturWatcher,SIGNAL(resultReadyAt(int)),this,SLOT(setAsyncItem(int))); + + connect(ui->addButton,SIGNAL(clicked()),this,SLOT(add())); + connect(ui->editButton,SIGNAL(clicked()),this,SLOT(edit())); + connect(ui->remButton,SIGNAL(clicked()),this,SLOT(rem())); + connect(ui->useButton,SIGNAL(clicked()),this,SLOT(use())); + connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(enableUi())); + + load(); + +} + +AccountDialog::~AccountDialog() +{ + delete ui; +} + +void AccountDialog::add() +{ + + NewAccountDialog *dialog = new NewAccountDialog(this); + dialog->exec(); + load(); +} +QString AccountDialog::currentIp() +{ + + QSettings settings; + QString useKey = settings.value("config/currentKey").toString(); + QString useIp ; + if ( !useKey.isEmpty()) + useIp = settings.value("account/"+useKey).toString(); + + else return QString(); + + return useIp; +} + +void AccountDialog::load() +{ + ui->editButton->setEnabled(false); + ui->remButton->setEnabled(false); + ui->useButton->setEnabled(false); + ui->listWidget->clear(); // tjr effacer , sinon on rajoute + + QSettings settings; + + QString useKey = settings.value("config/currentKey").toString(); + + QList asycItems; + + settings.beginGroup("account"); + foreach ( QString key, settings.allKeys()) + { + QListWidgetItem * item = new QListWidgetItem; + + item->setText(key); + item->setData(Qt::UserRole, settings.value(key)); + if (useKey == key) { + QFont font = item->font(); + font.setBold(true); + item->setFont(font); + } + ui->listWidget->addItem(item); + asycItems.append(*item); + } + settings.endGroup(); + + + // ... create and add in the list widget + + // QFuture itemFutur = QtConcurrent::mapped(asycItems, asyncTestItem); + + + mFuturWatcher->setFuture(QtConcurrent::mapped(asycItems, asyncTestItem)); +} + +QListWidgetItem AccountDialog::asyncTestItem(const QListWidgetItem& item) +{ + //==========> NEED TO USE POINTER TO AVOID setAsyncItem! But I don't know how;.. + QListWidgetItem newItem = item; + + QTcpSocket * socket = new QTcpSocket; + QSettings settings; + QString host = settings.value("account/"+item.text()).toString(); + + if(host.contains(":")) + { + QStringList hostSplit = host.split(":"); + QString ip = hostSplit.at(0); + QString port = hostSplit.at(1); + socket->connectToHost(ip,port.toInt()); + } + + else + socket->connectToHost(host,8080); + + if (socket->waitForConnected(1000)) + newItem.setIcon(QIcon::fromTheme("widgets_tickmark_list")); + else + newItem.setIcon(QIcon::fromTheme("statusarea_presence_busy_error")); + + return newItem; + + +} + + + +void AccountDialog::setAsyncItem(int row) // EDIT THE ROW AFTER ASYNC FUNCTION FINISHED +{ + QListWidgetItem newItem = mFuturWatcher->resultAt(row); + QListWidgetItem * item = ui->listWidget->item(row); + + item->setIcon(newItem.icon()); + + + +} + + + +void AccountDialog::edit() +{ + QString currentIp = ui->listWidget->currentItem()->data(Qt::UserRole).toString(); + QString currentKey = ui->listWidget->currentItem()->text(); + + NewAccountDialog *dialog = new NewAccountDialog(this); + dialog->edit(currentKey, currentIp); + dialog->exec(); + + load(); +} + +void AccountDialog::rem() +{ + QString key = ui->listWidget->currentItem()->text(); + + QSettings settings; + settings.beginGroup("account"); + settings.remove(key); + settings.endGroup(); + + load(); // On recharge les compte +} + +void AccountDialog::use() +{ + QString currentKey = ui->listWidget->currentItem()->text(); + QSettings settings; + settings.setValue("config/currentKey", currentKey); + load(); + emit accept(); +} + +void AccountDialog::enableUi() +{ + ui->editButton->setEnabled(true); + ui->remButton->setEnabled(true); + ui->useButton->setEnabled(true); +} diff --git a/src/accountdialog.h b/src/accountdialog.h new file mode 100644 index 0000000..e9468dd --- /dev/null +++ b/src/accountdialog.h @@ -0,0 +1,53 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 ACCOUNTDIALOG_H +#define ACCOUNTDIALOG_H + +#include +#include +#include +namespace Ui { + class AccountDialog; +} + +class AccountDialog : public QDialog +{ + Q_OBJECT + +public: + explicit AccountDialog(QWidget *parent = 0); + ~AccountDialog(); + static QListWidgetItem asyncTestItem(const QListWidgetItem& item); + + +static QString currentIp(); + +public slots: + void add(); + void edit(); + void rem(); + void use(); + void load(); + void enableUi(); + void setAsyncItem(int row); +private: + Ui::AccountDialog *ui; + QFutureWatcher * mFuturWatcher; +}; + +#endif // ACCOUNTDIALOG_H diff --git a/src/accountdialog.ui b/src/accountdialog.ui new file mode 100644 index 0000000..8b0dd97 --- /dev/null +++ b/src/accountdialog.ui @@ -0,0 +1,87 @@ + + + AccountDialog + + + + 0 + 0 + 400 + 300 + + + + Accounts + + + + + + + test + + + + + + + + + + Add + + + + + + + false + + + Edit + + + + + + + false + + + Remove + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + false + + + Use + + + + + + + + + + diff --git a/src/accountnewdialog.ui b/src/accountnewdialog.ui new file mode 100644 index 0000000..0ac856e --- /dev/null +++ b/src/accountnewdialog.ui @@ -0,0 +1,67 @@ + + Dialog + + + + 0 + 0 + 320 + 240 + + + + Dialog + + + + + 10 + 200 + 301 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/appsettings.cpp b/src/appsettings.cpp new file mode 100644 index 0000000..babef8c --- /dev/null +++ b/src/appsettings.cpp @@ -0,0 +1,90 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 +#include "appsettings.h" + +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* AppSettings::getFavourites() { + QSettings sets; + QList * favourites = new QList(); + + sets.beginGroup("config/accounts/" + getCurrentKey() + "/favourites"); + foreach ( QString key, sets.allKeys()) + { + VlcDirectory dir; + // key is name + dir.name = key; + // value is path + dir.path = sets.value(key, "~/").toString(); + favourites->append(dir); + } + sets.endGroup(); + return favourites; +} +bool AppSettings::addFavourite(VlcDirectory dir) { + QSettings sets; + // should check for existing first otherwise it overwrites + if (0 < sets.value("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name, "").toString().length()) { + dir.name = "_" + dir.name; + return addFavourite(dir); + } + sets.setValue("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name, dir.path); + return true; +} +bool AppSettings::deleteFavourite(VlcDirectory dir) { + QSettings sets; + sets.remove("config/accounts/" + getCurrentKey() + "/favourites/" + dir.name); + return true; +} +Orientation AppSettings::setOrientation(Orientation orientation) { + QSettings sets; + sets.setValue("config/orientation", (int)orientation); + return orientation; +} +Orientation AppSettings::getOrientation() { + QSettings sets; + return (Orientation)(sets.value("config/orientation", AUTO_ROTATE).toInt()); +} + diff --git a/src/appsettings.h b/src/appsettings.h new file mode 100644 index 0000000..407b5a2 --- /dev/null +++ b/src/appsettings.h @@ -0,0 +1,49 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 + +struct VlcDirectory { + QString name; + QString path; +}; +enum Orientation { + AUTO_ROTATE = 0, + LANDSCAPE, + PORTRAIT +}; + +class AppSettings { +public: + explicit AppSettings(); + ~AppSettings(); + static QString getCurrentKey(); + static QString getCurrentIp(); + static VlcDirectory getHomeDirectory(); + static QList* getFavourites(); + static bool addFavourite(VlcDirectory dir); + static bool deleteFavourite(VlcDirectory dir); + static bool setHomeDirectory(VlcDirectory dir); + static Orientation setOrientation(Orientation orientation); + static Orientation getOrientation(); +//private: + //static QSettings settings; +}; + +#endif // APPSETTINGS_H diff --git a/src/browsemainwindow.cpp b/src/browsemainwindow.cpp new file mode 100644 index 0000000..a07b131 --- /dev/null +++ b/src/browsemainwindow.cpp @@ -0,0 +1,427 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "browsemainwindow.h" +#include "ui_browsemainwindow.h" +#include +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) +#include +#endif +#include "configdialog.h" +#include "aboutdialog.h" +#include "vlcbrowseelement.h" +#include "appsettings.h" +#include "favouritesmainwindow.h" + +BrowseMainWindow::BrowseMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::BrowseMainWindow) +{ + + ui->setupUi(this); + mFavouritesMainWindow = new FavouritesMainWindow; + mCurrentDir = "~/"; //AppSettings::getHomeDirectory().path; // This works on win as well as linux, would guess mac too. + setWindowTitle("Vlc remote"); + + + mNetManager = new QNetworkAccessManager(this); + + mContents = new QList(); + + ui->listWidget->setTextElideMode(Qt::ElideMiddle); + ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + ui->playButton->setIcon(QIcon::fromTheme("camera_playback")); + ui->addButton->setIcon(QIcon::fromTheme("general_add")); + ui->browseButton->setIcon(QIcon::fromTheme("filemanager_media_folder")); + ui->browseButton->setDisabled(true); + ui->playButton->setDisabled(true); + ui->addButton->setDisabled(true); + + +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + + mFavouritesMainWindow->setParent(this); + mFavouritesMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); + setAttribute(Qt::WA_Maemo5StackedWindow, true); + mFavouritesMainWindow->setWindowFlags(mFavouritesMainWindow->windowFlags() | Qt::Window); + +#endif + + connect(ui->browseButton,SIGNAL(clicked()),this,SLOT(onBrowse())); + connect(ui->addButton,SIGNAL(clicked()),this,SLOT(onAddToPlaylist())); + connect(ui->playButton,SIGNAL(clicked()),this,SLOT(onPlay())); + connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); + + connect(ui->actionGoUserHome, SIGNAL(triggered()), this, SLOT(showUserHomeFolder())); + 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())); + + connect(this->mFavouritesMainWindow, SIGNAL(browseDirectory(QString)), this, SLOT(browseDirectory(QString))); + + init(); + + +} +void BrowseMainWindow::init() // THIS METHOD IS CALLED WHEN CONFIG CHANGED... +{ + mIp = AppSettings::getCurrentIp(); // AccountDialog::currentIp(); + setHomeDirectory(); +} +void BrowseMainWindow::setHomeDirectory() +{ + mCurrentDir = AppSettings::getHomeDirectory().path; +} +void BrowseMainWindow::showCurrentDirectory() // THIS METHOD IS CALLED WHEN WINDOW IS OPENED... +{ + browseDirectory(mCurrentDir); +} + +BrowseMainWindow::~BrowseMainWindow() +{ + delete ui; +} + +void BrowseMainWindow::changeEvent(QEvent *e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void BrowseMainWindow::showHomeFolder() { + browseDirectory(AppSettings::getHomeDirectory().path); +} +void BrowseMainWindow::showUserHomeFolder() { + browseDirectory("~/"); +} +void BrowseMainWindow::setHomeFolder() { + if (0 < mCurrentElement.name.length() && (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type))) { + VlcDirectory dir; + dir.name = mCurrentElement.name; + dir.path = mCurrentElement.path; + AppSettings::setHomeDirectory(dir); + } + else if (0 < mCurrentDir.length()) { + VlcDirectory dir; + QString name = mCurrentDir; + int idx = mCurrentDir.lastIndexOf('/'); + if (0 > idx) idx = mCurrentDir.lastIndexOf('\\'); + if (0 < idx) { + name = mCurrentDir.right(mCurrentDir.length() - (idx + 1)); + } + dir.name = name; + dir.path = mCurrentDir; + AppSettings::setHomeDirectory(dir); + } +} +void BrowseMainWindow::showFavourites() { + mFavouritesMainWindow->show(); + mFavouritesMainWindow->init(); +} +void BrowseMainWindow::setFavourite() { + if (0 < mCurrentElement.name.length() && (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type))) { + VlcDirectory dir; + dir.name = mCurrentElement.name; + dir.path = mCurrentElement.path; + AppSettings::addFavourite(dir); + } + else if (0 < mCurrentDir.length()) { + VlcDirectory dir; + QString name = mCurrentDir; + int idx = mCurrentDir.lastIndexOf('/'); + if (0 > idx) idx = mCurrentDir.lastIndexOf('\\'); + if (0 < idx) { + name = mCurrentDir.right(mCurrentDir.length() - (idx + 1)); + } + dir.name = name; + dir.path = mCurrentDir; + AppSettings::addFavourite(dir); + } +} + +void BrowseMainWindow::onListSelectionChanged() { + QList items = ui->listWidget->selectedItems(); + if (0 < items.count()) { + mCurrentElement = getElementFromText(items.at(0)->text()); + // are we up dir? + if (0 == QString::compare("..", mCurrentElement.name)) { + ui->browseButton->setDisabled(true); + ui->playButton->setDisabled(true); + ui->addButton->setDisabled(true); + mCurrentDir = mCurrentElement.path; + browseDirectory(mCurrentDir); + } + else { + // can we browse? + if (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type)) { + ui->browseButton->setDisabled(false); + } + else { + ui->browseButton->setDisabled(true); + } + // can we play? + ui->playButton->setDisabled(false); + // can we playlist? + ui->addButton->setDisabled(false); + } + } +} + +VlcBrowseElement BrowseMainWindow::getElementFromText(QString text) { + for (int idx = 0; idx < mContents->count(); ++idx) { + if (0 == QString::compare(text, mContents->at(idx).name)) { + return mContents->at(idx); + } + } + return *(new VlcBrowseElement()); +} + +void BrowseMainWindow::onBrowse() { + // check for directory + if (0 == QString::compare("directory", mCurrentElement.type) || 0 == QString::compare("dir", mCurrentElement.type)) { + // call browseDirectory + mCurrentDir = mCurrentElement.path; + browseDirectory(mCurrentDir); + } + else { + ui->browseButton->setDisabled(true); + } +} + +void BrowseMainWindow::onAddToPlaylist() { + QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=in_enqueue"); + url.addEncodedQueryItem(QByteArray("input"), QUrl::toPercentEncoding(mCurrentElement.path.replace("\\", "\\\\").replace("'", "\\'"))); + mNetManager->get(QNetworkRequest(url)); + //mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=in_enqueue&input=" + mCurrentElement.path.replace("\\", "\\\\")))); +} + +void BrowseMainWindow::onPlay() { + QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=in_play"); + url.addEncodedQueryItem(QByteArray("input"), QUrl::toPercentEncoding(mCurrentElement.path.replace("\\", "\\\\").replace("'", "\\'"))); + mNetManager->get(QNetworkRequest(url)); + //mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=in_play&input=" + mCurrentElement.path.replace("\\", "\\\\")))); +} + +void BrowseMainWindow::browseDirectory(QString dir) { + if (mFavouritesMainWindow) { + setParent(this->parentWidget()); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + setAttribute(Qt::WA_Maemo5StackedWindow, true); +#endif + mFavouritesMainWindow->hide(); + } + mResponse.clear(); + QUrl url = QUrl("http://"+mIp+"/requests/browse.xml"); + url.addEncodedQueryItem(QByteArray("dir"), QUrl::toPercentEncoding(dir)); + QNetworkReply * reply = mNetManager->get(QNetworkRequest(url)); + //QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/browse.xml?dir=" + dir.replace("&", "%26").replace("\\", "\\\\")))); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true); +#endif + connect(reply,SIGNAL(readyRead()),this,SLOT(readReady())); + connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); + connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); +} +void BrowseMainWindow::error(QNetworkReply::NetworkError code) { +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); +#endif + qDebug() << code; +} +void BrowseMainWindow::readReady() { + QNetworkReply * reply = qobject_cast(sender()); + // append to buffer + mResponse += reply->readAll(); +} +void BrowseMainWindow::finished(QNetworkReply * reply) { + // now we can call parseXmlDirectory to process the full buffers + this->parseXmlDirectory(); + // only interested in finished signals + disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); +#endif + delete reply; +} +void BrowseMainWindow::parseXmlDirectory() { + QDomDocument doc; + doc.setContent(this->mResponse); + QDomElement docElem = doc.documentElement(); + QDomNodeList elements = docElem.elementsByTagName("element"); + // we can sort by folders then files alphabetically by running to lists and appending them at the end + // vlc alpha sorts everything in the incoming stream, we just need to seperate files from folders. + if (0 < elements.count()) { + QList* files = new QList(); + int idx = 0; + mContents->clear(); + do { + QDomNode node = elements.at(idx); + VlcBrowseElement* dir = new VlcBrowseElement(); + dir->type = node.attributes().namedItem("type").nodeValue(); + dir->size = node.attributes().namedItem("size").nodeValue().toInt(); + dir->date = QDate::fromString(node.attributes().namedItem("date").nodeValue()); + dir->path = node.attributes().namedItem("path").nodeValue(); + dir->name = node.attributes().namedItem("name").nodeValue(); + dir->extension = getExtension(dir->path, node.attributes().namedItem("extension").nodeValue()); + ++idx; + if (0 != QString::compare("directory", dir->type) && 0 != QString::compare("dir", dir->type)) { + files->append(*dir); + } + else if (0 == QString::compare("..", dir->name)) { + this->mContents->prepend(*dir); + } + else { + this->mContents->append(*dir); + } + delete dir; + } while (idx < elements.count()); + if (0 < files->count()) { + mContents->append(*files); + } + delete files; + // Update UI + this->updateList(); + } + else { + // alert user of error / empty directory + qDebug() << "can't browse dir: " << mCurrentDir; +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + QMaemo5InformationBox::information(this, tr("Directory could not be browsed!"), QMaemo5InformationBox::DefaultTimeout); +#endif + } + mResponse.clear(); + +} + +QString BrowseMainWindow::getExtension(QString path, QString extension) { + // return extension if exists + if (!extension.isNull() && !extension.isEmpty()) return extension; + // return blank if no path + if (path.isNull() || path.isEmpty()) return ""; + // otherwise extract the extension + int dot_pos = path.lastIndexOf('.'); + if (0 < dot_pos) { + return path.right(path.length() - (dot_pos + 1)); + } + else { // no dot + return ""; + } +} + +void BrowseMainWindow::updateList() { + ui->listWidget->clear(); + int ct = this->mContents->count(); + if (0 < ct) { + QIcon icon_up = QIcon::fromTheme("filemanager_folder_up"); + QIcon icon_folder = QIcon::fromTheme("general_folder"); + QIcon icon_audio = QIcon::fromTheme("general_audio_file"); + QIcon icon_video = QIcon::fromTheme("general_video_file"); + QIcon icon_image = QIcon::fromTheme("general_image"); + QIcon icon_flash = QIcon::fromTheme("filemanager_flash_file"); + QIcon icon_real = QIcon::fromTheme("filemanager_real_music"); + QIcon icon_playl = QIcon::fromTheme("filemanager_playlist"); + QIcon icon_unknown= QIcon::fromTheme("filemanager_unknown_file"); + for (int idx = 0; idx < ct; ++idx) { + VlcBrowseElement dir = mContents->at(idx); + QListWidgetItem* item; + bool item_good = false; + if (0 == QString::compare("directory", dir.type) || 0 == QString::compare("dir", dir.type)) { + if (0 == QString::compare("..", dir.name)) { + item = new QListWidgetItem(icon_up, dir.name, ui->listWidget, 0); + item_good = true; + } + else { + item = new QListWidgetItem(icon_folder, dir.name, ui->listWidget, 0); + item_good = true; + } + } + else if (0 == QString::compare("file", dir.type)) { + if ( 0 == QString::compare(dir.extension, "jpg") || + 0 == QString::compare(dir.extension, "jpeg") || + 0 == QString::compare(dir.extension, "gif") || + 0 == QString::compare(dir.extension, "png") || + 0 == QString::compare(dir.extension, "bmp") ) { + item_good = true; + item = new QListWidgetItem(icon_image, dir.name, ui->listWidget, 0); // .jpg, .jpeg, .gif, .png, .bmp + } + else if ( 0 == QString::compare(dir.extension, "mp3") || + 0 == QString::compare(dir.extension, "m4a") || + 0 == QString::compare(dir.extension, "ogg") || + 0 == QString::compare(dir.extension, "oga") || + 0 == QString::compare(dir.extension, "wav") || + 0 == QString::compare(dir.extension, "flac") ) { + item_good = true; + item = new QListWidgetItem(icon_audio, dir.name, ui->listWidget, 0); // .mp3, .m4a, .ogg, .oga, .wav, .flac + } + else if ( 0 == QString::compare(dir.extension, "m3u") || + 0 == QString::compare(dir.extension, "wpl") || + 0 == QString::compare(dir.extension, "pls") || + 0 == QString::compare(dir.extension, "asx") || + 0 == QString::compare(dir.extension, "xspf") || + 0 == QString::compare(dir.extension, "cmml") ) { + item_good = true; + item = new QListWidgetItem(icon_playl, dir.name, ui->listWidget, 0); // .m3u, .wpl, .pls, .asx, .xspf, .cmml + } + else if ( 0 == QString::compare(dir.extension, "avi") || + 0 == QString::compare(dir.extension, "mpeg") || + 0 == QString::compare(dir.extension, "mpg") || + 0 == QString::compare(dir.extension, "mov") || + 0 == QString::compare(dir.extension, "mp4") || + 0 == QString::compare(dir.extension, "m4v") || + 0 == QString::compare(dir.extension, "wmv") || + 0 == QString::compare(dir.extension, "mkv") || + 0 == QString::compare(dir.extension, "ogv") ) { + item_good = true; + item = new QListWidgetItem(icon_video, dir.name, ui->listWidget, 0); // .avi, .mpg, .mpeg, .mov, .mp4, .m4v, .wmv, .mkv, .ogv + } + else if ( 0 == QString::compare(dir.extension, "rm") || + 0 == QString::compare(dir.extension, "ra") || + 0 == QString::compare(dir.extension, "ram") ) { + item = new QListWidgetItem(icon_real, dir.name, ui->listWidget, 0); // .ram, 'rm, 'ra + } + else if ( 0 == QString::compare(dir.extension, "flv") ) { + item_good = true; + item = new QListWidgetItem(icon_flash, dir.name, ui->listWidget, 0); // .flv + } + else { + if (dir.name.startsWith("Flash")) { + item_good = true; + item = new QListWidgetItem(icon_flash, dir.name, ui->listWidget, 0); + } + else { + item_good = false; + //item = new QListWidgetItem(icon_unknown, dir.name, ui->listWidget, 0); + } + } + } + if (item_good) { + ui->listWidget->addItem(item); + } + // other types ignored + } + } +} + + diff --git a/src/browsemainwindow.h b/src/browsemainwindow.h new file mode 100644 index 0000000..052421a --- /dev/null +++ b/src/browsemainwindow.h @@ -0,0 +1,76 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 BROWSEMAINWINDOW_H +#define BROWSEMAINWINDOW_H + +#include +#include +#include +#include +#include "vlcbrowseelement.h" +#include "favouritesmainwindow.h" + +namespace Ui { + class BrowseMainWindow; +} + +class BrowseMainWindow : public QMainWindow { + Q_OBJECT +public: + explicit BrowseMainWindow(QWidget *parent = 0); + ~BrowseMainWindow(); + +public slots: + void init(); + void browseDirectory(QString); + void onBrowse(); + void onPlay(); + void onAddToPlaylist(); + void onListSelectionChanged(); + void finished(QNetworkReply * reply); + void readReady(); + void error(QNetworkReply::NetworkError code); + void showCurrentDirectory(); + void setHomeFolder(); + void showHomeFolder(); + void showUserHomeFolder(); + void setFavourite(); + void showFavourites(); + void setHomeDirectory(); + +protected slots: + void parseXmlDirectory(); + void updateList(); + +protected: + void changeEvent(QEvent *e); + VlcBrowseElement getElementFromText(QString text); + QString getExtension(QString path, QString extension); + +private: + Ui::BrowseMainWindow *ui; + FavouritesMainWindow *mFavouritesMainWindow; + QNetworkAccessManager * mNetManager; + QString mCurrentDir; + QString mIp; + QList* mContents; + VlcBrowseElement mCurrentElement; + QByteArray mResponse; +}; + +#endif // BROWSEMAINWINDOW_H diff --git a/src/browsemainwindow.ui b/src/browsemainwindow.ui new file mode 100644 index 0000000..6ae1aee --- /dev/null +++ b/src/browsemainwindow.ui @@ -0,0 +1,97 @@ + + + BrowseMainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + + + + + + + Play + + + + + + + Enqueue + + + + + + + Browse + + + + + + + + + + + 0 + 0 + 800 + 27 + + + + + menu + + + + + + + + + + + User Folder + + + + + Home + + + + + Set as Home + + + + + Favourites + + + + + Add to Favourite + + + + + + diff --git a/src/config-vlc.jpg b/src/config-vlc.jpg new file mode 100644 index 0000000..b4610f0 Binary files /dev/null and b/src/config-vlc.jpg differ diff --git a/src/configdialog.cpp b/src/configdialog.cpp new file mode 100644 index 0000000..9888666 --- /dev/null +++ b/src/configdialog.cpp @@ -0,0 +1,61 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "configdialog.h" +#include "ui_configdialog.h" +#include + +ConfigDialog::ConfigDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::ConfigDialog) +{ + ui->setupUi(this); + load(); + connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(save())); +} + +ConfigDialog::~ConfigDialog() +{ + delete ui; +} + +void ConfigDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} +void ConfigDialog::load() +{ + QSettings settings; + ui->lineEdit->setText(settings.value("ip").toString()); + +} + +void ConfigDialog::save() +{ + + QSettings settings; + settings.setValue("ip",ui->lineEdit->text()); + + emit accept(); +} diff --git a/src/configdialog.h b/src/configdialog.h new file mode 100644 index 0000000..e6c4f67 --- /dev/null +++ b/src/configdialog.h @@ -0,0 +1,42 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include + +namespace Ui { + class ConfigDialog; +} + +class ConfigDialog : public QDialog { + Q_OBJECT +public: + explicit ConfigDialog(QWidget *parent = 0); + ~ConfigDialog(); +public slots: +void load(); +void save(); +protected: + void changeEvent(QEvent *e); + +private: + Ui::ConfigDialog *ui; +}; + +#endif // CONFIGDIALOG_H diff --git a/src/configdialog.ui b/src/configdialog.ui new file mode 100644 index 0000000..c3dd6f0 --- /dev/null +++ b/src/configdialog.ui @@ -0,0 +1,69 @@ + + + ConfigDialog + + + + 0 + 0 + 442 + 304 + + + + Dialog + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Enter IP of VLC server. </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Example : <span style=" font-weight:600;">192.168.0.8:8080</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Be sure you have properly configured Vlc</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> and allows connection by adding this IP in /vlc/http/.hosts</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">More information on my blog : <a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">omed.blogspot.com</span></a><br /></p></td></tr></table></body></html> + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + rejected() + ConfigDialog + reject() + + + 295 + 284 + + + 286 + 274 + + + + + diff --git a/src/data/26x26/vlc-remote.png b/src/data/26x26/vlc-remote.png new file mode 100644 index 0000000..eb65d6f Binary files /dev/null and b/src/data/26x26/vlc-remote.png differ diff --git a/src/data/48x48/vlc-remote.png b/src/data/48x48/vlc-remote.png new file mode 100644 index 0000000..0df71f9 Binary files /dev/null and b/src/data/48x48/vlc-remote.png differ diff --git a/src/data/64x64/vlc-remote.png b/src/data/64x64/vlc-remote.png new file mode 100644 index 0000000..1814fca Binary files /dev/null and b/src/data/64x64/vlc-remote.png differ diff --git a/src/favouritesmainwindow.cpp b/src/favouritesmainwindow.cpp new file mode 100644 index 0000000..a578deb --- /dev/null +++ b/src/favouritesmainwindow.cpp @@ -0,0 +1,170 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "favouritesmainwindow.h" +#include "ui_favouritesmainwindow.h" +#include +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) +#include +#endif +#include "appsettings.h" +//#include "browsemainwindow.h" + +FavouritesMainWindow::FavouritesMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::FavouritesMainWindow) +{ + + ui->setupUi(this); + + setWindowTitle("Vlc remote"); + mCurrentItemIndex = -1; + + ui->listWidget->setTextElideMode(Qt::ElideMiddle); + ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + ui->deleteButton->setIcon(QIcon::fromTheme("general_delete")); + ui->editButton->setIcon(QIcon::fromTheme("general_sketch")); + ui->browseButton->setIcon(QIcon::fromTheme("filemanager_media_folder")); + ui->saveButton->setIcon(QIcon::fromTheme("notes_save")); + ui->browseButton->setDisabled(true); + ui->editButton->setDisabled(true); + ui->deleteButton->setDisabled(true); + ui->actionSetHome->setDisabled(true); + ui->label->setVisible(false); + ui->lineEdit->setVisible(false); + ui->saveButton->setVisible(false); + ui->saveButton->setDisabled(true); + + connect(ui->browseButton,SIGNAL(clicked()),this,SLOT(onBrowse())); + connect(ui->deleteButton,SIGNAL(clicked()),this,SLOT(onDelete())); + connect(ui->editButton,SIGNAL(clicked()),this,SLOT(onEdit())); + connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); + connect(ui->actionSetHome, SIGNAL(triggered()), this, SLOT(setHomeFolder())); + connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(onEditSave())); + connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(onLineEditTextChanged(QString))); + + init(); + + +} +void FavouritesMainWindow::init() // THIS METHOD IS CALLED WHEN CONFIG CHANGED AND WINDOW SHOWN... +{ + mFavourites = AppSettings::getFavourites(); + updateList(); +} + +FavouritesMainWindow::~FavouritesMainWindow() +{ + delete mFavourites; + delete ui; +} + +void FavouritesMainWindow::changeEvent(QEvent *e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} +void FavouritesMainWindow::updateList() { + ui->listWidget->clear(); + if (NULL != mFavourites && 0 < mFavourites->count()) { + for (int idx = 0; idx < mFavourites->count(); ++idx) { + QListWidgetItem* item = new QListWidgetItem(QIcon::fromTheme("imageviewer_favourite"), mFavourites->at(idx).name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + idx); + ui->listWidget->addItem(item); + } + } +} +void FavouritesMainWindow::setHomeFolder() { + if (-1 < mCurrentItemIndex) { + AppSettings::setHomeDirectory(mCurrentFavourite); + } +} +void FavouritesMainWindow::onListSelectionChanged() { + ui->label->setVisible(false); + ui->lineEdit->setVisible(false); + ui->saveButton->setVisible(false); + ui->saveButton->setDisabled(true); + QList items = ui->listWidget->selectedItems(); + if (0 < items.count()) { + mCurrentItemIndex = ui->listWidget->currentIndex().row(); + mCurrentFavourite = mFavourites->at(items.at(0)->type() - LIST_ITEM_TYPE_OFFSET); // Qt reserves types up to 1000, we use an offset beyond that for index tracking. May prove to be too hacky! + ui->browseButton->setDisabled(false); + ui->editButton->setDisabled(false); + ui->deleteButton->setDisabled(false); + ui->actionSetHome->setDisabled(false); + } + else { + mCurrentItemIndex = -1; + ui->browseButton->setDisabled(true); + ui->editButton->setDisabled(true); + ui->deleteButton->setDisabled(true); + ui->actionSetHome->setDisabled(true); + } +} +void FavouritesMainWindow::onLineEditTextChanged(QString text) { + if (0 < text.length()) { + ui->saveButton->setDisabled(false); + } + else { + ui->saveButton->setDisabled(true); + } +} +void FavouritesMainWindow::onEditSave() { + if (-1 < mCurrentItemIndex && 0 < ui->lineEdit->text().length()) { + ui->label->setVisible(false); + ui->lineEdit->setVisible(false); + ui->saveButton->setVisible(false); + ui->saveButton->setDisabled(true); + AppSettings::deleteFavourite(mCurrentFavourite); + mCurrentFavourite.name = ui->lineEdit->text(); + AppSettings::addFavourite(mCurrentFavourite); + ui->lineEdit->setText(""); + ui->listWidget->itemAt(mCurrentItemIndex, 0)->setText(mCurrentFavourite.name); + init(); + } +} +void FavouritesMainWindow::onEdit() { + if (-1 < mCurrentItemIndex) { + ui->label->setVisible(true); + ui->lineEdit->setVisible(true); + ui->saveButton->setVisible(true); + ui->saveButton->setDisabled(false); + ui->lineEdit->setText(mCurrentFavourite.name); + ui->browseButton->setDisabled(true); + ui->editButton->setDisabled(true); + ui->deleteButton->setDisabled(true); + } +} +void FavouritesMainWindow::onBrowse() { + if (-1 < mCurrentItemIndex) { + emit browseDirectory(mCurrentFavourite.path); + //this->close(); + //((BrowseMainWindow *)this->parent())->browseDirectory(mCurrentFavourite.path); + } +} +void FavouritesMainWindow::onDelete() { + if (-1 < mCurrentItemIndex) { + AppSettings::deleteFavourite(mCurrentFavourite); + init(); + } +} diff --git a/src/favouritesmainwindow.h b/src/favouritesmainwindow.h new file mode 100644 index 0000000..76964b0 --- /dev/null +++ b/src/favouritesmainwindow.h @@ -0,0 +1,67 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 FAVOURITESMAINWINDOW_H +#define FAVOURITESMAINWINDOW_H + +#include +#include +#include +#include +#include "appsettings.h" + +#ifndef LIST_ITEM_TYPE_OFFSET +#define LIST_ITEM_TYPE_OFFSET 1000 +#endif + +namespace Ui { + class FavouritesMainWindow; +} + +class FavouritesMainWindow : public QMainWindow { + Q_OBJECT +public: + explicit FavouritesMainWindow(QWidget *parent = 0); + ~FavouritesMainWindow(); + +public slots: + void init(); + void onListSelectionChanged(); + void onLineEditTextChanged(QString text); + void onBrowse(); + void onEdit(); + void onDelete(); + void setHomeFolder(); + void onEditSave(); + +protected slots: + +signals: + void browseDirectory(QString path); + +protected: + void changeEvent(QEvent *e); + void updateList(); + +private: + Ui::FavouritesMainWindow *ui; + int mCurrentItemIndex; + QList* mFavourites; + VlcDirectory mCurrentFavourite; +}; + +#endif // FAVOURITESMAINWINDOW_H diff --git a/src/favouritesmainwindow.ui b/src/favouritesmainwindow.ui new file mode 100644 index 0000000..b379237 --- /dev/null +++ b/src/favouritesmainwindow.ui @@ -0,0 +1,88 @@ + + + FavouritesMainWindow + + + + 0 + 0 + 798 + 598 + + + + MainWindow + + + + + + + + + + + + Name + + + + + + + + + + Save + + + + + + + + + + + Delete + + + + + + + Edit + + + + + + + Browse + + + + + + + + + + + 0 + 0 + 798 + 20 + + + + + + + Set as Home + + + + + + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..8e21758 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,70 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 +#include +#include +#include +#include +#include +#include "playermainwindow.h" +#include "appsettings.h" +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + + QCoreApplication::setOrganizationName("Omed"); + QCoreApplication::setOrganizationDomain("medsoft.blogspot.com/"); + QCoreApplication::setApplicationName("Maemo VLC remote"); + + QString locale = QLocale::system().name(); + QTranslator translator; + translator.load(QString(":/languages/vlcremote_") + locale); + a.installTranslator(&translator); + + QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); + + + qDebug() << AppSettings::getCurrentIp(); + + + PlayerMainWindow * mainwindow = new PlayerMainWindow; + + //mainwindow->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); + //mainwindow->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); + //mainwindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true); + + mainwindow->showMaximized(); + #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + Orientation o = AppSettings::getOrientation(); + switch (o) { + case AUTO_ROTATE: + mainwindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true); + break; + case LANDSCAPE: + mainwindow->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); + break; + case PORTRAIT: + mainwindow->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); + break; + default: + mainwindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true); + break; + } +#endif + return a.exec(); +} diff --git a/src/newaccountdialog.cpp b/src/newaccountdialog.cpp new file mode 100644 index 0000000..3a3acd3 --- /dev/null +++ b/src/newaccountdialog.cpp @@ -0,0 +1,98 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "newaccountdialog.h" +#include +#include +#include +//#include + +NewAccountDialog::NewAccountDialog(QWidget *parent) +{ + Q_UNUSED(parent); + this->setWindowTitle(tr("Add account")); + + mKeyLineEdit = new QLineEdit; + mIpLineEdit = new QLineEdit; + mPortLineEdit = new QLineEdit; + mPortLineEdit->setText("8080"); + mPortLineEdit->setReadOnly(false); + + mButtonBox = new QDialogButtonBox; + mButtonBox->addButton(QDialogButtonBox::Save); + mButtonBox->addButton(QDialogButtonBox::Cancel); + + connect(mButtonBox, SIGNAL(accepted()), this, SLOT(save())); + connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject())); + + QFormLayout *layout = new QFormLayout; + layout->expandingDirections(); + layout->addRow(tr("Name:"), mKeyLineEdit); + layout->addRow(tr("Ip:"), mIpLineEdit); + layout->addRow(tr("Port:"), mPortLineEdit); + layout->addWidget(mButtonBox); + + setLayout(layout); +} + +void NewAccountDialog::save() +{ + QString myKey = mKeyLineEdit->text(); + QString myIp = mIpLineEdit->text(); + QString myPort = mPortLineEdit->text(); + + QSettings settings; + settings.beginGroup("account"); + if (!mEditKey.isEmpty()) { + settings.remove(mEditKey); + } + + if (!myIp.isEmpty() && !myKey.isEmpty()) { + if (myPort.isEmpty()) { + myPort = "8080"; + } + settings.setValue(myKey, myIp+":"+myPort); + // Rajouter des tests pour vérifier qu'on est sur Maemo + //QMaemo5InformationBox::information(this, tr("Account saved"), QMaemo5InformationBox::DefaultTimeout); + } + settings.endGroup(); + + emit accept(); +} + +void NewAccountDialog::edit(QString &key, QString &ip) +{ + Q_UNUSED(ip); + this->setWindowTitle(tr("Edit account")); + + QSettings settings; + settings.beginGroup("account"); + QString value = settings.value(key).toString(); + settings.endGroup(); + + QStringList values = value.split(":"); + + mEditKey = key; + mEditIp = values.first(); + mEditPort = values.last(); + + mKeyLineEdit->setText(mEditKey); + mKeyLineEdit->setDisabled(true); + mIpLineEdit->setText(mEditIp); + mPortLineEdit->setText(mEditPort); +} + diff --git a/src/newaccountdialog.h b/src/newaccountdialog.h new file mode 100644 index 0000000..70794ab --- /dev/null +++ b/src/newaccountdialog.h @@ -0,0 +1,50 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 NEWACCOUNTDIALOG_H +#define NEWACCOUNTDIALOG_H + +#include +#include +#include +#include + +class NewAccountDialog : public QDialog +{ + Q_OBJECT + +public: + explicit NewAccountDialog(QWidget *parent = 0); + void edit(QString &key, QString &ip); + +public slots: + void save(); + +private: + QLineEdit *mKeyLineEdit; + QLineEdit *mIpLineEdit; + QLineEdit *mPortLineEdit; + QPushButton *mSavePushButton; + QPushButton *mCancelPushButton; + QDialogButtonBox *mButtonBox; + + QString mEditKey; + QString mEditIp; + QString mEditPort; +}; + +#endif // NEWACCOUNTDIALOG_H diff --git a/src/playermainwindow.cpp b/src/playermainwindow.cpp new file mode 100644 index 0000000..33d001c --- /dev/null +++ b/src/playermainwindow.cpp @@ -0,0 +1,511 @@ + /* VLC-REMOTE for MAEMO 5 + * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave + * 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 + #include + #include + #include "playermainwindow.h" + #include "ui_playermainwindow.h" + #include "configdialog.h" + #include "aboutdialog.h" + #include "accountdialog.h" + #include "appsettings.h" + //#include "vlcstatus.h" + + PlayerMainWindow::PlayerMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::PlayerMainWindow) + { + ui->setupUi(this); + setWindowTitle("Vlc remote"); + + + + mTimer = new QTimer(this); + mNetManager = new QNetworkAccessManager(this); + mPlayListMainWindow = new PlayListMainWindow; + mBrowserMainWindow = new BrowseMainWindow; + + mVolume = 100; + mMuted = false; + + mIsLandscape = true; + + ui->playlistButton->setIcon(QIcon::fromTheme("notes_bullets")); + ui->browseButton->setIcon(QIcon::fromTheme("filemanager_media_folder")); + + ui->previousButton->setIcon(QIcon::fromTheme("pdf_viewer_first_page")); + ui->nextButton->setIcon(QIcon::fromTheme("pdf_viewer_last_page")); + ui->playpauseButton->setIcon(QIcon::fromTheme("camera_playback")); + ui->stopButton->setIcon(QIcon::fromTheme("camera_video_stop")); + //ui->pauseButton->setIcon(QIcon::fromTheme("camera_video_pause")); + ui->fullscreenButton->setIcon(QIcon::fromTheme("general_fullsize")); + ui->volDown->setIcon(QIcon::fromTheme("statusarea_volumelevel1")); + ui->volUp->setIcon(QIcon::fromTheme("statusarea_volumelevel4")); + ui->volMute->setIcon(QIcon::fromTheme("statusarea_volume_mute")); + + ui->labelArtPortrait->setVisible(false); + ui->labelArtLandscape->setVisible(false); + + ui->labelTitle->setTextFormat(Qt::RichText); + ui->labelArtist->setTextFormat(Qt::RichText); + ui->labelAlbum->setTextFormat(Qt::RichText); + + + #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + + mPlayListMainWindow->setParent(this); + mPlayListMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); + setAttribute(Qt::WA_Maemo5StackedWindow, true); + mPlayListMainWindow->setWindowFlags(mPlayListMainWindow->windowFlags() | Qt::Window); + + mBrowserMainWindow->setParent(this); + mBrowserMainWindow->setAttribute(Qt::WA_Maemo5StackedWindow, true); + setAttribute(Qt::WA_Maemo5StackedWindow, true); + mBrowserMainWindow->setWindowFlags(mBrowserMainWindow->windowFlags() | Qt::Window); + + connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged())); + + #endif + + connect(mTimer,SIGNAL(timeout()),this,SLOT(askStatus())); + connect(ui->actionConfiguration,SIGNAL(triggered()),this,SLOT(showConfig())); + connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(showAbout())); + connect(ui->actionPortrait,SIGNAL(triggered()),this,SLOT(setPortrait())); + connect(ui->actionLandscape,SIGNAL(triggered()),this,SLOT(setLandscape())); + connect(ui->actionAutoRotate,SIGNAL(triggered()),this,SLOT(setAutoRotate())); + connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(show())); + connect(ui->playlistButton,SIGNAL(clicked()),mPlayListMainWindow,SLOT(showPlayList())); + connect(ui->browseButton,SIGNAL(clicked()),mBrowserMainWindow,SLOT(show())); + connect(ui->browseButton,SIGNAL(clicked()),mBrowserMainWindow,SLOT(showCurrentDirectory())); + + connect(ui->playpauseButton,SIGNAL(clicked()),this,SLOT(playpause())); + connect(ui->stopButton,SIGNAL(clicked()),this,SLOT(stop())); + connect(ui->previousButton,SIGNAL(clicked()),this,SLOT(previous())); + connect(ui->nextButton,SIGNAL(clicked()),this,SLOT(next())); + connect(ui->fullscreenButton,SIGNAL(clicked()),this,SLOT(fullscreen())); + connect(ui->volUp,SIGNAL(clicked()),this,SLOT(volUp())); + connect(ui->volDown,SIGNAL(clicked()),this,SLOT(volDown())); + connect(ui->volMute,SIGNAL(clicked()),this,SLOT(volMute())); + connect(ui->slider,SIGNAL(sliderMoved(int)),this,SLOT(slide(int))); + + connect(mPlayListMainWindow, SIGNAL(idUpdated(int,bool,QString)), this, SLOT(playlistIdUpdated(int, bool, QString))); + + + // check if last used connection is still valid or showConfig + QSettings settings; + QString last_ip = AccountDialog::currentIp(); + if (!last_ip.isNull() && !last_ip.isEmpty()) { + QTcpSocket * socket = new QTcpSocket; + if(last_ip.contains(":")) + { + QStringList hostSplit = last_ip.split(":"); + QString ip = hostSplit.at(0); + QString port = hostSplit.at(1); + socket->connectToHost(ip,port.toInt()); + } + else { + socket->connectToHost(last_ip,8080); + } + if (!socket->waitForConnected(1000)) { + showConfig(); + } + else { + mIp= last_ip; + + mPlayListMainWindow->init(); + mBrowserMainWindow->init(); + mTimer->start(5000); + askStatus(); + } + delete socket; + } + else { + showConfig(); + } + + + } + + + PlayerMainWindow::~PlayerMainWindow() + { + delete ui; + } + + void PlayerMainWindow::changeEvent(QEvent *e) + { + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } + } + + void PlayerMainWindow::setPortrait() + { + #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + AppSettings::setOrientation(PORTRAIT); + this->setAttribute(Qt::WA_Maemo5PortraitOrientation, true); + #endif + } + + void PlayerMainWindow::setLandscape() + { + #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + AppSettings::setOrientation(LANDSCAPE); + this->setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); + #endif + } + + void PlayerMainWindow::setAutoRotate() + { + #if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + AppSettings::setOrientation(AUTO_ROTATE); + this->setAttribute(Qt::WA_Maemo5AutoOrientation, true); + #endif + } + + void PlayerMainWindow::orientationChanged() { + QRect screenGeometry = QApplication::desktop()->screenGeometry(); + mIsLandscape = (screenGeometry.width() > screenGeometry.height()); + if (mHasImage) { + if (mIsLandscape) { + ui->labelArtPortrait->setVisible(false); + ui->labelArtLandscape->setVisible(true); + } + else { + ui->labelArtLandscape->setVisible(false); + ui->labelArtPortrait->setVisible(true); + } + } + else { + ui->labelArtLandscape->setVisible(false); + ui->labelArtPortrait->setVisible(false); + } + } + + void PlayerMainWindow::playpause() + { + // NB. There is no guarentee that our current state is the real current state. + // This is due to the polling frequency and possibility of user interaction directly on the server. + // Still this is probably better than nothing and our next real poll will set us straight again. + if (PAUSED == mCurrentStatus.state) { + mCurrentStatus.state = PLAYING; + pause(); + updateUiWithCurrentStatus(); + } + else if (PLAYING == mCurrentStatus.state) { + mCurrentStatus.state = PAUSED; + pause(); + updateUiWithCurrentStatus(); + } + else { + // could be STOP or UNKNOWN, either way there is no guarentee we will enter a playing state next. + // So don't update the current state or UI + // Ideally we would try to find a way to check the current state again but this could lead to an infinite loop! + play(); + } + } + void PlayerMainWindow::play() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_play"))); + } + void PlayerMainWindow::stop() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_stop"))); + } + void PlayerMainWindow::pause() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_pause"))); + } + void PlayerMainWindow::previous() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_previous"))); + } + void PlayerMainWindow::next() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_next"))); + } + void PlayerMainWindow::fullscreen() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=fullscreen"))); + } + void PlayerMainWindow::volUp() + { + QUrl url = QUrl("http://"+mIp+"/requests/status.xml?command=volume"); + url.addEncodedQueryItem(QByteArray("val"), QByteArray("%2B10")); + mNetManager->get(QNetworkRequest(url)); + } + void PlayerMainWindow::volDown() + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val=-10"))); + } + void PlayerMainWindow::volMute() + { + this->mMuted = !this->mMuted; + if (this->mMuted) { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val=0"))); + } + else { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=volume&val="+QString::number(this->mVolume)))); + } + } + void PlayerMainWindow::slide(int value) + { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=seek&val="+QString::number(value)+"%25"))); + } + + void PlayerMainWindow::showConfig() + { + mTimer->stop(); + AccountDialog * dialog = new AccountDialog; + dialog->exec(); + + mIp= AccountDialog::currentIp(); + + mPlayListMainWindow->init(); + mBrowserMainWindow->init(); + mTimer->start(5000); + askStatus(); + } + void PlayerMainWindow::showAbout() + { + + AboutDialog * dialog = new AboutDialog; + dialog->exec(); + + } + + void PlayerMainWindow::askStatus() + { + //qDebug() << "Status requested. at:" << QTime::currentTime().toString("hh::mm:ss"); + QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml"))); + connect(reply,SIGNAL(readyRead()),this,SLOT(parseXmlStatus())); + } + + void PlayerMainWindow::parseXmlStatus() + { + QNetworkReply * reply = qobject_cast(sender()); + QDomDocument doc; + doc.setContent(reply->readAll()); + delete reply; + QDomElement docElem = doc.documentElement(); + // Get the raw values + int volume = docElem.namedItem("volume").toElement().text().toInt(); + int length = docElem.namedItem("length").toElement().text().toInt(); + int time = docElem.namedItem("time").toElement().text().toInt(); + int position = docElem.namedItem("position").toElement().text().toInt(); + int random = docElem.namedItem("random").toElement().text().toInt(); + int loop = docElem.namedItem("loop").toElement().text().toInt(); + int repeat = docElem.namedItem("repeat").toElement().text().toInt(); + QString state = docElem.namedItem("state").toElement().text(); + QDomNode infoNode = docElem.namedItem("information"); + QDomNode metaInfoNode = infoNode.namedItem("meta-information"); + QString title = metaInfoNode.namedItem("title").toElement().text().replace("\\\\", "\\"); + // if it's a file style title fix it up + if (40 < title.length()) { + if (0 < title.lastIndexOf("\\")) { + title = title.right(title.length() - (title.lastIndexOf("\\") + 1)); + } + else if (0 < title.lastIndexOf("/")) { + title = title.right(title.length() - (title.lastIndexOf("/") + 1)); + } + } + QString artist = metaInfoNode.namedItem("artist").toElement().text(); + QString album = metaInfoNode.namedItem("album").toElement().text(); + QString now_playing = metaInfoNode.namedItem("now_playing").toElement().text(); + QString art_url = metaInfoNode.namedItem("art_url").toElement().text(); + //metaInfoNode.clear(); + //infoNode.clear(); + //docElem.clear(); + //doc.clear(); + // Populate the current status structure + // now would be a good time to work out if we are a new track / file or not. + // key if we are going to look for album art later + // for now we check length and title this will require further examination later + mCurrentStatus.newtrack = true; + if (mCurrentStatus.length == length && !mCurrentStatus.title.isNull() && 0 == QString::compare(mCurrentStatus.title, title)) { + mCurrentStatus.newtrack = false; + } + mCurrentStatus.volume = volume; + mCurrentStatus.length = length; + mCurrentStatus.time = time; + mCurrentStatus.position = position; + mCurrentStatus.random = (1 == random); + mCurrentStatus.loop = (1 == loop); + mCurrentStatus.repeat = (1 == repeat); + mCurrentStatus.title = title; + mCurrentStatus.artist = artist; + mCurrentStatus.album = album; + mCurrentStatus.nowplaying = now_playing; + mCurrentStatus.hasart = (!art_url.isNull() && !art_url.isEmpty()); + if (!state.isNull() && !state.isEmpty()) { + if (0 == QString::compare("playing", state, Qt::CaseInsensitive)) { + mCurrentStatus.state = PLAYING; + } + else if (0 == QString::compare("paused", state, Qt::CaseInsensitive)) { + mCurrentStatus.state = PAUSED; + } + else if (0 == QString::compare("stop", state, Qt::CaseInsensitive)) { + mCurrentStatus.state = STOP; + } + else { + mCurrentStatus.state = UNKNOWN; + } + } + else { + mCurrentStatus.state = UNKNOWN; + } + // What's our mute status? + if (0 < mCurrentStatus.volume) { + this->mVolume = mCurrentStatus.volume; + this->mMuted = false; + } + else { + this->mMuted = true; + } + // Update the UI + updateUiWithCurrentStatus(); + + } + + void PlayerMainWindow::updateUiWithCurrentStatus() { + // position + QTime timePosition(0,0,0) ; + timePosition = timePosition.addSecs(mCurrentStatus.time); + + ui->timeLabel->setText(timePosition.toString("h:mm:ss")); + + // duration + if (0 < mCurrentStatus.length) { + QTime timeDuration(0,0,0) ; + timeDuration = timeDuration.addSecs(mCurrentStatus.length); + + ui->durationLabel->setText(timeDuration.toString("h:mm:ss")); + } + else { + ui->durationLabel->setText("0:00:00"); + } + + + if (mCurrentStatus.position >= 0 && mCurrentStatus.position <= 100) { + ui->slider->blockSignals(true); + ui->slider->setValue(mCurrentStatus.position); + ui->slider->blockSignals(false); + } + + ui->labelTitle->setText(mCurrentStatus.title); + ui->labelArtist->setText(mCurrentStatus.artist); + ui->labelAlbum->setText(mCurrentStatus.album); + + if (PLAYING == mCurrentStatus.state) { + ui->playpauseButton->setIcon(QIcon::fromTheme("camera_video_pause")); + } + else { + ui->playpauseButton->setIcon(QIcon::fromTheme("camera_playback")); + } + + if (mCurrentStatus.newtrack) { + // potential actions: + // rebuild display layout + // retrieve album art + mHasImage = false; + QTimer::singleShot(500, mPlayListMainWindow, SLOT(requestPlayList())); + } + // Update the buttons on the playlist window + if (NULL != this->mPlayListMainWindow) { + this->mPlayListMainWindow->updateUiWithCurrentStatus(& mCurrentStatus); + } + + } + void PlayerMainWindow::playlistIdUpdated(int id, bool hasart, QString extension) { + Q_UNUSED(extension); + if (hasart) { + getCoverArt(id); + } + else { + ui->labelArtLandscape->setVisible(false); + ui->labelArtPortrait->setVisible(false); + // could use a default graphic from extension here! + // setCoverArtFromPixmap(); + } + } + void PlayerMainWindow::error(QNetworkReply::NetworkError code) { + qDebug() << "Error Code: " << code; + } + void PlayerMainWindow::readReady() { + QNetworkReply * reply = qobject_cast(sender()); + // append to buffer + mResponse += reply->readAll(); + } + void PlayerMainWindow::finished(QNetworkReply * reply) { + // now we can call setCoverArt to process the full buffers + this->setCoverArt(mResponse); + // only interested in finished signals + disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); + delete reply; + } + void PlayerMainWindow::getCoverArt(int id) { + qDebug() << "getCoverArt id=!" << id; + mResponse.clear(); + QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/art?id=" + QString::number(id)))); + connect(reply,SIGNAL(readyRead()),this,SLOT(readReady())); + connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); + connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); + + } + void PlayerMainWindow::setCoverArt(const QByteArray data) { + QPixmap* image = new QPixmap(); + if (image->loadFromData(data)) { + mHasImage = true; + ui->labelArtLandscape->setPixmap(image->scaledToHeight(120, Qt::SmoothTransformation)); + ui->labelArtPortrait->setPixmap(image->scaledToHeight(310, Qt::SmoothTransformation)); + if (mIsLandscape) { + ui->labelArtPortrait->setVisible(false); + ui->labelArtLandscape->setVisible(true); + } + else { + ui->labelArtLandscape->setVisible(false); + ui->labelArtPortrait->setVisible(true); + } + } + else { + qDebug() << "image load failed!"; + qDebug() << "data.length" << data.length(); + ui->labelArtPortrait->setVisible(false); + ui->labelArtLandscape->setVisible(false); + } + delete image; + } + void PlayerMainWindow::setCoverArtFromPixmap(QPixmap image) { + mHasImage = true; + ui->labelArtLandscape->setPixmap(image.scaledToHeight(120, Qt::SmoothTransformation)); + ui->labelArtPortrait->setPixmap(image.scaledToHeight(320, Qt::SmoothTransformation)); + if (mIsLandscape) { + ui->labelArtPortrait->setVisible(false); + ui->labelArtLandscape->setVisible(true); + } + else { + ui->labelArtLandscape->setVisible(false); + ui->labelArtPortrait->setVisible(true); + } + } + diff --git a/src/playermainwindow.h b/src/playermainwindow.h new file mode 100644 index 0000000..73c22b2 --- /dev/null +++ b/src/playermainwindow.h @@ -0,0 +1,90 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 PLAYERMAINWINDOW_H +#define PLAYERMAINWINDOW_H + +#include +#include +#include +#include +#include "playlistmainwindow.h" +#include "browsemainwindow.h" +#include "vlcstatus.h" + +namespace Ui { + class PlayerMainWindow; +} + +class PlayerMainWindow : public QMainWindow { + Q_OBJECT +public: + explicit PlayerMainWindow(QWidget *parent = 0); + ~PlayerMainWindow(); + +public slots: + void askStatus(); + void showConfig(); + void showAbout(); + void play(); + void playpause(); + void stop(); + void pause(); + void previous(); + void next(); + void fullscreen(); + void volUp(); + void volDown(); + void volMute(); + void slide(int value); + void updateUiWithCurrentStatus(); + void setCoverArt(const QByteArray data); + void setCoverArtFromPixmap(QPixmap image); + void getCoverArt(int id); + void finished(QNetworkReply * reply); + void error(QNetworkReply::NetworkError code); + void readReady(); + void orientationChanged(); + void setPortrait(); + void setLandscape(); + void setAutoRotate(); + void playlistIdUpdated(int id, bool hasart, QString extension); + + +protected slots: + void parseXmlStatus(); +protected: + void changeEvent(QEvent *e); + + +private: + Ui::PlayerMainWindow *ui; + PlayListMainWindow * mPlayListMainWindow; + BrowseMainWindow * mBrowserMainWindow; + QNetworkAccessManager * mNetManager; + QString mIp; + QTimer * mTimer; + int mVolume; + int mMuted; + VlcStatus mCurrentStatus; + QByteArray mResponse; + bool mIsLandscape; + bool mHasImage; + +}; + +#endif // PLAYERMAINWINDOW_H diff --git a/src/playermainwindow.ui b/src/playermainwindow.ui new file mode 100644 index 0000000..a9d9065 --- /dev/null +++ b/src/playermainwindow.ui @@ -0,0 +1,320 @@ + + + PlayerMainWindow + + + + 0 + 0 + 796 + 631 + + + + Vlc-Remote + + + + + + + + 380 + 350 + + + + + 380 + 350 + + + + Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + 0 + 30 + + + + Information + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 30 + + + + Information + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 30 + + + + Information + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 140 + 140 + + + + + 140 + 140 + + + + Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Qt::Vertical + + + + 20 + 100 + + + + + + + + + + color: rgb(201, 201, 201); + + + + + + + + + + color: rgb(201, 201, 201); + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + true + + + 100 + + + Qt::Horizontal + + + + + + + + + < + + + + + + + Play/Pause + + + + + + + > + + + + + + + Stop + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + FS + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + V+ + + + + + + + V- + + + + + + + Mute + + + + + + + + + + + PlayList + + + + + + + Browse + + + + + + + + + + + 0 + 0 + 796 + 20 + + + + + menu + + + + + + + + + + + + Configuration + + + + + About + + + + + Portrait Mode + + + + + Landscape Mode + + + + + Auto Rotate + + + + + + diff --git a/src/playlistmainwindow.cpp b/src/playlistmainwindow.cpp new file mode 100644 index 0000000..a6c8a5c --- /dev/null +++ b/src/playlistmainwindow.cpp @@ -0,0 +1,411 @@ +/* VLC-REMOTE for MAEMO 5 + * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave + * 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 "playlistmainwindow.h" +#include "ui_playlistmainwindow.h" +#include +#include +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) +#include +#endif +#include "configdialog.h" +#include "aboutdialog.h" +#include "appsettings.h" +//#include "vlcstatus.h" + +PlayListMainWindow::PlayListMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::PlayListMainWindow) +{ + + ui->setupUi(this); + mTimer = new QTimer(this); + setWindowTitle("Vlc remote"); + + mCurrentDepth = 0; + mCurrentVlcIndex = 0; + + + mNetManager = new QNetworkAccessManager(this); + + mContents = new QList(); + + ui->listWidget->setTextElideMode(Qt::ElideLeft); + ui->listWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + + ui->playButton->setIcon(QIcon::fromTheme("camera_playback")); + ui->clearButton->setIcon(QIcon::fromTheme("general_delete")); + ui->shuffleButton->setIcon(QIcon::fromTheme("mediaplayer_default_shuffle")); + ui->loopButton->setIcon(QIcon::fromTheme("general_refresh")); + ui->repeatButton->setIcon(QIcon::fromTheme("general_redo")); + ui->removeButton->setIcon(QIcon::fromTheme("general_close")); + + ui->clearButton->setDisabled(false); + ui->shuffleButton->setDisabled(false); + ui->loopButton->setDisabled(false); + ui->repeatButton->setDisabled(false); + ui->removeButton->setDisabled(true); + ui->playButton->setDisabled(true); + + connect(ui->playButton,SIGNAL(clicked()),this,SLOT(onPlay())); + connect(ui->removeButton,SIGNAL(clicked()),this,SLOT(onRemove())); + connect(ui->repeatButton,SIGNAL(clicked()),this,SLOT(onRepeat())); + connect(ui->loopButton,SIGNAL(clicked()),this,SLOT(onLoop())); + connect(ui->shuffleButton,SIGNAL(clicked()),this,SLOT(onShuffle())); + connect(ui->clearButton,SIGNAL(clicked()),this,SLOT(onClear())); + connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); + + init(); + +} +void PlayListMainWindow::init() // CALL WHEN CONFIG CHANGES +{ + mIp = AppSettings::getCurrentIp(); // AccountDialog::currentIp(); +} +void PlayListMainWindow::showPlayList() // CALL WHEN SHOWN +{ + requestPlayList(); +} + +PlayListMainWindow::~PlayListMainWindow() +{ + delete ui; +} + +void PlayListMainWindow::changeEvent(QEvent *e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void PlayListMainWindow::onListSelectionChanged() { + QList items = ui->listWidget->selectedItems(); + if (0 < items.count()) { + // TODO VLC doesn't seem to support removing nodes! + // Playing nodes works fine, however. + // should check to see if it is a leaf or not and disable the remove button + mCurrentVlcIndex = items.at(0)->type() - LIST_ITEM_TYPE_OFFSET; // Qt reserves types up to 1000, we use an offset beyond that for index tracking. May prove to be too hacky! + mCurrentElement = getElementFromId(mCurrentVlcIndex); + if (0 == QString::compare("node", mCurrentElement.type)) { + ui->removeButton->setDisabled(true); + ui->playButton->setDisabled(false); + } + else { + ui->removeButton->setDisabled(false); + ui->playButton->setDisabled(false); + } + } + else { + mCurrentVlcIndex = 0; + ui->removeButton->setDisabled(true); + ui->playButton->setDisabled(true); + } +} + +void PlayListMainWindow::onRemove() { + if (0 < this->mCurrentVlcIndex) { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_delete&id=" + QString::number(this->mCurrentVlcIndex)))); + //connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList())); + // don't refresh just clear the item! + delete ui->listWidget->takeItem(ui->listWidget->currentRow()); + } +} +void PlayListMainWindow::onPlay() { + if (0 < this->mCurrentVlcIndex) { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_play&id=" + QString::number(this->mCurrentVlcIndex)))); + } +} +void PlayListMainWindow::onRepeat() { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_repeat"))); +} +void PlayListMainWindow::onLoop() { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_loop"))); +} +void PlayListMainWindow::onShuffle() { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_random"))); +} +void PlayListMainWindow::onClear() { + mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=pl_empty"))); + mContents->clear(); + ui->listWidget->clear(); + //connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList())); +} +void PlayListMainWindow::requestPlayList() { + mResponse.clear(); + ui->removeButton->setDisabled(true); + ui->playButton->setDisabled(true); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true); +#endif + QNetworkReply * reply = mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/playlist.xml"))); + disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(requestPlayList())); + connect(reply,SIGNAL(readyRead()),this,SLOT(readReady())); + connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError))); + connect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); +} +void PlayListMainWindow::error(QNetworkReply::NetworkError code) { +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); +#endif + qDebug() << code; +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + QMaemo5InformationBox::information(this, tr("Playlist could not be retrieved."), QMaemo5InformationBox::DefaultTimeout); +#endif +} +void PlayListMainWindow::readReady() { + QNetworkReply * reply = qobject_cast(sender()); + // append to buffer + mResponse += reply->readAll(); +} +void PlayListMainWindow::finished(QNetworkReply * reply) { + // now we can call parseXmlList to process the full buffers + this->parseXmlPlayList(); + // only interested in finished signals + disconnect(mNetManager,SIGNAL(finished(QNetworkReply *)),this,SLOT(finished(QNetworkReply *))); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + this->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false); +#endif + delete reply; +} + +void PlayListMainWindow::parseXmlPlayList() { + mContents->clear(); + QDomDocument doc; + doc.setContent(this->mResponse); + QDomElement docElem = doc.documentElement(); + QDomNodeList nodes = docElem.elementsByTagName("node"); + int depth = 0; + + int currentLeafId = 0; + bool hasArt = false; + QString extension = ""; + + int ct = nodes.count(); + for (int idx = 0; idx < ct; ++idx) { + QDomNode node = nodes.at(idx); + QString current = ""; + //QString name = node.attributes().namedItem("name").nodeValue().replace("\\\\", "\\"); + int id = node.attributes().namedItem("id").nodeValue().toInt(); + if (4 > id && 0 == QString::compare(node.attributes().namedItem("ro").nodeValue(), "ro")) { + // got the main playlist, let's build it up + if (node.hasChildNodes()) { + QDomNodeList leafs = node.childNodes(); + int leafct = leafs.count(); + if (0 < leafct) { + depth = 1; + for (int jdx = 0; jdx < leafct; ++jdx) { + QDomNode leaf = leafs.at(jdx); + parsePlayListItem(&leaf, &extension, &hasArt, ¤tLeafId, 1); + } + } + } + + } + } + + mResponse.clear(); + + emit this->idUpdated(currentLeafId, hasArt, extension); + this->updateList(); + + +} + + +int PlayListMainWindow::parsePlayListItem(QDomNode *node, QString *extension, bool *hasArt, int *currentLeafId, int depth) { + int leafCt = 0; + if (NULL != node) { + QString current; + VlcPlayListElementSimple* el = new VlcPlayListElementSimple(); + el->id = node->attributes().namedItem("id").nodeValue().toInt(); + el->path = node->attributes().namedItem("uri").nodeValue(); + el->name = node->attributes().namedItem("name").nodeValue().replace("\\\\", "\\"); + current = node->attributes().namedItem("current").nodeValue(); + el->playing = (0 < current.length()); + el->depth = depth; + if (0 != QString::compare(node->nodeName(), "node")) { + el->type = "leaf"; + el->extension = getExtension(el->path, NULL); + if (el->playing) { + *currentLeafId = el->id; + QString art = node->toElement().namedItem("art_url").toElement().text(); + *hasArt = (!art.isNull() && !art.isEmpty()); + *extension = getExtension(el->path, NULL); + } + QString title = node->toElement().namedItem("title").toElement().text(); + QString artist = node->toElement().namedItem("artist").toElement().text(); + QString album = node->toElement().namedItem("album").toElement().text(); + if (0 < artist.length() || 0 < album.length()) { + el->name = "" + title + "\n" + artist + " - " + album; + } + this->mContents->append(*el); + ++leafCt; + delete el; + } + else { + el->type = "node"; + el->extension = getExtension(el->path, NULL); + // empty nodes appear in the playlist when they can't be played! + if (node->hasChildNodes()) { + this->mContents->append(*el); + ++leafCt; + } + delete el; + // now parse the child nodes as leaf. + if (node->hasChildNodes()) { + QDomNodeList items = node->childNodes(); + int itemct = items.count(); + int added = 0; + if (0 < itemct) { + ++depth; + for (int kdx = 0; kdx < itemct; ++kdx) { + QDomNode item = items.at(kdx); + added += parsePlayListItem(&item, extension, hasArt, currentLeafId, depth); + } + if (1 > added) { + // should remove the last PlayListElement + this->mContents->removeLast(); + --leafCt; + } + else { + leafCt += added; + } + } + } + } + } + return leafCt; +} + +QString PlayListMainWindow::getExtension(QString path, QString extension) { + // return extension if exists + if (!extension.isNull() && !extension.isEmpty()) return extension; + // return blank if no path + if (path.isNull() || path.isEmpty()) return ""; + // otherwise extract the extension + int dot_pos = path.lastIndexOf('.'); + if (0 < dot_pos) { + return path.right(path.length() - (dot_pos + 1)); + } + else { // no dot + return ""; + } +} + +VlcPlayListElementSimple PlayListMainWindow::getElementFromId(int id) { + //if (0 != QString::compare("", text)) { + for (int idx = 0; idx < mContents->count(); ++idx) { + if (0 < id && (id == mContents->at(idx).id)) { + return mContents->at(idx); + } + } + //} + return *(new VlcPlayListElementSimple()); +} + +void PlayListMainWindow::updateList() { + ui->listWidget->clear(); + int ct = this->mContents->count(); + if (0 < ct) { + QIcon icon_audio = QIcon::fromTheme("general_audio_file"); + QIcon icon_video = QIcon::fromTheme("general_video_file"); + QIcon icon_image = QIcon::fromTheme("general_image"); + QIcon icon_flash = QIcon::fromTheme("filemanager_flash_file"); + QIcon icon_media = QIcon::fromTheme("filemanager_media_folder"); + QIcon icon_real = QIcon::fromTheme("filemanager_real_music"); + QIcon icon_playl = QIcon::fromTheme("filemanager_playlist"); + QIcon icon_unknown= QIcon::fromTheme("filemanager_unknown_file"); + for (int idx = 0; idx < ct; ++idx) { + VlcPlayListElementSimple el = mContents->at(idx); + QListWidgetItem* item; + if (0 == QString::compare("node", el.type)) { + item = new QListWidgetItem(icon_media, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); + } + else { + if ( 0 == QString::compare(el.extension, "jpg") || + 0 == QString::compare(el.extension, "jpeg") || + 0 == QString::compare(el.extension, "gif") || + 0 == QString::compare(el.extension, "png") || + 0 == QString::compare(el.extension, "bmp") ) { + item = new QListWidgetItem(icon_image, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .jpg, .jpeg, .gif, .png, .bmp + } + else if ( 0 == QString::compare(el.extension, "mp3") || + 0 == QString::compare(el.extension, "m4a") || + 0 == QString::compare(el.extension, "ogg") || + 0 == QString::compare(el.extension, "oga") || + 0 == QString::compare(el.extension, "wav") || + 0 == QString::compare(el.extension, "flac") ) { + item = new QListWidgetItem(icon_audio, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .mp3, .m4a, .ogg, .oga, .wav, .flac + } + else if ( 0 == QString::compare(el.extension, "m3u") || + 0 == QString::compare(el.extension, "wpl") || + 0 == QString::compare(el.extension, "pls") || + 0 == QString::compare(el.extension, "asx") || + 0 == QString::compare(el.extension, "xspf") || + 0 == QString::compare(el.extension, "cmml") ) { + item = new QListWidgetItem(icon_playl, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .m3u, .wpl, .pls, .asx, .xspf, .cmml + } + else if ( 0 == QString::compare(el.extension, "avi") || + 0 == QString::compare(el.extension, "mpeg") || + 0 == QString::compare(el.extension, "mpg") || + 0 == QString::compare(el.extension, "mov") || + 0 == QString::compare(el.extension, "mp4") || + 0 == QString::compare(el.extension, "m4v") || + 0 == QString::compare(el.extension, "wmv") || + 0 == QString::compare(el.extension, "mkv") || + 0 == QString::compare(el.extension, "ogv") ) { + item = new QListWidgetItem(icon_video, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .avi, .mpg, .mpeg, .mov, .m4v, .mp4, .wmv, .mkv, .ogv + } + else if ( 0 == QString::compare(el.extension, "rm") || + 0 == QString::compare(el.extension, "ra") || + 0 == QString::compare(el.extension, "ram") ) { + item = new QListWidgetItem(icon_real, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .ram, 'rm, 'ra + } + else if ( 0 == QString::compare(el.extension, "flv") ) { + item = new QListWidgetItem(icon_flash, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .flv + } + //else if ( 0 == QString::compare(el.extension, "") ) { + // item = new QListWidgetItem(icon_unknown, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); // .flv + //} + else { + if (el.name.contains("Flash")) { + item = new QListWidgetItem(icon_flash, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); + } + else { + item = new QListWidgetItem(icon_media, el.name, ui->listWidget, LIST_ITEM_TYPE_OFFSET + el.id); + } + } + } + item->setSelected(el.playing); + ui->listWidget->addItem(item); + if (el.playing) { + ui->listWidget->scrollToItem(item, QAbstractItemView::PositionAtCenter); + } + } + } +} +void PlayListMainWindow::updateUiWithCurrentStatus(VlcStatus * status) { + ui->loopButton->setChecked(status->loop); + ui->repeatButton->setChecked(status->repeat); + ui->shuffleButton->setChecked(status->random); +} diff --git a/src/playlistmainwindow.h b/src/playlistmainwindow.h new file mode 100644 index 0000000..a6a444f --- /dev/null +++ b/src/playlistmainwindow.h @@ -0,0 +1,82 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 PLAYLISTMAINWINDOW_H +#define PLAYLISTMAINWINDOW_H + +#include +#include +#include +#include +#include "vlcplaylistelementsimple.h" +#include "vlcstatus.h" + +#ifndef LIST_ITEM_TYPE_OFFSET +#define LIST_ITEM_TYPE_OFFSET 1000 +#endif + +namespace Ui { + class PlayListMainWindow; +} + +class PlayListMainWindow : public QMainWindow { + Q_OBJECT +public: + explicit PlayListMainWindow(QWidget *parent = 0); + ~PlayListMainWindow(); + void init(); +public slots: + void onClear(); + void onShuffle(); + void onLoop(); + void onPlay(); + void onRepeat(); + void onRemove(); + void requestPlayList(); + void onListSelectionChanged(); + void finished(QNetworkReply * reply); + void readReady(); + void error(QNetworkReply::NetworkError code); + void showPlayList(); + void updateUiWithCurrentStatus(VlcStatus * status); + +protected slots: + void parseXmlPlayList(); + void updateList(); + int parsePlayListItem(QDomNode *node, QString *extension, bool *hasArt, int *currentLeafId, int depth); + +signals: + void idUpdated(int id, bool hasArt, QString extension); + +protected: + void changeEvent(QEvent *e); + VlcPlayListElementSimple getElementFromId(int id); + QString getExtension(QString path, QString extension); + +private: + Ui::PlayListMainWindow *ui; + QTimer * mTimer; + QString mIp; + QNetworkAccessManager * mNetManager; + QList* mContents; + VlcPlayListElementSimple mCurrentElement; + int mCurrentVlcIndex; + int mCurrentDepth; + QByteArray mResponse; +}; + +#endif // PLAYLISTMAINWINDOW_H diff --git a/src/playlistmainwindow.ui b/src/playlistmainwindow.ui new file mode 100644 index 0000000..c98d800 --- /dev/null +++ b/src/playlistmainwindow.ui @@ -0,0 +1,140 @@ + + + PlayListMainWindow + + + + 0 + 0 + 800 + 600 + + + + Playlist + + + + + + + + not yet done + + + + + not yet done + + + + + not yet done + + + + + + + + + + Play + + + + + + + Shuffle + + + true + + + + + + + Loop + + + true + + + + + + + Repeat + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Clear all + + + + + + + Remove + + + + + + + + + + + 0 + 0 + 800 + 25 + + + + + menu + + + + + + + Portrait Mode + + + + + Landscape Mode + + + + + + diff --git a/src/resource.qrc b/src/resource.qrc new file mode 100644 index 0000000..aeea2b6 --- /dev/null +++ b/src/resource.qrc @@ -0,0 +1,5 @@ + + + config-vlc.jpg + + diff --git a/src/ressources.qrc b/src/ressources.qrc new file mode 100644 index 0000000..0821e0c --- /dev/null +++ b/src/ressources.qrc @@ -0,0 +1,5 @@ + + + vlcremote_fr_FR.qm + + diff --git a/src/scanipdialog.cpp b/src/scanipdialog.cpp new file mode 100644 index 0000000..4de0efe --- /dev/null +++ b/src/scanipdialog.cpp @@ -0,0 +1,26 @@ +#include "scanipdialog.h" +#include "ui_scanipdialog.h" + +ScanIPDialog::ScanIPDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::ScanIPDialog) +{ + ui->setupUi(this); +} + +ScanIPDialog::~ScanIPDialog() +{ + delete ui; +} + +void ScanIPDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/scanipdialog.h b/src/scanipdialog.h new file mode 100644 index 0000000..0e3cdf4 --- /dev/null +++ b/src/scanipdialog.h @@ -0,0 +1,23 @@ +#ifndef SCANIPDIALOG_H +#define SCANIPDIALOG_H + +#include + +namespace Ui { + class ScanIPDialog; +} + +class ScanIPDialog : public QDialog { + Q_OBJECT +public: + explicit ScanIPDialog(QWidget *parent = 0); + ~ScanIPDialog(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::ScanIPDialog *ui; +}; + +#endif // SCANIPDIALOG_H diff --git a/src/scanipdialog.ui b/src/scanipdialog.ui new file mode 100644 index 0000000..e5aa69a --- /dev/null +++ b/src/scanipdialog.ui @@ -0,0 +1,83 @@ + + + ScanIPDialog + + + + 0 + 0 + 422 + 360 + + + + Dialog + + + + + + + + + + name + + + + + + + + + + IP + + + + + + + + + + + + + + + + + + + Scan + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Done + + + + + + + + + + diff --git a/src/src.pro b/src/src.pro new file mode 100644 index 0000000..35196ae --- /dev/null +++ b/src/src.pro @@ -0,0 +1,45 @@ +# ------------------------------------------------- +# Project created by QtCreator 2010-07-29T19:02:39 +# ------------------------------------------------- +QT += core \ + gui \ + network \ + xml \ + maemo5 +TARGET = vlc-remote +TEMPLATE = app +SOURCES += main.cpp \ + playlistmainwindow.cpp \ + playermainwindow.cpp \ + configdialog.cpp \ + aboutdialog.cpp \ + accountdialog.cpp \ + newaccountdialog.cpp \ + browsemainwindow.cpp \ + vlcbrowseelement.cpp \ + vlcplaylistelementsimple.cpp \ + vlcstatus.cpp \ + appsettings.cpp \ + favouritesmainwindow.cpp +HEADERS += playlistmainwindow.h \ + playermainwindow.h \ + configdialog.h \ + aboutdialog.h \ + accountdialog.h \ + newaccountdialog.h \ + browsemainwindow.h \ + vlcbrowseelement.h \ + vlcplaylistelementsimple.h \ + vlcstatus.h \ + appsettings.h \ + favouritesmainwindow.h +FORMS += playlistmainwindow.ui \ + playermainwindow.ui \ + configdialog.ui \ + aboutdialog.ui \ + accountdialog.ui \ + browsemainwindow.ui \ + favouritesmainwindow.ui +OTHER_FILES += vlc-remote.desktop +RESOURCES += ressources.qrc +TRANSLATIONS = vlcremote_fr_FR.ts diff --git a/src/vlc-remote.desktop b/src/vlc-remote.desktop new file mode 100644 index 0000000..82f4514 --- /dev/null +++ b/src/vlc-remote.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=0.2 +Type=Application +Terminal=true +Name=vlc-remote +Exec=/usr/bin/vlc-remote +Icon= +#X-Window-Icon=timerwidget +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/src/vlc-remote.png b/src/vlc-remote.png new file mode 100644 index 0000000..7f58140 Binary files /dev/null and b/src/vlc-remote.png differ diff --git a/src/vlcbrowseelement.cpp b/src/vlcbrowseelement.cpp new file mode 100644 index 0000000..f865632 --- /dev/null +++ b/src/vlcbrowseelement.cpp @@ -0,0 +1,19 @@ +/* VLC-REMOTE for MAEMO 5 + * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave + * 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 "vlcbrowseelement.h" + diff --git a/src/vlcbrowseelement.h b/src/vlcbrowseelement.h new file mode 100644 index 0000000..b263b10 --- /dev/null +++ b/src/vlcbrowseelement.h @@ -0,0 +1,33 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 VLCBROWSEELEMENT_H +#define VLCBROWSEELEMENT_H +#include +#include + +struct VlcBrowseElement { + QString type; + int size; + QDate date; + QString path; + QString name; + QString extension; +} ; + + +#endif // VLCBROWSEELEMENT_H diff --git a/src/vlcplaylistelementsimple.cpp b/src/vlcplaylistelementsimple.cpp new file mode 100644 index 0000000..08eb506 --- /dev/null +++ b/src/vlcplaylistelementsimple.cpp @@ -0,0 +1,18 @@ +/* VLC-REMOTE for MAEMO 5 + * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave + * 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 "vlcplaylistelementsimple.h" diff --git a/src/vlcplaylistelementsimple.h b/src/vlcplaylistelementsimple.h new file mode 100644 index 0000000..a49dea8 --- /dev/null +++ b/src/vlcplaylistelementsimple.h @@ -0,0 +1,33 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 VLCPLAYLISTELEMENTSIMPLE_H +#define VLCPLAYLISTELEMENTSIMPLE_H + +#include + +struct VlcPlayListElementSimple { + int id; // vlc playlist item id + int depth; // how deep in the tree + bool playing; // currently playing item + QString type; // node or leaf + QString extension; // file extension + QString path; // Only used for leaf - repeat name otherwise + QString name; // name or metadata title if available +} ; + +#endif // VLCPLAYLISTELEMENTSIMPLE_H diff --git a/src/vlcremote_fr_FR.qm b/src/vlcremote_fr_FR.qm new file mode 100644 index 0000000..7ce38ca Binary files /dev/null and b/src/vlcremote_fr_FR.qm differ diff --git a/src/vlcremote_fr_FR.ts b/src/vlcremote_fr_FR.ts new file mode 100644 index 0000000..5204e2a --- /dev/null +++ b/src/vlcremote_fr_FR.ts @@ -0,0 +1,433 @@ + + + + + AboutDialog + + + Dialog + À propos + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OMed </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application by Sacha schutz </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">istdasklar@gmail.com</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">http://omedsoft.blogspot.com/</span></a></p></td></tr></table></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> +<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OMed </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application par Sacha schutz </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">istdasklar@gmail.com</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">http://omedsoft.blogspot.com/</span></a></p></td></tr></table></body></html> + + + + AccountDialog + + + Accounts + Comptes + + + + test + test + + + + Add + Ajouter + + + + Edit + Éditer + + + + Remove + Supprimer + + + + Use + Utiliser + + + + BrowseMainWindow + + + MainWindow + Vlc remote + + + + Play + Lire + + + + Enqueue + Ajouter + + + + Browse + Ouvrir + + + + menu + + + + + User Folder + Utiliser + + + + Home + Dossier d'accueil + + + + Set as Home + Marquer comme dossier d'accueil + + + + Favourites + Favoris + + + + Add to Favourite + Ajouter aux favoris + + + configuration + Configuration + + + About + À propos + + + + Directory could not be browsed! + Le dossier ne peux être listé ! + + + + ConfigDialog + + + Dialog + Configuration + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Enter IP of VLC server. </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Example : <span style=" font-weight:600;">192.168.0.8:8080</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Be sure you have properly configured Vlc</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> and allows connection by adding this IP in /vlc/http/.hosts</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">More information on my blog : <a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">omed.blogspot.com</span></a><br /></p></td></tr></table></body></html> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> +<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> +<tr> +<td style="border: none;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Mettre l'ip du Serveur VLC.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Exemple : <span style=" font-weight:600;">192.168.0.8:8080</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Vous devez avoir configurer VLC correctement</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> et autoriser les connexions en ajoutant l'ip de votre N900 dans /vlc/http/.hosts</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Plus d'informations sur mon blog : <a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">omed.blogspot.com</span></a><br /></p></td></tr></table></body></html> + + + + FavouritesMainWindow + + + MainWindow + Vlc remote + + + + Name + Nom + + + + Save + Sauvegarder + + + + Delete + Supprimer + + + + Edit + Éditer + + + + Browse + Ouvrir + + + + Set as Home + Dossier d'accueil + + + + NewAccountDialog + + + Add account + Ajouter un compte + + + + Name: + Nom : + + + + Ip: + Ip : + + + + Port: + Port : + + + + Edit account + Édition d'un compte + + + + PlayListMainWindow + + MainWindow + Vlc remote + + + + Playlist + Liste de lecture + + + + + + not yet done + fonctions pas encore développée + + + Clear + Vider + + + + Play + Lire + + + + Shuffle + Aléatoire + + + + Loop + Boucler + + + + Repeat + Répéter + + + + Clear all + Vider + + + + Remove + Supprimer + + + + menu + + + + + Portrait Mode + Mode Portrait + + + + Landscape Mode + Mode Paysage + + + configuration + Configuration + + + About + À propos + + + + Playlist could not be retrieved. + Impossible de récupérer la liste de lecture. + + + + PlayerMainWindow + + MainWindow + Vlc remote + + + + Vlc-Remote + Vlc-Remote + + + + + + Information + Information + + + + < + < + + + play + Lire + + + + > + > + + + Pause + Pause + + + play/pause + Lire/Pause + + + + Stop + Stop + + + + FS + FS + + + + V+ + V+ + + + + V- + V- + + + mute + Couper le son + + + + Play/Pause + Lecture/Pause + + + + Mute + Couper le son + + + + PlayList + Liste de lecture + + + + Browse + Ouvrir + + + + menu + + + + + Configuration + Configuration + + + + About + À propos + + + + Portrait Mode + Mode Portrait + + + + Landscape Mode + Mode Paysage + + + + Auto Rotate + À propos de l'orientation + + + diff --git a/src/vlcstatus.cpp b/src/vlcstatus.cpp new file mode 100644 index 0000000..0857f0b --- /dev/null +++ b/src/vlcstatus.cpp @@ -0,0 +1,18 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 "vlcstatus.h" diff --git a/src/vlcstatus.h b/src/vlcstatus.h new file mode 100644 index 0000000..738780a --- /dev/null +++ b/src/vlcstatus.h @@ -0,0 +1,46 @@ +/* VLC-REMOTE for MAEMO 5 +* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave +* 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 VLCSTATUS_H +#define VLCSTATUS_H +#include + +enum VlcStatusState { + UNKNOWN, + STOP, + PLAYING, + PAUSED +}; + +struct VlcStatus { + bool newtrack; + bool random; + bool loop; + bool repeat; + bool hasart; + int volume; + int length; + int time; + int position; + VlcStatusState state; + QString title; + QString artist; + QString album; + QString nowplaying; +}; + +#endif // VLCSTATUS_H diff --git a/src/welcome b/src/welcome new file mode 100644 index 0000000..e69de29 diff --git a/todo.txt b/todo.txt deleted file mode 100644 index 9daeafb..0000000 --- a/todo.txt +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/vlc-remote.desktop b/vlc-remote.desktop deleted file mode 100644 index 82f4514..0000000 --- a/vlc-remote.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=0.2 -Type=Application -Terminal=true -Name=vlc-remote -Exec=/usr/bin/vlc-remote -Icon= -#X-Window-Icon=timerwidget -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/vlc-remote.png b/vlc-remote.png deleted file mode 100644 index 7f58140..0000000 Binary files a/vlc-remote.png and /dev/null differ diff --git a/vlc-remote.pro b/vlc-remote.pro new file mode 100644 index 0000000..d97061d --- /dev/null +++ b/vlc-remote.pro @@ -0,0 +1,8 @@ +QMAKEVERSION = $$[QMAKE_VERSION] +ISQT4 = $$find(QMAKEVERSION, ^[2-9]) +isEmpty( ISQT4 ) { +error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4"); +} + +TEMPLATE = subdirs +SUBDIRS = src diff --git a/vlcRemote.pro b/vlcRemote.pro deleted file mode 100644 index 35196ae..0000000 --- a/vlcRemote.pro +++ /dev/null @@ -1,45 +0,0 @@ -# ------------------------------------------------- -# Project created by QtCreator 2010-07-29T19:02:39 -# ------------------------------------------------- -QT += core \ - gui \ - network \ - xml \ - maemo5 -TARGET = vlc-remote -TEMPLATE = app -SOURCES += main.cpp \ - playlistmainwindow.cpp \ - playermainwindow.cpp \ - configdialog.cpp \ - aboutdialog.cpp \ - accountdialog.cpp \ - newaccountdialog.cpp \ - browsemainwindow.cpp \ - vlcbrowseelement.cpp \ - vlcplaylistelementsimple.cpp \ - vlcstatus.cpp \ - appsettings.cpp \ - favouritesmainwindow.cpp -HEADERS += playlistmainwindow.h \ - playermainwindow.h \ - configdialog.h \ - aboutdialog.h \ - accountdialog.h \ - newaccountdialog.h \ - browsemainwindow.h \ - vlcbrowseelement.h \ - vlcplaylistelementsimple.h \ - vlcstatus.h \ - appsettings.h \ - favouritesmainwindow.h -FORMS += playlistmainwindow.ui \ - playermainwindow.ui \ - configdialog.ui \ - aboutdialog.ui \ - accountdialog.ui \ - browsemainwindow.ui \ - favouritesmainwindow.ui -OTHER_FILES += vlc-remote.desktop -RESOURCES += ressources.qrc -TRANSLATIONS = vlcremote_fr_FR.ts diff --git a/vlcbrowseelement.cpp b/vlcbrowseelement.cpp deleted file mode 100644 index f865632..0000000 --- a/vlcbrowseelement.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 - * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave - * 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 "vlcbrowseelement.h" - diff --git a/vlcbrowseelement.h b/vlcbrowseelement.h deleted file mode 100644 index b263b10..0000000 --- a/vlcbrowseelement.h +++ /dev/null @@ -1,33 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 VLCBROWSEELEMENT_H -#define VLCBROWSEELEMENT_H -#include -#include - -struct VlcBrowseElement { - QString type; - int size; - QDate date; - QString path; - QString name; - QString extension; -} ; - - -#endif // VLCBROWSEELEMENT_H diff --git a/vlcplaylistelementsimple.cpp b/vlcplaylistelementsimple.cpp deleted file mode 100644 index 08eb506..0000000 --- a/vlcplaylistelementsimple.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 - * Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave - * 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 "vlcplaylistelementsimple.h" diff --git a/vlcplaylistelementsimple.h b/vlcplaylistelementsimple.h deleted file mode 100644 index a49dea8..0000000 --- a/vlcplaylistelementsimple.h +++ /dev/null @@ -1,33 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 VLCPLAYLISTELEMENTSIMPLE_H -#define VLCPLAYLISTELEMENTSIMPLE_H - -#include - -struct VlcPlayListElementSimple { - int id; // vlc playlist item id - int depth; // how deep in the tree - bool playing; // currently playing item - QString type; // node or leaf - QString extension; // file extension - QString path; // Only used for leaf - repeat name otherwise - QString name; // name or metadata title if available -} ; - -#endif // VLCPLAYLISTELEMENTSIMPLE_H diff --git a/vlcremote_fr_FR.qm b/vlcremote_fr_FR.qm deleted file mode 100644 index 7ce38ca..0000000 Binary files a/vlcremote_fr_FR.qm and /dev/null differ diff --git a/vlcremote_fr_FR.ts b/vlcremote_fr_FR.ts deleted file mode 100644 index 5204e2a..0000000 --- a/vlcremote_fr_FR.ts +++ /dev/null @@ -1,433 +0,0 @@ - - - - - AboutDialog - - - Dialog - À propos - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> -<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OMed </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application by Sacha schutz </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">istdasklar@gmail.com</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">http://omedsoft.blogspot.com/</span></a></p></td></tr></table></body></html> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> -<table style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OMed </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Application par Sacha schutz </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">istdasklar@gmail.com</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">http://omedsoft.blogspot.com/</span></a></p></td></tr></table></body></html> - - - - AccountDialog - - - Accounts - Comptes - - - - test - test - - - - Add - Ajouter - - - - Edit - Éditer - - - - Remove - Supprimer - - - - Use - Utiliser - - - - BrowseMainWindow - - - MainWindow - Vlc remote - - - - Play - Lire - - - - Enqueue - Ajouter - - - - Browse - Ouvrir - - - - menu - - - - - User Folder - Utiliser - - - - Home - Dossier d'accueil - - - - Set as Home - Marquer comme dossier d'accueil - - - - Favourites - Favoris - - - - Add to Favourite - Ajouter aux favoris - - - configuration - Configuration - - - About - À propos - - - - Directory could not be browsed! - Le dossier ne peux être listé ! - - - - ConfigDialog - - - Dialog - Configuration - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> -<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Enter IP of VLC server. </p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Example : <span style=" font-weight:600;">192.168.0.8:8080</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Be sure you have properly configured Vlc</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> and allows connection by adding this IP in /vlc/http/.hosts</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">More information on my blog : <a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">omed.blogspot.com</span></a><br /></p></td></tr></table></body></html> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:14pt; font-weight:400; font-style:normal;"> -<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Mettre l'ip du Serveur VLC.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Exemple : <span style=" font-weight:600;">192.168.0.8:8080</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Vous devez avoir configurer VLC correctement</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> et autoriser les connexions en ajoutant l'ip de votre N900 dans /vlc/http/.hosts</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Plus d'informations sur mon blog : <a href="http://omedsoft.blogspot.com/"><span style=" text-decoration: underline; color:#0000ff;">omed.blogspot.com</span></a><br /></p></td></tr></table></body></html> - - - - FavouritesMainWindow - - - MainWindow - Vlc remote - - - - Name - Nom - - - - Save - Sauvegarder - - - - Delete - Supprimer - - - - Edit - Éditer - - - - Browse - Ouvrir - - - - Set as Home - Dossier d'accueil - - - - NewAccountDialog - - - Add account - Ajouter un compte - - - - Name: - Nom : - - - - Ip: - Ip : - - - - Port: - Port : - - - - Edit account - Édition d'un compte - - - - PlayListMainWindow - - MainWindow - Vlc remote - - - - Playlist - Liste de lecture - - - - - - not yet done - fonctions pas encore développée - - - Clear - Vider - - - - Play - Lire - - - - Shuffle - Aléatoire - - - - Loop - Boucler - - - - Repeat - Répéter - - - - Clear all - Vider - - - - Remove - Supprimer - - - - menu - - - - - Portrait Mode - Mode Portrait - - - - Landscape Mode - Mode Paysage - - - configuration - Configuration - - - About - À propos - - - - Playlist could not be retrieved. - Impossible de récupérer la liste de lecture. - - - - PlayerMainWindow - - MainWindow - Vlc remote - - - - Vlc-Remote - Vlc-Remote - - - - - - Information - Information - - - - < - < - - - play - Lire - - - - > - > - - - Pause - Pause - - - play/pause - Lire/Pause - - - - Stop - Stop - - - - FS - FS - - - - V+ - V+ - - - - V- - V- - - - mute - Couper le son - - - - Play/Pause - Lecture/Pause - - - - Mute - Couper le son - - - - PlayList - Liste de lecture - - - - Browse - Ouvrir - - - - menu - - - - - Configuration - Configuration - - - - About - À propos - - - - Portrait Mode - Mode Portrait - - - - Landscape Mode - Mode Paysage - - - - Auto Rotate - À propos de l'orientation - - - diff --git a/vlcstatus.cpp b/vlcstatus.cpp deleted file mode 100644 index 0857f0b..0000000 --- a/vlcstatus.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 "vlcstatus.h" diff --git a/vlcstatus.h b/vlcstatus.h deleted file mode 100644 index 738780a..0000000 --- a/vlcstatus.h +++ /dev/null @@ -1,46 +0,0 @@ -/* VLC-REMOTE for MAEMO 5 -* Copyright (C) 2010 Schutz Sacha , Dru Moore , Yann Nave -* 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 VLCSTATUS_H -#define VLCSTATUS_H -#include - -enum VlcStatusState { - UNKNOWN, - STOP, - PLAYING, - PAUSED -}; - -struct VlcStatus { - bool newtrack; - bool random; - bool loop; - bool repeat; - bool hasart; - int volume; - int length; - int time; - int position; - VlcStatusState state; - QString title; - QString artist; - QString album; - QString nowplaying; -}; - -#endif // VLCSTATUS_H diff --git a/welcome b/welcome deleted file mode 100644 index e69de29..0000000 diff --git a/www/index.html b/www/index.html index d1ce30c..8281167 100644 --- a/www/index.html +++ b/www/index.html @@ -57,20 +57,28 @@

Les procèdures sont similaires suivant votre système d'exploitation ( Windows/Linux/Mac OS)

Nous considèrons ici que vous avez déjà installé VLC sur votre ordinateur

Linux

-
    +
    1. Démarrez VLC
    2. Cliquez sur le menu Outils
    3. Cliquez sur Préférences, vous avez une fenêtre similaire à celle ci : - VLC - Outils -Préférences
    4. + VLC - Outils -Préférences
    5. Cliquez sur Tous en bas à gauche de la fenêtre, la colonne de gauche contient maintenant une arboressence de menu
    6. -
    7. Double cliquez sur Interface, puis sur Interfaces Principales - VLC - Outils -Préférences - Interfaces principales http
    8. - +
    9. Double cliquez sur Interface, puis sur Interfaces Principales.
      + Cocher la case Interface de commande à distance HTTP. + VLC - Outils -Préférences - Interfaces principales http
    10. +
    11. + Dans l'arborescence à gauche cliquez sur HTTP en dessous d'Interfaces principales.
      + Cochez la case Exporter la jaquette vers « /art »
      + Cliquez sur Enregistrer pour valider les paramètres et fermer la fenêtre, puis redémarez VLC. + VLC - Outils -Préférences - Interfaces principales http - art +

    Windows

    Mac OS

    + +

    Configurer Vlc-remote sur votre mobile

    Lorsque vous démarez l'application la fenêtre de gestion de compte apparait.
    Elle vous permet d'enregistrer plusieurs machines, ainsi vous pouvez facilement accèder @@ -78,10 +86,8 @@

    Gestionnaire de compte

    - Copite d'écran du gestionnaire de compte - -
      +
      1. Ajouter

        Un compte contient les éléments suivants :

          @@ -107,6 +113,11 @@
        +

        Utiliser

        +

        L'affichage principale permet de controler la vidéo en cours + de lecture, de consulter la playlist et de naviguer dans les + repertoires de l'ordinateur sur leque Vlc est en cours d'éxecution. +

        Retour menu

        4. Licence

        diff --git a/www/styles.css b/www/styles.css index 8886fd8..9c41fe6 100644 --- a/www/styles.css +++ b/www/styles.css @@ -117,4 +117,8 @@ a:hover { text-decoration: underline; } -p { margin-left: 1em; } \ No newline at end of file +p { margin-left: 1em; } + +.instructions img{ + width: 90%; +} \ No newline at end of file