From: schutz Date: Sun, 15 Aug 2010 19:37:06 +0000 (+0200) Subject: Start to add an asynchronious function to test each IP. (not working yet) X-Git-Tag: v0.5~56 X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=b376c5a6db43dbeca79e41e62de10ec0c87c0099;hp=66170fc0b9f8feeed1f22145b8e373e9d5fa8256;p=vlc-remote Start to add an asynchronious function to test each IP. (not working yet) --- diff --git a/accountdialog.cpp b/accountdialog.cpp index 4256d06..009e220 100644 --- a/accountdialog.cpp +++ b/accountdialog.cpp @@ -5,7 +5,8 @@ #include #include #include - +#include +#include AccountDialog::AccountDialog(QWidget *parent) : QDialog(parent), ui(new Ui::AccountDialog) @@ -52,16 +53,6 @@ void AccountDialog::load() { 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->setData(Qt::UserRole, settings.value(key)); if (useKey == key) { @@ -72,8 +63,40 @@ void AccountDialog::load() ui->listWidget->addItem(item); } settings.endGroup(); + + + } + +void AccountDialog::asyncTestConnection() +{ + QSettings settings; + settings.beginGroup("account"); + + for ( int i=0; ilistWidget->count(); ++i) + { + + QListWidgetItem * item = ui->listWidget->item(i); + QString key = item->text(); + QString hostIp = settings.value(key).toString(); + qDebug()<connectToHost(hostIp, 80); + + if (socket->waitForConnected(1000)) + item->setBackgroundColor(Qt::green); + else + item->setBackgroundColor(Qt::red); + + + } + + settings.endGroup(); + +} + + void AccountDialog::edit() { QString currentIp = ui->listWidget->currentItem()->data(Qt::UserRole).toString(); diff --git a/accountdialog.h b/accountdialog.h index 11cdda1..75d64a3 100644 --- a/accountdialog.h +++ b/accountdialog.h @@ -14,6 +14,9 @@ class AccountDialog : public QDialog public: explicit AccountDialog(QWidget *parent = 0); ~AccountDialog(); + void asyncTestConnection(); + + public slots: void add();