diff options
Diffstat (limited to 'kradio3/plugins/gui-docking-menu/docking.cpp')
-rw-r--r-- | kradio3/plugins/gui-docking-menu/docking.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/kradio3/plugins/gui-docking-menu/docking.cpp b/kradio3/plugins/gui-docking-menu/docking.cpp index e39ae32..2c07b3f 100644 --- a/kradio3/plugins/gui-docking-menu/docking.cpp +++ b/kradio3/plugins/gui-docking-menu/docking.cpp @@ -1,7 +1,7 @@ /*************************************************************************** docking.cpp - description ------------------- - begin : Don M�r 8 21:57:17 CET 2001 + begin : Don M�r 8 21:57:17 CET 2001 copyright : (C) 2002 by Ernst Martin Witte email : [email protected] ***************************************************************************/ @@ -16,7 +16,7 @@ ***************************************************************************/ #include <kiconloader.h> -#include <qtooltip.h> +#include <tqtooltip.h> #include <kpopupmenu.h> #include <kapplication.h> #include <kaction.h> @@ -45,7 +45,7 @@ PLUGIN_LIBRARY_FUNCTIONS(RadioDocking, "kradio-gui-docking-menu", i18n("Tray Men ///////////////////////////////////////////////////////////////////////////// -RadioDocking::RadioDocking(const QString &name) +RadioDocking::RadioDocking(const TQString &name) : KSystemTray (NULL, name.ascii()), PluginBase(name, i18n("Docking Plugin")), m_pluginMenu(NULL), @@ -56,8 +56,8 @@ RadioDocking::RadioDocking(const QString &name) setPixmap(BarIcon("kradio")); m_menu = contextMenu(); - QObject::connect(m_menu, SIGNAL(activated(int)), - this, SLOT(slotMenuItemActivated(int))); + TQObject::connect(m_menu, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotMenuItemActivated(int))); buildContextMenu (); show(); @@ -105,7 +105,7 @@ void RadioDocking::noticeConnectedI (ISoundStreamServer *s, bool pointer_valid) -bool RadioDocking::setStationSelection(const QStringList &sl) +bool RadioDocking::setStationSelection(const TQStringList &sl) { if (m_stationIDs != sl) { m_stationIDs = sl; @@ -120,12 +120,12 @@ bool RadioDocking::setStationSelection(const QStringList &sl) void RadioDocking::restoreState (KConfig *config) { - config->setGroup(QString("radiodocking-") + name()); + config->setGroup(TQString("radiodocking-") + name()); m_stationIDs.clear(); int nStations = config->readNumEntry("nStations", 0); for (int i = 1; i <= nStations; ++i) { - QString s = config->readEntry(QString("stationID-") + QString().setNum(i), QString::null); + TQString s = config->readEntry(TQString("stationID-") + TQString().setNum(i), TQString()); if (s.length()) m_stationIDs += s; } @@ -137,8 +137,8 @@ void RadioDocking::restoreState (KConfig *config) int n = config->readNumEntry("show_hide_cache_entries", 0); for (int i = 1; i <= n; ++i) { - QString s = config->readEntry(QString("show_hide_cache_id_%1").arg(i), QString::null); - bool b = config->readBoolEntry(QString("show_hide_cache_value_%1").arg(i), false); + TQString s = config->readEntry(TQString("show_hide_cache_id_%1").tqarg(i), TQString()); + bool b = config->readBoolEntry(TQString("show_hide_cache_value_%1").tqarg(i), false); if (!s.isNull()) { m_widgetsShownCache.insert(s,b); } @@ -148,21 +148,21 @@ void RadioDocking::restoreState (KConfig *config) void RadioDocking::saveState (KConfig *config) const { - config->setGroup(QString("radiodocking-") + name()); + config->setGroup(TQString("radiodocking-") + name()); config->writeEntry("nStations", m_stationIDs.size()); int i = 1; - QStringList::const_iterator end = m_stationIDs.end(); - for (QStringList::const_iterator it = m_stationIDs.begin(); it != end; ++it, ++i) { - config->writeEntry(QString("stationID-") + QString().setNum(i), *it); + TQStringList::const_iterator end = m_stationIDs.end(); + for (TQStringList::const_iterator it = m_stationIDs.begin(); it != end; ++it, ++i) { + config->writeEntry(TQString("stationID-") + TQString().setNum(i), *it); } config->writeEntry("left_click_action", (int)m_leftClickAction); config->writeEntry("show_hide_cache_entries", m_widgetsShownCache.count()); i = 1; - for (QMapConstIterator<QString, bool> it = m_widgetsShownCache.begin(); it != m_widgetsShownCache.end(); ++it, ++i) { - config->writeEntry(QString("show_hide_cache_id_%1").arg(i), it.key()); - config->writeEntry(QString("show_hide_cache_value_%1").arg(i), *it); + for (TQMapConstIterator<TQString, bool> it = m_widgetsShownCache.begin(); it != m_widgetsShownCache.end(); ++it, ++i) { + config->writeEntry(TQString("show_hide_cache_id_%1").tqarg(i), it.key()); + config->writeEntry(TQString("show_hide_cache_value_%1").tqarg(i), *it); } } @@ -172,8 +172,8 @@ ConfigPageInfo RadioDocking::createConfigurationPage() DockingConfiguration *conf = new DockingConfiguration(this, NULL); connectI (conf); - QObject::connect(this, SIGNAL(sigLeftClickActionChanged(LeftClickAction)), - conf, SLOT(slotLeftClickActionChanged(LeftClickAction))); + TQObject::connect(this, TQT_SIGNAL(sigLeftClickActionChanged(LeftClickAction)), + conf, TQT_SLOT(slotLeftClickActionChanged(LeftClickAction))); return ConfigPageInfo( conf, @@ -222,13 +222,13 @@ void RadioDocking::buildContextMenu() noticeNextAlarmChanged(queryNextAlarm()); m_sleepID = m_menu->insertItem(SmallIcon("kradio_zzz"), "sleep-dummy", - this, SLOT(slotSleepCountdown())); + this, TQT_SLOT(slotSleepCountdown())); noticeCountdownStarted(queryCountdownEnd()); m_seekfwID = m_menu->insertItem(SmallIcon("forward"), i18n("Search Next Station"), - this, SLOT(slotSeekFwd())); + this, TQT_SLOT(slotSeekFwd())); m_seekbwID = m_menu->insertItem(SmallIcon("back"), i18n("Search Previous Station"), - this, SLOT(slotSeekBkwd())); + this, TQT_SLOT(slotSeekBkwd())); // recording menu buildRecordingMenu(); @@ -236,14 +236,14 @@ void RadioDocking::buildContextMenu() m_powerID = m_menu->insertItem(SmallIcon("kradio_muteoff"), "power-dummy", - this, SLOT(slotPower())); + this, TQT_SLOT(slotPower())); m_pauseID = m_menu->insertItem(SmallIcon("kradio_pause"), i18n("Pause Radio"), - this, SLOT(slotPause())); + this, TQT_SLOT(slotPause())); noticePowerChanged(queryIsPowerOn()); m_menu->insertSeparator(); - m_menu->insertItem(SmallIcon("kradio"), i18n("&About"), this, SLOT(slotShowAbout())); + m_menu->insertItem(SmallIcon("kradio"), i18n("&About"), this, TQT_SLOT(slotShowAbout())); // build list of widgets for hide/show items m_pluginMenu = new KPopupMenu(m_menu); @@ -253,7 +253,7 @@ void RadioDocking::buildContextMenu() } m_menu->insertSeparator(); - m_menu->insertItem( SmallIcon("exit"), i18n("&Quit" ), kapp, SLOT(quit()) ); + m_menu->insertItem( SmallIcon("exit"), i18n("&Quit" ), kapp, TQT_SLOT(quit()) ); noticeStationChanged(queryCurrentStation(), -1); @@ -269,16 +269,16 @@ void RadioDocking::buildStationList() const RadioStation &crs = queryCurrentStation(); int k = 0; - QStringList::iterator end = m_stationIDs.end(); - for (QStringList::iterator it = m_stationIDs.begin(); it != end; ++it) { + TQStringList::iterator end = m_stationIDs.end(); + for (TQStringList::iterator it = m_stationIDs.begin(); it != end; ++it) { const RadioStation &rs = sl.stationWithID(*it); if (rs.isValid()) { ++k; - QString shortcut = k < 10 ? "&"+QString().setNum(k) : k == 10 ? "1&0" : QString().setNum(k); - QString name = rs.longName().replace("&", "&&"); - QString item = shortcut + " " + name; + TQString shortcut = k < 10 ? "&"+TQString().setNum(k) : k == 10 ? "1&0" : TQString().setNum(k); + TQString name = rs.longName().tqreplace("&", "&&"); + TQString item = shortcut + " " + name; int id = m_menu->insertItem(item); m_stationMenuIDs.push_back(id); @@ -347,21 +347,21 @@ void RadioDocking::slotSleepCountdown() bool RadioDocking::noticeNextAlarmChanged(const Alarm *a) { - QDateTime d; + TQDateTime d; if (a) d = a->nextAlarm(); if (d.isValid()) - m_menu->changeTitle (m_alarmID, i18n("next alarm: %1").arg(d.toString())); + m_menu->changeTitle (m_alarmID, i18n("next alarm: %1").tqarg(d.toString())); else m_menu->changeTitle (m_alarmID, i18n("<no alarm pending>")); return true; } -bool RadioDocking::noticeCountdownStarted(const QDateTime &end) +bool RadioDocking::noticeCountdownStarted(const TQDateTime &end) { if (end.isValid()) - m_menu->changeItem (m_sleepID, SmallIcon("kradio_zzz"), i18n("Stop Sleep Countdown (running until %1)").arg(end.toString())); + m_menu->changeItem (m_sleepID, SmallIcon("kradio_zzz"), i18n("Stop Sleep Countdown (running until %1)").tqarg(end.toString())); else m_menu->changeItem (m_sleepID, SmallIcon("kradio_zzz"), i18n("Start Sleep Countdown")); return true; @@ -399,17 +399,17 @@ bool RadioDocking::noticeCountdownSecondsChanged(int /*n*/) bool RadioDocking::noticeStationChanged (const RadioStation &rs, int /*idx*/) { - QString s = i18n("invalid station"); + TQString s = i18n("invalid station"); if (rs.isValid()) s = rs.longName(); - QToolTip::add(this, s); - m_menu->changeTitle (m_titleID, i18n("KRadio: %1").arg(s)); + TQToolTip::add(this, s); + m_menu->changeTitle (m_titleID, i18n("KRadio: %1").tqarg(s)); // FIXME: title does not change in opened popupmenu - QValueList<int>::iterator iit = m_stationMenuIDs.begin(); - QValueList<int>::iterator end = m_stationMenuIDs.end(); - QStringList::iterator sit = m_stationIDs.begin(); + TQValueList<int>::iterator iit = m_stationMenuIDs.begin(); + TQValueList<int>::iterator end = m_stationMenuIDs.end(); + TQStringList::iterator sit = m_stationIDs.begin(); for (; iit != end; ++iit, ++sit) { if (*iit != -1) { bool on = rs.stationID() == *sit; @@ -432,12 +432,12 @@ bool RadioDocking::noticeStationsChanged(const StationList &/*sl*/) } -void RadioDocking::mousePressEvent( QMouseEvent *e ) +void RadioDocking::mousePressEvent( TQMouseEvent *e ) { KSystemTray::mousePressEvent(e); switch ( e->button() ) { - case LeftButton: + case Qt::LeftButton: switch (m_leftClickAction) { case lcaShowHide : ShowHideWidgetPlugins(); @@ -467,24 +467,24 @@ void RadioDocking::ShowHideWidgetPlugins() { // nothing in cache => hide everything if (!m_widgetsShownCache.count()) { - for (QMapIterator<WidgetPluginBase*, int> it = m_widgetPluginIDs.begin(); it != m_widgetPluginIDs.end(); ++it) { + for (TQMapIterator<WidgetPluginBase*, int> it = m_widgetPluginIDs.begin(); it != m_widgetPluginIDs.end(); ++it) { WidgetPluginBase *p = it.key(); if (p) { bool visible = p->isAnywhereVisible(); - QString name = p->name(); - logDebug(QString("visibility of %1: %2").arg(name).arg(visible)); + TQString name = p->name(); + logDebug(TQString("visibility of %1: %2").tqarg(name).tqarg(visible)); m_widgetsShownCache.insert(name, visible); p->getWidget()->hide(); } } } else { - QMap<QString, bool> tmpCache = m_widgetsShownCache; + TQMap<TQString, bool> tmpCache = m_widgetsShownCache; int d = KWin::currentDesktop(); - for (QMapIterator<WidgetPluginBase*, int> it = m_widgetPluginIDs.begin(); it != m_widgetPluginIDs.end(); ++it) { + for (TQMapIterator<WidgetPluginBase*, int> it = m_widgetPluginIDs.begin(); it != m_widgetPluginIDs.end(); ++it) { WidgetPluginBase *p = it.key(); - QString name = p ? p->name() : QString::null; - if (p && tmpCache.contains(name) && tmpCache[name]) { + TQString name = p ? p->name() : TQString(); + if (p && tmpCache.tqcontains(name) && tmpCache[name]) { p->showOnOrgDesktop(); } } @@ -496,9 +496,9 @@ void RadioDocking::ShowHideWidgetPlugins() void RadioDocking::slotMenuItemActivated(int id) { const StationList &sl = queryStations(); - QValueList<int>::iterator iit = m_stationMenuIDs.begin(); - QValueList<int>::iterator end = m_stationMenuIDs.end(); - QStringList::iterator sit = m_stationIDs.begin(); + TQValueList<int>::iterator iit = m_stationMenuIDs.begin(); + TQValueList<int>::iterator end = m_stationMenuIDs.end(); + TQStringList::iterator sit = m_stationIDs.begin(); for (; iit != end; ++iit, ++sit) { if (*iit == id) { const RadioStation &rs = sl.stationWithID(*sit); @@ -511,7 +511,7 @@ void RadioDocking::slotMenuItemActivated(int id) void RadioDocking::noticeWidgetPluginShown(WidgetPluginBase *b, bool shown) { - if (!m_manager || !b || !m_widgetPluginIDs.contains(b)) + if (!m_manager || !b || !m_widgetPluginIDs.tqcontains(b)) return; m_manager->updateWidgetPluginMenuItem(b, m_pluginMenu, m_widgetPluginIDs, shown); @@ -533,14 +533,14 @@ bool RadioDocking::startRecordingWithFormat( const SoundFormat &/*proposed_format*/, SoundFormat &/*real_format*/) { - if (!id.isValid() || id != queryCurrentSoundStreamID() || m_StreamID2MenuID.contains(id)) + if (!id.isValid() || id != queryCurrentSoundStreamID() || m_StreamID2MenuID.tqcontains(id)) return false; - QString descr; + TQString descr; querySoundStreamDescription(id, descr); int menu_id = m_NextRecordingMenuID++; m_recordingMenu->insertItem(SmallIcon("kradio_record"), - i18n("Stop Recording of %1").arg(descr), + i18n("Stop Recording of %1").tqarg(descr), menu_id); m_MenuID2StreamID.insert(menu_id, id); m_StreamID2MenuID.insert(id, menu_id); @@ -555,7 +555,7 @@ bool RadioDocking::startRecordingWithFormat( bool RadioDocking::stopRecording (SoundStreamID id) { - if (!id.isValid() || !m_StreamID2MenuID.contains(id)) + if (!id.isValid() || !m_StreamID2MenuID.tqcontains(id)) return false; int menu_id = m_StreamID2MenuID[id]; @@ -584,36 +584,36 @@ void RadioDocking::slotRecordingMenu(int i) sendPowerOn(); sendStartRecording(id); } - } else if (m_MenuID2StreamID.contains(i)) { + } else if (m_MenuID2StreamID.tqcontains(i)) { sendStopRecording(m_MenuID2StreamID[i]); } } void RadioDocking::buildRecordingMenu() { - QMap<QString, SoundStreamID> streams; + TQMap<TQString, SoundStreamID> streams; queryEnumerateSoundStreams(streams); KPopupMenu *m = new KPopupMenu(m_menu); m_recordingID = m->insertItem(SmallIcon("kradio_record"), i18n("Start Recording"), POPUP_ID_START_RECORDING_DEFAULT); - QObject::connect(m, SIGNAL(activated(int)), - this, SLOT(slotRecordingMenu(int))); + TQObject::connect(m, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotRecordingMenu(int))); SoundStreamID currentID = queryCurrentSoundStreamID(); - QMapIterator<QString, SoundStreamID> end = streams.end(); - for (QMapIterator<QString, SoundStreamID> it = streams.begin(); it != end; ++it) { + TQMapIterator<TQString, SoundStreamID> end = streams.end(); + for (TQMapIterator<TQString, SoundStreamID> it = streams.begin(); it != end; ++it) { SoundStreamID id = *it; - QString descr = it.key(); + TQString descr = it.key(); bool r = false; SoundFormat sf; queryIsRecordingRunning(id, r, sf); if (r) { int menu_id = m_NextRecordingMenuID++; m->insertItem(SmallIcon("kradio_record"), - i18n("Stop Recording of %1").arg(descr), + i18n("Stop Recording of %1").tqarg(descr), menu_id); m_MenuID2StreamID.insert(menu_id, id); m_StreamID2MenuID.insert(id, menu_id); @@ -628,12 +628,12 @@ void RadioDocking::buildRecordingMenu() bool RadioDocking::noticeSoundStreamChanged(SoundStreamID id) { - if (m_StreamID2MenuID.contains(id)) { - QString descr; + if (m_StreamID2MenuID.tqcontains(id)) { + TQString descr; querySoundStreamDescription(id, descr); m_recordingMenu->changeItem(m_StreamID2MenuID[id], SmallIcon("kradio_record"), - i18n("Stop Recording of %1").arg(descr)); + i18n("Stop Recording of %1").tqarg(descr)); return true; } return false; @@ -648,7 +648,7 @@ void RadioDocking::setLeftClickAction(LeftClickAction action) } } -void RadioDocking::dragEnterEvent(QDragEnterEvent* event) +void RadioDocking::dragEnterEvent(TQDragEnterEvent* event) { bool a = StationDragObject::canDecode(event); if (a) @@ -658,14 +658,14 @@ void RadioDocking::dragEnterEvent(QDragEnterEvent* event) event->accept(a); } -void RadioDocking::dropEvent(QDropEvent* event) +void RadioDocking::dropEvent(TQDropEvent* event) { - QStringList list; + TQStringList list; if ( StationDragObject::decode(event, list) ) { - QStringList l = getStationSelection(); - for (QValueListConstIterator<QString> it = list.begin(); it != list.end(); ++it) - if (!l.contains(*it)) + TQStringList l = getStationSelection(); + for (TQValueListConstIterator<TQString> it = list.begin(); it != list.end(); ++it) + if (!l.tqcontains(*it)) l.append(*it); setStationSelection(l); } |