add Yannux version with account manager
authorschutz <schutz@schutz.(none)>
Sun, 15 Aug 2010 18:54:26 +0000 (20:54 +0200)
committerschutz <schutz@schutz.(none)>
Sun, 15 Aug 2010 18:54:26 +0000 (20:54 +0200)
15 files changed:
Maemo_VLC_remote.svg [new file with mode: 0644]
accountdialog.cpp
accountdialog.h
accountdialog.ui
configdialog.cpp
newaccountdialog.cpp [new file with mode: 0644]
newaccountdialog.h [new file with mode: 0644]
playermainwindow.cpp
playermainwindow.h
playermainwindow.ui
playlistmainwindow.ui
todo.txt
vlcRemote.pro
vlcremote_fr_FR.qm
vlcremote_fr_FR.ts

diff --git a/Maemo_VLC_remote.svg b/Maemo_VLC_remote.svg
new file mode 100644 (file)
index 0000000..83ad807
--- /dev/null
@@ -0,0 +1,453 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="64px"
+   height="64px"
+   id="svg2816"
+   version="1.1"
+   inkscape:version="0.47 r22583"
+   sodipodi:docname="Maemo_VLC_remote.svg"
+   inkscape:export-filename="/home/eugene/Downloads/likalo/icons/Maemo_VLC_remote.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <defs
+     id="defs2818">
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3979">
+      <stop
+         style="stop-color:#e6eff7;stop-opacity:1;"
+         offset="0"
+         id="stop3981" />
+      <stop
+         style="stop-color:#e6eff7;stop-opacity:0;"
+         offset="1"
+         id="stop3983" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3791">
+      <stop
+         style="stop-color:#8b8b8b;stop-opacity:1"
+         offset="0"
+         id="stop3793" />
+      <stop
+         style="stop-color:#050505;stop-opacity:1"
+         offset="1"
+         id="stop3795" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient3687">
+      <stop
+         style="stop-color:#f2f2f2;stop-opacity:1;"
+         offset="0"
+         id="stop3689" />
+      <stop
+         style="stop-color:#f2f2f2;stop-opacity:0;"
+         offset="1"
+         id="stop3691" />
+    </linearGradient>
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 32 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="64 : 32 : 1"
+       inkscape:persp3d-origin="32 : 21.333333 : 1"
+       id="perspective2824" />
+    <filter
+       inkscape:collect="always"
+       id="filter3756"
+       x="-0.1344"
+       width="1.2688"
+       y="-0.336"
+       height="1.672">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="1.68"
+         id="feGaussianBlur3758" />
+    </filter>
+    <inkscape:perspective
+       id="perspective3840"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3687"
+       id="linearGradient3854"
+       gradientUnits="userSpaceOnUse"
+       x1="32"
+       y1="22"
+       x2="32"
+       y2="52.066593"
+       gradientTransform="matrix(1.111111,0,0,1,-3.5555554,-1)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3791"
+       id="linearGradient3865"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="pad"
+       x1="44"
+       y1="-30"
+       x2="48"
+       y2="-32" />
+    <filter
+       inkscape:collect="always"
+       id="filter3949"
+       x="-0.17035383"
+       width="1.3407077"
+       y="-0.045646171"
+       height="1.0912923">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="0.91101842"
+         id="feGaussianBlur3951" />
+    </filter>
+    <filter
+       inkscape:collect="always"
+       id="filter3959"
+       x="-0.055835792"
+       width="1.1116716"
+       y="-0.34203537"
+       height="1.6840707">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="0.11718901"
+         id="feGaussianBlur3961" />
+    </filter>
+    <filter
+       inkscape:collect="always"
+       id="filter3969">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="0.32"
+         id="feGaussianBlur3971" />
+    </filter>
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3979"
+       id="radialGradient3987"
+       cx="34.5"
+       cy="32.5"
+       fx="26.331987"
+       fy="28.26091"
+       r="20.5"
+       gradientTransform="matrix(1.0286932,-0.00554309,4.8548147e-4,0.09009624,-1.0056937,29.763108)"
+       gradientUnits="userSpaceOnUse" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3979"
+       id="radialGradient3991"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.62725195,-0.00554309,2.9602529e-4,0.09009624,23.850187,10.763108)"
+       cx="34.5"
+       cy="32.5"
+       fx="26.331987"
+       fy="28.26091"
+       r="20.5" />
+    <filter
+       inkscape:collect="always"
+       id="filter4001"
+       x="-0.024585366"
+       width="1.0491707"
+       y="-1.008"
+       height="3.016">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="0.42"
+         id="feGaussianBlur4003" />
+    </filter>
+    <filter
+       inkscape:collect="always"
+       id="filter4009"
+       x="-0.624"
+       width="2.248"
+       y="-0.02496"
+       height="1.04992">
+      <feGaussianBlur
+         inkscape:collect="always"
+         stdDeviation="0.26"
+         id="feGaussianBlur4011" />
+    </filter>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3687"
+       id="linearGradient4020"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.111111,0,0,1,0.4444446,-1)"
+       x1="32"
+       y1="22"
+       x2="32"
+       y2="52.066593" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3791"
+       id="linearGradient4026"
+       gradientUnits="userSpaceOnUse"
+       spreadMethod="pad"
+       x1="44"
+       y1="-30"
+       x2="48"
+       y2="-32"
+       gradientTransform="translate(0,-4)" />
+    <inkscape:perspective
+       id="perspective2875"
+       inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+       inkscape:vp_z="1 : 0.5 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_x="0 : 0.5 : 1"
+       sodipodi:type="inkscape:persp3d" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3791"
+       id="linearGradient2937"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(0,-4)"
+       spreadMethod="pad"
+       x1="44"
+       y1="-30"
+       x2="48"
+       y2="-32" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3687"
+       id="linearGradient2939"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.111111,0,0,1,0.4444446,-1)"
+       x1="32"
+       y1="22"
+       x2="32"
+       y2="52.066593" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3979"
+       id="radialGradient2941"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.0286932,-0.00554309,4.8548147e-4,0.09009624,-1.0056937,29.763108)"
+       cx="34.5"
+       cy="32.5"
+       fx="26.331987"
+       fy="28.26091"
+       r="20.5" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3979"
+       id="radialGradient2943"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.62725195,-0.00554309,2.9602529e-4,0.09009624,23.850187,10.763108)"
+       cx="34.5"
+       cy="32.5"
+       fx="26.331987"
+       fy="28.26091"
+       r="20.5" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="9.671875"
+     inkscape:cx="28.015642"
+     inkscape:cy="25.696712"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:document-units="px"
+     inkscape:grid-bbox="true"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     inkscape:snap-global="true"
+     inkscape:window-width="1640"
+     inkscape:window-height="1027"
+     inkscape:window-x="36"
+     inkscape:window-y="-4"
+     inkscape:window-maximized="1">
+    <sodipodi:guide
+       orientation="1,0"
+       position="4,52.545455"
+       id="guide2826" />
+    <sodipodi:guide
+       orientation="1,0"
+       position="60,40"
+       id="guide2828" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="31,61"
+       id="guide2830" />
+    <sodipodi:guide
+       orientation="0,1"
+       position="45.454545,4"
+       id="guide2832" />
+    <inkscape:grid
+       type="xygrid"
+       id="grid2836" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata2821">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1"
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer">
+    <g
+       id="g2912"
+       transform="matrix(0.99828455,0,0,1.016587,0.00669673,-0.97863428)"
+       inkscape:export-filename="/home/schutz/programmation/git-vlc-remote/vlc-remote.png"
+       inkscape:export-xdpi="116"
+       inkscape:export-ydpi="116">
+      <path
+         id="path3885"
+         d="m 29.124008,4 -18.030258,49.555556 -6.010086,0 c -0.6536613,0 -1.1798942,0.526232 -1.1798942,1.179894 l 0,1.179894 c 0,0.653661 0.5262329,1.179895 1.1798942,1.179895 l 4.7195768,0 42.4761912,0 4.719576,0 c 0.653661,0 1.179894,-0.526234 1.179894,-1.179895 l 0,-1.179894 c 0,-0.653662 -0.526233,-1.179894 -1.179894,-1.179894 l -6.08383,0 L 32,4 29.124008,4 z"
+         style="fill:#e97f02;stroke:none" />
+      <path
+         sodipodi:nodetypes="cccccccccc"
+         id="path3913"
+         d="M 31,4 34.1875,54 35,57 57.46875,57 c 0.423766,-0.178644 0.71875,-0.603504 0.71875,-1.09375 l 0,-1.15625 c 0,-0.653662 -0.533839,-1.1875 -1.1875,-1.1875 l -6.09375,0 L 32,4 31,4 z"
+         style="fill:#eb6841;stroke:none" />
+      <path
+         sodipodi:nodetypes="cccc"
+         id="path3963"
+         d="M 32,6 48,54 43,54 32,6 z"
+         style="fill:#cc333f;stroke:none;filter:url(#filter3969)" />
+      <path
+         id="rect3908"
+         d="m 3.90625,55.657986 0,0.62145 c 0,0.44824 0.5338387,0.814314 1.1875,0.814314 l 4.71875,0 42.46875,0 4.71875,0 c 0.653661,0 1.1875,-0.366074 1.1875,-0.814314 l 0,-0.62145 -54.28125,0 z"
+         style="fill:#8e6c11;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         style="fill:#f8ca00;fill-opacity:1;fill-rule:nonzero;stroke:none"
+         d="m 27.562279,9 -1.683727,5 9.579819,0 -1.770816,-5 -6.125276,0 z M 24.165796,19 22.482071,24 39,24 37.229184,19 24.165796,19 z m -3.36745,10 -1.683725,5 23.427008,0 -1.770813,-5 -19.97247,0 z"
+         id="path3906" />
+      <path
+         sodipodi:nodetypes="cccc"
+         id="path3918"
+         d="M 29.053312,6.1001616 16.218589,54 24,54 29.053312,6.1001616 z"
+         style="fill:#f0db92;stroke:none;filter:url(#filter3949)" />
+      <path
+         id="rect3896"
+         d="m 27.961923,9 -1.477687,5 8.407527,0 -1.554119,-5 -5.375721,0 z M 24.981072,19 23.503386,24 38,24 36.445881,19 24.981072,19 z m -2.955373,10 -1.477686,5 20.560224,0 -1.554118,-5 -17.52842,0 z"
+         style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+      <path
+         id="path3953"
+         d="M 4.9628433,54.177706 10,54.177706 9.779667,55 5,55 4.9628433,54.177706 z"
+         style="fill:#f8ca00;stroke:none;filter:url(#filter3959)" />
+      <g
+         id="g4028">
+        <g
+           id="g2889">
+          <rect
+             transform="matrix(0,1,-1,0,0,0)"
+             ry="2"
+             rx="2"
+             y="-60"
+             x="31"
+             height="48"
+             width="28"
+             id="rect2834"
+             style="fill:url(#linearGradient2937);fill-opacity:1;fill-rule:nonzero;stroke:none" />
+          <rect
+             ry="1"
+             rx="1"
+             transform="matrix(0,1,-1,0,0,0)"
+             style="fill:#4a4a4a;fill-opacity:1;fill-rule:nonzero;stroke:none"
+             id="rect3610"
+             width="26"
+             height="46"
+             x="32"
+             y="-59" />
+          <rect
+             ry="2"
+             rx="2.181818"
+             y="-58"
+             x="-57"
+             height="44"
+             width="24"
+             id="rect3676"
+             style="fill:#050505;fill-opacity:1;fill-rule:nonzero;stroke:none"
+             transform="matrix(0,-1,-1,0,0,0)" />
+          <rect
+             y="-55"
+             x="-55"
+             height="38"
+             width="20"
+             id="rect3711"
+             style="fill:#303030;fill-opacity:1;fill-rule:nonzero;stroke:none"
+             transform="matrix(0,-1,-1,0,0,0)" />
+          <path
+             id="path3726"
+             d="M 16,34 16,46.21875 56,39.78125 56,34 16,34 z"
+             style="opacity:0.5;fill:url(#linearGradient2939);fill-opacity:1;fill-rule:nonzero;stroke:none" />
+          <path
+             style="fill:#69d2e7;fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3756)"
+             d="m 34,41 0,12 6,-6 -6,-6 z m -13,3 0,5 2,0 0,-5 -2,0 z m 3,0 0,5 2,0 0,-5 -2,0 z m 22,0 0,5 5,0 0,-5 -5,0 z"
+             id="path3742" />
+          <path
+             id="rect3719"
+             d="m 34,41 0,12 6,-6 -6,-6 z m -13,3 0,5 2,0 0,-5 -2,0 z m 3,0 0,5 2,0 0,-5 -2,0 z m 22,0 0,5 5,0 0,-5 -5,0 z"
+             style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+          <path
+             id="rect3768"
+             d="m 29.125,38 0,17 0.875,0 0,-17 -0.875,0 z M 43,38 l 0,17 0.875,0 0,-17 L 43,38 z"
+             style="fill:#1a1a21;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+          <rect
+             y="35"
+             x="17"
+             height="1.0000023"
+             width="38"
+             id="rect3867"
+             style="opacity:0.5;fill:#1a1a21;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+          <rect
+             y="32"
+             x="14"
+             height="1"
+             width="41"
+             id="rect3977"
+             style="opacity:0.5;fill:url(#radialGradient2941);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter4001)" />
+          <rect
+             transform="matrix(0,1,1,0,-0.31017771,0)"
+             style="fill:url(#radialGradient2943);fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter4009)"
+             id="rect3989"
+             width="25"
+             height="1"
+             x="33"
+             y="13" />
+          <rect
+             y="31.48435"
+             x="17"
+             height="1.5156504"
+             width="6.0000005"
+             id="rect3773"
+             style="fill:#bdbdbd;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+          <rect
+             y="34"
+             x="16"
+             height="2"
+             width="2"
+             id="rect3713"
+             style="fill:#69d2e7;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+        </g>
+      </g>
+    </g>
+  </g>
+</svg>
index 51a360a..4256d06 100644 (file)
@@ -1,8 +1,10 @@
 #include "accountdialog.h"
 #include "ui_accountdialog.h"
 #include "accountdialog.h"
 #include "ui_accountdialog.h"
+#include "newaccountdialog.h"
 #include <QDebug>
 #include <QInputDialog>
 #include <QSettings>
 #include <QDebug>
 #include <QInputDialog>
 #include <QSettings>
+#include <QTcpSocket>
 
 AccountDialog::AccountDialog(QWidget *parent) :
         QDialog(parent),
 
 AccountDialog::AccountDialog(QWidget *parent) :
         QDialog(parent),
@@ -13,9 +15,10 @@ AccountDialog::AccountDialog(QWidget *parent) :
     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->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()));
 
     connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(enableUi()));
 
-    load();  // On charge les compte
+    load();
 
 }
 
 
 }
 
@@ -23,62 +26,64 @@ AccountDialog::~AccountDialog()
 {
     delete ui;
 }
 {
     delete ui;
 }
+
 void AccountDialog::add()
 {
 void AccountDialog::add()
 {
-    QString ip = QInputDialog::getText(this,"ip?","enter your ip");
-    // On peut checker si c'est une bonne forme d'ip avec QRegExp
-
-    if (!ip.isEmpty()) {
-        QString ipKey = "Label"+ip;  // La faudra l'integré dans un widget personnalisé ( entrez le label, entrez l' IP)
-
-        QSettings settings;
-        settings.beginGroup("account");
-        settings.setValue(ipKey, ip);
-        settings.endGroup();
-
-        load(); // On recharge les compte
 
 
-    }
+    NewAccountDialog *dialog = new NewAccountDialog(this);
+    dialog->exec();
+    load();
 }
 }
+
 void AccountDialog::load()
 {
     ui->editButton->setEnabled(false);
     ui->remButton->setEnabled(false);
 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;
     ui->listWidget->clear(); // tjr effacer , sinon on rajoute
 
     QSettings settings;
+    settings.beginGroup("config");
+    QString useKey = settings.value("currentKey").toString();
+    settings.endGroup();
+
     settings.beginGroup("account");
     foreach ( QString key, settings.allKeys())
     {
         QListWidgetItem * item = new QListWidgetItem;
     settings.beginGroup("account");
     foreach ( QString key, settings.allKeys())
     {
         QListWidgetItem * item = new QListWidgetItem;
+
+        // ========> NEED TO USE QFUTUR
+        //        QString hostIp = settings.value(key).toString();
+        //        QTcpSocket * socket = new QTcpSocket(this);
+        //        socket->connectToHost(hostIp, 80);
+        //        if (socket->waitForConnected(1000))
+        //            item->setBackgroundColor(Qt::green);
+        //        else
+        //            item->setBackgroundColor(Qt::red);
+
+
         item->setText(key);
         item->setText(key);
-        item->setData(Qt::UserRole,settings.value(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);
         ui->listWidget->addItem(item);
-
     }
     settings.endGroup();    
 }
 
 void AccountDialog::edit()
 {
     }
     settings.endGroup();    
 }
 
 void AccountDialog::edit()
 {
-    QString currentValue = ui->listWidget->currentItem()->data(Qt::UserRole).toString();
+    QString currentIp = ui->listWidget->currentItem()->data(Qt::UserRole).toString();
     QString currentKey = ui->listWidget->currentItem()->text();
 
     QString currentKey = ui->listWidget->currentItem()->text();
 
+    NewAccountDialog *dialog = new NewAccountDialog(this);
+    dialog->edit(currentKey, currentIp);
+    dialog->exec();
 
 
-    QString ip = QInputDialog::getText(this, "ip ?", "enter your ip", QLineEdit::Normal, currentValue);
-
-    if (!ip.isEmpty()) {
-        QString ipKey = "Label"+ip;  // La faudra l'integré dans un widget personnalisé ( entrez le label, entrez l' IP)
-
-        QSettings settings;
-        settings.beginGroup("account");
-        settings.remove(currentKey);
-        settings.setValue(ipKey, ip);
-        settings.endGroup();
-
-        load();
-
-    }
+    load();
 }
 
 void AccountDialog::rem()
 }
 
 void AccountDialog::rem()
@@ -93,8 +98,21 @@ void AccountDialog::rem()
     load(); // On recharge les compte
 }
 
     load(); // On recharge les compte
 }
 
+void AccountDialog::use()
+{
+    QString currentKey = ui->listWidget->currentItem()->text();
+
+    QSettings settings;
+    settings.beginGroup("config");
+    settings.setValue("currentKey", currentKey);
+    settings.endGroup();
+
+    load();
+}
+
 void AccountDialog::enableUi()
 {
     ui->editButton->setEnabled(true);
     ui->remButton->setEnabled(true);
 void AccountDialog::enableUi()
 {
     ui->editButton->setEnabled(true);
     ui->remButton->setEnabled(true);
+    ui->useButton->setEnabled(true);
 }
 }
index ecdde58..11cdda1 100644 (file)
@@ -19,6 +19,7 @@ public slots:
     void add();
     void edit();
     void rem();
     void add();
     void edit();
     void rem();
+    void use();
     void load();
     void enableUi();
 
     void load();
     void enableUi();
 
index 3a7addd..8b0dd97 100644 (file)
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
    </rect>
   </property>
   <property name="windowTitle">
-   <string>Dialog</string>
+   <string>Accounts</string>
   </property>
   <layout class="QHBoxLayout" name="horizontalLayout">
    <item>
   </property>
   <layout class="QHBoxLayout" name="horizontalLayout">
    <item>
@@ -53,6 +53,9 @@
       </widget>
      </item>
      <item>
       </widget>
      </item>
      <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2"/>
+     </item>
+     <item>
       <spacer name="verticalSpacer">
        <property name="orientation">
         <enum>Qt::Vertical</enum>
       <spacer name="verticalSpacer">
        <property name="orientation">
         <enum>Qt::Vertical</enum>
        </property>
       </spacer>
      </item>
        </property>
       </spacer>
      </item>
+     <item>
+      <widget class="QPushButton" name="useButton">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="text">
+        <string>Use</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
   </layout>
     </layout>
    </item>
   </layout>
index 788319a..b65d414 100644 (file)
@@ -46,8 +46,6 @@ void ConfigDialog::changeEvent(QEvent *e)
 }
 void ConfigDialog::load()
 {
 }
 void ConfigDialog::load()
 {
-
-
     QSettings settings;
     ui->lineEdit->setText(settings.value("ip").toString());
 
     QSettings settings;
     ui->lineEdit->setText(settings.value("ip").toString());
 
@@ -60,7 +58,4 @@ void ConfigDialog::save()
     settings.setValue("ip",ui->lineEdit->text());
 
     emit accept();
     settings.setValue("ip",ui->lineEdit->text());
 
     emit accept();
-
-
-
 }
 }
diff --git a/newaccountdialog.cpp b/newaccountdialog.cpp
new file mode 100644 (file)
index 0000000..4f9c39e
--- /dev/null
@@ -0,0 +1,62 @@
+#include "newaccountdialog.h"
+#include <QFormLayout>
+#include <QDebug>
+#include <QSettings>
+//#include <QMaemo5InformationBox>
+
+NewAccountDialog::NewAccountDialog(QWidget *parent)
+{
+    this->setWindowTitle(tr("Add account"));
+
+    mMyKeyLineEdit = new QLineEdit;
+    mMyIpLineEdit = new QLineEdit;
+
+    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:"), mMyKeyLineEdit);
+    layout->addRow(tr("Ip:"), mMyIpLineEdit);
+    layout->addWidget(mButtonBox);
+
+    setLayout(layout);
+}
+
+void NewAccountDialog::save()
+{
+    QString myKey = mMyKeyLineEdit->text();
+    QString myIp = mMyIpLineEdit->text();
+
+    QSettings settings;
+    settings.beginGroup("account");
+    if (!mEditKey.isEmpty()) {
+        settings.remove(mEditKey);
+    }
+
+    if (!myIp.isEmpty() && !myKey.isEmpty()) {
+        settings.setValue(myKey, myIp);
+        // 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)
+{
+    this->setWindowTitle(tr("Edit account"));
+
+    mEditKey = key;
+    mEditIp = ip;
+
+    mMyKeyLineEdit->setText(key);
+    mMyKeyLineEdit->setDisabled(true);
+    mMyIpLineEdit->setText(ip);
+}
+
diff --git a/newaccountdialog.h b/newaccountdialog.h
new file mode 100644 (file)
index 0000000..85c8e25
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef NEWACCOUNTDIALOG_H
+#define NEWACCOUNTDIALOG_H
+
+#include <QDialog>
+#include <QLineEdit>
+#include <QLabel>
+#include <QDialogButtonBox>
+
+class NewAccountDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit NewAccountDialog(QWidget *parent = 0);
+    void edit(QString &key, QString &ip);
+
+public slots:
+    void save();
+
+private:
+    QLineEdit *mMyKeyLineEdit;
+    QLineEdit *mMyIpLineEdit;
+    QPushButton *mSavePushButton;
+    QPushButton *mCancelPushButton;
+    QDialogButtonBox *mButtonBox;
+
+    QString mEditKey;
+    QString mEditIp;
+};
+
+#endif // NEWACCOUNTDIALOG_H
index 24534f2..874944d 100644 (file)
@@ -21,7 +21,6 @@
 #include "ui_playermainwindow.h"
 #include "configdialog.h"
 #include "aboutdialog.h"
 #include "ui_playermainwindow.h"
 #include "configdialog.h"
 #include "aboutdialog.h"
-
 #include "accountdialog.h"
 
 
 #include "accountdialog.h"
 
 
@@ -32,11 +31,6 @@ PlayerMainWindow::PlayerMainWindow(QWidget *parent) :
     ui->setupUi(this);
     setWindowTitle("Vlc remote");
 
     ui->setupUi(this);
     setWindowTitle("Vlc remote");
 
-    QSettings settings;
-    mIp = settings.value("ip").toString();
-
-    if ( mIp.isEmpty())
-        showConfig();
 
 
     mTimer = new QTimer(this);
 
 
     mTimer = new QTimer(this);
@@ -77,8 +71,19 @@ PlayerMainWindow::PlayerMainWindow(QWidget *parent) :
     connect(ui->volDown,SIGNAL(clicked()),this,SLOT(volDown()));
     connect(ui->slider,SIGNAL(sliderMoved(int)),this,SLOT(slide(int)));
 
     connect(ui->volDown,SIGNAL(clicked()),this,SLOT(volDown()));
     connect(ui->slider,SIGNAL(sliderMoved(int)),this,SLOT(slide(int)));
 
-    mTimer->start(5000);
+    init();
+
+}
+void PlayerMainWindow::init()
+{
+    QSettings settings;
+    QString currentKey = settings.value("config/currentKey").toString();
+    mIp = settings.value("account/"+currentKey).toString()+":8080";
 
 
+    if ( mIp.isEmpty())
+        showConfig();
+    else
+        mTimer->start(5000);
 }
 
 PlayerMainWindow::~PlayerMainWindow()
 }
 
 PlayerMainWindow::~PlayerMainWindow()
@@ -148,8 +153,12 @@ void PlayerMainWindow::slide(int value)
 
 void PlayerMainWindow::showConfig()
 {
 
 void PlayerMainWindow::showConfig()
 {
-AccountDialog * dialog = new AccountDialog;
-dialog->exec();
+    mTimer->stop();
+    AccountDialog * dialog = new AccountDialog;
+    dialog->exec();
+    init();
+
+
 }
 void PlayerMainWindow::showAbout()
 {
 }
 void PlayerMainWindow::showAbout()
 {
@@ -159,13 +168,13 @@ void PlayerMainWindow::showAbout()
 
 }
 
 
 }
 
-
 void PlayerMainWindow::askStatus()
 {
 
     QNetworkReply * reply =  mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml")));
     connect(reply,SIGNAL(readyRead()),this,SLOT(parseXmlStatus()));
 }
 void PlayerMainWindow::askStatus()
 {
 
     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<QNetworkReply*>(sender());
 void PlayerMainWindow::parseXmlStatus()
 {
     QNetworkReply * reply = qobject_cast<QNetworkReply*>(sender());
@@ -180,9 +189,9 @@ void PlayerMainWindow::parseXmlStatus()
     QString state  =docElem.namedItem("state").toElement().text();
 
     QTime timeLength(0,0,0) ;
     QString state  =docElem.namedItem("state").toElement().text();
 
     QTime timeLength(0,0,0) ;
-   timeLength =  timeLength.addSecs(time);
+    timeLength =  timeLength.addSecs(time);
 
 
-ui->timeLabel->setText(timeLength.toString("mm:ss"));
+    ui->timeLabel->setText(timeLength.toString("mm:ss"));
 
 
     QDomNode infoNode =  docElem.namedItem("information");
 
 
     QDomNode infoNode =  docElem.namedItem("information");
index d11af4c..3572058 100644 (file)
@@ -52,6 +52,7 @@ protected slots:
     void parseXmlStatus();
 protected:
     void changeEvent(QEvent *e);
     void parseXmlStatus();
 protected:
     void changeEvent(QEvent *e);
+    void init();
 
 private:
     Ui::PlayerMainWindow *ui;
 
 private:
     Ui::PlayerMainWindow *ui;
index 2eaeaf9..efc167d 100644 (file)
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
    </rect>
   </property>
   <property name="windowTitle">
-   <string>MainWindow</string>
+   <string>Vlc-Remote</string>
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QVBoxLayout" name="verticalLayout">
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QVBoxLayout" name="verticalLayout">
      <x>0</x>
      <y>0</y>
      <width>800</width>
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>27</height>
+     <height>25</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuMenu">
     </rect>
    </property>
    <widget class="QMenu" name="menuMenu">
index 2eba144..b127009 100644 (file)
@@ -11,7 +11,7 @@
    </rect>
   </property>
   <property name="windowTitle">
    </rect>
   </property>
   <property name="windowTitle">
-   <string>MainWindow</string>
+   <string>Playlist</string>
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QVBoxLayout" name="verticalLayout">
   </property>
   <widget class="QWidget" name="centralwidget">
    <layout class="QVBoxLayout" name="verticalLayout">
@@ -96,7 +96,7 @@
      <x>0</x>
      <y>0</y>
      <width>800</width>
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>27</height>
+     <height>25</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuConfiguration">
     </rect>
    </property>
    <widget class="QMenu" name="menuConfiguration">
index 2969be3..9daeafb 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -1 +1 @@
-test 2
+test
index 236f92d..03738d6 100644 (file)
@@ -4,7 +4,7 @@
 #
 #-------------------------------------------------
 
 #
 #-------------------------------------------------
 
-QT       += core gui network xml
+QT       += core gui network xml maemo5
 
 TARGET = vlc-remote
 TEMPLATE = app
 
 TARGET = vlc-remote
 TEMPLATE = app
@@ -15,7 +15,8 @@ SOURCES += main.cpp\
     playermainwindow.cpp \
     configdialog.cpp \
     aboutdialog.cpp \
     playermainwindow.cpp \
     configdialog.cpp \
     aboutdialog.cpp \
-    accountdialog.cpp
+    accountdialog.cpp \
+    newaccountdialog.cpp
 
 
 HEADERS += \
 
 
 HEADERS += \
@@ -23,7 +24,8 @@ HEADERS += \
     playermainwindow.h \
     configdialog.h \
     aboutdialog.h \
     playermainwindow.h \
     configdialog.h \
     aboutdialog.h \
-    accountdialog.h
+    accountdialog.h \
+    newaccountdialog.h
 
 
 FORMS += \
 
 
 FORMS += \
@@ -31,8 +33,7 @@ FORMS += \
     playermainwindow.ui \
     configdialog.ui \
     aboutdialog.ui \
     playermainwindow.ui \
     configdialog.ui \
     aboutdialog.ui \
-    accountdialog.ui \
-    accountnewdialog.ui
+    accountdialog.ui
   
 
 OTHER_FILES += \
   
 
 OTHER_FILES += \
@@ -41,4 +42,3 @@ OTHER_FILES += \
 RESOURCES += \
     ressources.qrc
 
 RESOURCES += \
     ressources.qrc
 
-TRANSLATIONS = vlcremote_fr_FR.ts
index ed673a5..1b65df3 100644 (file)
Binary files a/vlcremote_fr_FR.qm and b/vlcremote_fr_FR.qm differ
index 018b60c..363746d 100644 (file)
@@ -35,6 +35,39 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
     </message>
 </context>
 <context>
+    <name>AccountDialog</name>
+    <message>
+        <location filename="accountdialog.ui" line="14"/>
+        <source>Accounts</source>
+        <translation>Comptes</translation>
+    </message>
+    <message>
+        <location filename="accountdialog.ui" line="21"/>
+        <source>test</source>
+        <translation>test</translation>
+    </message>
+    <message>
+        <location filename="accountdialog.ui" line="31"/>
+        <source>Add</source>
+        <translation>Ajouter</translation>
+    </message>
+    <message>
+        <location filename="accountdialog.ui" line="41"/>
+        <source>Edit</source>
+        <translation>Éditer</translation>
+    </message>
+    <message>
+        <location filename="accountdialog.ui" line="51"/>
+        <source>Remove</source>
+        <translation>Supprimer</translation>
+    </message>
+    <message>
+        <location filename="accountdialog.ui" line="77"/>
+        <source>Use</source>
+        <translation>Utiliser</translation>
+    </message>
+</context>
+<context>
     <name>ConfigDialog</name>
     <message>
         <location filename="configdialog.ui" line="14"/>
     <name>ConfigDialog</name>
     <message>
         <location filename="configdialog.ui" line="14"/>
@@ -70,11 +103,38 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
     </message>
 </context>
 <context>
+    <name>NewAccountDialog</name>
+    <message>
+        <location filename="newaccountdialog.cpp" line="9"/>
+        <source>Add account</source>
+        <translation>Ajouter un compte</translation>
+    </message>
+    <message>
+        <location filename="newaccountdialog.cpp" line="23"/>
+        <source>Name:</source>
+        <translation>Nom : </translation>
+    </message>
+    <message>
+        <location filename="newaccountdialog.cpp" line="24"/>
+        <source>Ip:</source>
+        <translation>Ip : </translation>
+    </message>
+    <message>
+        <location filename="newaccountdialog.cpp" line="53"/>
+        <source>Edit account</source>
+        <translation>Édition d&apos;un compte</translation>
+    </message>
+</context>
+<context>
     <name>PlayListMainWindow</name>
     <message>
     <name>PlayListMainWindow</name>
     <message>
-        <location filename="playlistmainwindow.ui" line="14"/>
         <source>MainWindow</source>
         <source>MainWindow</source>
-        <translation>Vlc remote</translation>
+        <translation type="obsolete">Vlc remote</translation>
+    </message>
+    <message>
+        <location filename="playlistmainwindow.ui" line="14"/>
+        <source>Playlist</source>
+        <translation>Liste de lecture</translation>
     </message>
     <message>
         <location filename="playlistmainwindow.ui" line="22"/>
     </message>
     <message>
         <location filename="playlistmainwindow.ui" line="22"/>
@@ -122,9 +182,13 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>PlayerMainWindow</name>
     <message>
 <context>
     <name>PlayerMainWindow</name>
     <message>
-        <location filename="playermainwindow.ui" line="14"/>
         <source>MainWindow</source>
         <source>MainWindow</source>
-        <translation>Vlc remote</translation>
+        <translation type="obsolete">Vlc remote</translation>
+    </message>
+    <message>
+        <location filename="playermainwindow.ui" line="14"/>
+        <source>Vlc-Remote</source>
+        <translation>Vlc-Remote</translation>
     </message>
     <message>
         <location filename="playermainwindow.ui" line="27"/>
     </message>
     <message>
         <location filename="playermainwindow.ui" line="27"/>