2010-06-25 21:04:10 +02:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-06-26 00:36:21 +02:00
|
|
|
#include "devicelister.h"
|
2010-06-25 21:04:10 +02:00
|
|
|
|
2010-06-26 00:01:47 +02:00
|
|
|
#include <QThread>
|
|
|
|
#include <QtDebug>
|
|
|
|
|
2010-06-26 00:36:21 +02:00
|
|
|
DeviceLister::DeviceLister()
|
2010-06-26 00:01:47 +02:00
|
|
|
: thread_(NULL)
|
2010-06-25 21:04:10 +02:00
|
|
|
{
|
|
|
|
}
|
2010-06-26 00:01:47 +02:00
|
|
|
|
2010-06-26 00:36:21 +02:00
|
|
|
DeviceLister::~DeviceLister() {
|
2010-06-26 00:01:47 +02:00
|
|
|
qDebug() << __PRETTY_FUNCTION__;
|
|
|
|
if (thread_) {
|
|
|
|
thread_->quit();
|
|
|
|
thread_->wait(1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-26 00:36:21 +02:00
|
|
|
void DeviceLister::Start() {
|
2010-06-26 00:01:47 +02:00
|
|
|
thread_ = new QThread;
|
|
|
|
connect(thread_, SIGNAL(started()), SLOT(ThreadStarted()));
|
|
|
|
|
|
|
|
moveToThread(thread_);
|
|
|
|
thread_->start();
|
|
|
|
}
|
|
|
|
|
2010-06-26 00:36:21 +02:00
|
|
|
void DeviceLister::ThreadStarted() {
|
2010-06-26 00:01:47 +02:00
|
|
|
Init();
|
|
|
|
}
|