From a7e6314c81499afea2a45e45d3baa239d8318a58 Mon Sep 17 00:00:00 2001 From: Torste Aikio Date: Wed, 23 Jun 2010 11:18:19 +0300 Subject: [PATCH] misc bugfixes and enchantments --- debian/postinst | 1 + debian/postrm | 2 +- src/irctrl.cpp | 8 ++++++++ src/irctrl.h | 2 +- src/remote.cpp | 1 + src/selectremotedlg.cpp | 2 +- src/settingsdlg.cpp | 9 +++++++++ src/settingsdlg.h | 1 + 8 files changed, 23 insertions(+), 3 deletions(-) diff --git a/debian/postinst b/debian/postinst index a08b913..a5bf173 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,3 +1,4 @@ #!/bin/sh echo 'include "/home/user/.config/irwi/lirc.conf"' >> /etc/lircd.conf +sed -i '/^include/!d' /etc/lircd.conf diff --git a/debian/postrm b/debian/postrm index 34570f2..520d96d 100755 --- a/debian/postrm +++ b/debian/postrm @@ -1,2 +1,2 @@ #!/bin/sh -sed -i '/irwi/D' /etc/lircd.conf +sed -i '/irwi/d' /etc/lircd.conf diff --git a/src/irctrl.cpp b/src/irctrl.cpp index 1346b45..01c5679 100644 --- a/src/irctrl.cpp +++ b/src/irctrl.cpp @@ -9,6 +9,14 @@ IrCtrl::IrCtrl(QObject *parent) : QObject(parent) { + QSettings settings; + m_killLircTimer.setInterval( + settings.value("idleTimeout", "300").toInt() * 100); + m_killLircTimer.setSingleShot(true); + connect(&m_killLircTimer, SIGNAL(timeout()), + this, SLOT(stopLirc())); + startLirc(); + m_killLircTimer.start(); } IrCtrl::~IrCtrl() diff --git a/src/irctrl.h b/src/irctrl.h index 0b22480..d71983d 100644 --- a/src/irctrl.h +++ b/src/irctrl.h @@ -16,9 +16,9 @@ public: public slots: void sendCmd(const QString &cmd); + void stopLirc(); private: void startLirc(); - void stopLirc(); private: QTimer m_killLircTimer; diff --git a/src/remote.cpp b/src/remote.cpp index 6f291ab..2ba0db2 100644 --- a/src/remote.cpp +++ b/src/remote.cpp @@ -137,6 +137,7 @@ void Remote::infoRequestFinished(QNetworkReply *reply) if (reply->error() == QNetworkReply::NoError) { m_rating = QString(reply->readLine(20)).toInt(); m_voteCount = QString(reply->readLine(20)).toInt(); + m_mfg = QString(reply->readLine(20)); } reply->close(); reply->deleteLater(); diff --git a/src/selectremotedlg.cpp b/src/selectremotedlg.cpp index e79c950..2ea45fc 100644 --- a/src/selectremotedlg.cpp +++ b/src/selectremotedlg.cpp @@ -46,10 +46,10 @@ SelectRemoteDlg::SelectRemoteDlg(QWidget *parent) this, SLOT(downloadRemote())); this->setLayout(layout); + setBusy(true); connect(&remoteDBMgr, SIGNAL(dbReady(RemoteDB*)), this, SLOT(setDB(RemoteDB*))); remoteDBMgr.getDBAsync(); - setBusy(true); } diff --git a/src/settingsdlg.cpp b/src/settingsdlg.cpp index e92586a..43e590b 100644 --- a/src/settingsdlg.cpp +++ b/src/settingsdlg.cpp @@ -68,6 +68,7 @@ SettingsDlg::SettingsDlg(QWidget *parent) } else { setRemote(selectedRemote); m_remote.updateInfo(); + setBusy(); } } @@ -85,6 +86,12 @@ SettingsDlg::~SettingsDlg() delete m_layout; } +void SettingsDlg::setBusy(bool busy) +{ + setAttribute(Qt::WA_Maemo5ShowProgressIndicator, busy); + setEnabled(!busy); +} + void SettingsDlg::showAdvSettingsDlg() { AdvSettingsDlg dlg(this); @@ -114,6 +121,7 @@ void SettingsDlg::setRemote(Remote r) void SettingsDlg::setRemote(const QString &name) { + setBusy(); m_remote = Remote(name); processRemoteChange(); m_remote.updateInfo(); // request update from server @@ -128,6 +136,7 @@ void SettingsDlg::processRemoteChange() void SettingsDlg::updateRemoteInfo() { + setBusy(false); m_remoteNameLabel->setText(m_remote.mfg() + " " + m_remote.name()); m_ratingLabel->setText(tr("Rating") + ": " + QString::number(m_remote.rating())); diff --git a/src/settingsdlg.h b/src/settingsdlg.h index 6197989..cf530ab 100644 --- a/src/settingsdlg.h +++ b/src/settingsdlg.h @@ -34,6 +34,7 @@ private: void enableRateBtns(bool enable = true); void processRemoteChange(); void processRatingSent(); + void setBusy(bool busy = true); private: Remote m_remote; -- 1.7.9.5