#include "remote.h"
#include "remotelistwidgetitem.h"
+#include "onlinepollerthread.h"
#include <QHBoxLayout>
#include <QLabel>
this->setLayout(layout);
connect(&remoteDBMgr, SIGNAL(dbReady(RemoteDB*)),
this, SLOT(setDB(RemoteDB*)));
- remoteDBMgr.getDBAsync();
- setBusy(true);
}
-
SelectRemoteDlg::~SelectRemoteDlg()
{
delete layout;
+ if (onlinePollerThread != NULL) {
+ onlinePollerThread->quit();
+ delete onlinePollerThread;
+ onlinePollerThread = NULL;
+ }
}
void SelectRemoteDlg::setDB(RemoteDB *db)
connect(currentModel->remote(), SIGNAL(saveFinished()),
this, SLOT(close()));
currentModel->remote()->saveToFile();
+
+ emit remoteChanged(*(currentModel->remote()));
+ }
+}
+
+void SelectRemoteDlg::getDB()
+{
+ if (onlinePollerThread != NULL) {
+ onlinePollerThread->quit();
+ delete onlinePollerThread;
+ onlinePollerThread = NULL;
}
+ remoteDBMgr.getDBAsync();
+}
+
+void SelectRemoteDlg::refreshDB()
+{
+ setBusy(true);
+ if (onlinePollerThread != NULL) {
+ delete onlinePollerThread;
+ }
+ onlinePollerThread = new OnlinePollerThread();
+ connect(onlinePollerThread, SIGNAL(online()),
+ this, SLOT(getDB()));
+ onlinePollerThread->run();
+}
+
+void SelectRemoteDlg::showEvent(QShowEvent *event)
+{
+ refreshDB();
+ QDialog::showEvent(event);
}