#include "configdialog.h"
#include "aboutdialog.h"
#include "vlcbrowseelement.h"
-
+#include "accountdialog.h"
BrowseMainWindow::BrowseMainWindow(QWidget *parent) :
QMainWindow(parent),
mCurrentDir = "~/"; // This works on win as well as linux, would guess mac too.
setWindowTitle("Vlc remote");
- QSettings settings;
- mIp = settings.value("ip").toString();
mNetManager = new QNetworkAccessManager(this);
connect(ui->playButton,SIGNAL(clicked()),this,SLOT(onPlay()));
connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged()));
- this->browseDirectory(mCurrentDir);
+ init();
+
+
+}
+void BrowseMainWindow::init() // THIS METHOD IS CALLED WHEN CONFIG CHANGED...
+{
+ mIp = AccountDialog::currentIp();
+ browseDirectory(mCurrentDir);
}
BrowseMainWindow::~BrowseMainWindow()
void BrowseMainWindow::onAddToPlaylist() {
/*QNetworkReply * reply = */ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=in_enqueue&input=" + mCurrentElement.path)));
-}
+ }
void BrowseMainWindow::onPlay() {
/*QNetworkReply * reply = */ mNetManager->get(QNetworkRequest(QUrl("http://"+mIp+"/requests/status.xml?command=in_play&input=" + mCurrentElement.path)));
-}
+ }
void BrowseMainWindow::browseDirectory(QString dir) {
mContents->clear();
void BrowseMainWindow::writeFile(QString path, QByteArray text) {
QFile file(path);
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
- return;
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ return;
- QTextStream out(&file);
- out << text;
+ QTextStream out(&file);
+ out << text;
}
void BrowseMainWindow::updateList() {