From d95a4fea540b371fa86493d069fdbd54f33c5b40 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 30 May 2022 19:40:31 +0900 Subject: Standardize folder structure. Signed-off-by: Michele Calgaro --- tderadio3/plugins/gui-docking-menu/CMakeL10n.txt | 6 - tderadio3/plugins/gui-docking-menu/Makefile.am | 18 - .../gui-docking-menu/docking-configuration.cpp | 114 ---- .../gui-docking-menu/docking-configuration.h | 55 -- tderadio3/plugins/gui-docking-menu/docking.cpp | 674 --------------------- tderadio3/plugins/gui-docking-menu/docking.h | 190 ------ tderadio3/plugins/gui-docking-menu/po/Makefile.am | 2 - 7 files changed, 1059 deletions(-) delete mode 100644 tderadio3/plugins/gui-docking-menu/CMakeL10n.txt delete mode 100644 tderadio3/plugins/gui-docking-menu/Makefile.am delete mode 100644 tderadio3/plugins/gui-docking-menu/docking-configuration.cpp delete mode 100644 tderadio3/plugins/gui-docking-menu/docking-configuration.h delete mode 100644 tderadio3/plugins/gui-docking-menu/docking.cpp delete mode 100644 tderadio3/plugins/gui-docking-menu/docking.h delete mode 100644 tderadio3/plugins/gui-docking-menu/po/Makefile.am (limited to 'tderadio3/plugins/gui-docking-menu') diff --git a/tderadio3/plugins/gui-docking-menu/CMakeL10n.txt b/tderadio3/plugins/gui-docking-menu/CMakeL10n.txt deleted file mode 100644 index a6da2f2..0000000 --- a/tderadio3/plugins/gui-docking-menu/CMakeL10n.txt +++ /dev/null @@ -1,6 +0,0 @@ -##### create translation templates ############## - -tde_l10n_create_template( - CATALOG "tderadio-gui-docking-menu" - DESTINATION "po" -) diff --git a/tderadio3/plugins/gui-docking-menu/Makefile.am b/tderadio3/plugins/gui-docking-menu/Makefile.am deleted file mode 100644 index ff1e0ad..0000000 --- a/tderadio3/plugins/gui-docking-menu/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -SUBDIRS = po . - -INCLUDES = -I$(top_builddir)/tderadio3/src $(all_includes) -METASOURCES = AUTO - -libtderadio_LTLIBRARIES = libdocking-menu.la -libdocking_menu_la_SOURCES = docking-configuration.cpp docking.cpp -libdocking_menu_la_LDFLAGS = -module -avoid-version $(KDE_RPATH) $(all_libraries) - -noinst_HEADERS = docking-configuration.h docking.h - - -#messages: rc.cpp -# $(XGETTEXT) *.cpp *.h -o po/tderadio-gui-docking-menu.pot - -messages: rc.cpp - $(EXTRACTRC) *.rc *.ui >> rc.cpp - $(XGETTEXT) rc.cpp *.h *.cpp -o po/tderadio-gui-docking-menu.pot diff --git a/tderadio3/plugins/gui-docking-menu/docking-configuration.cpp b/tderadio3/plugins/gui-docking-menu/docking-configuration.cpp deleted file mode 100644 index dd1a18c..0000000 --- a/tderadio3/plugins/gui-docking-menu/docking-configuration.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/*************************************************************************** - docking-configuration.cpp - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : witte@kawo1.rwth-aachen.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "docking-configuration.h" - -#include -#include -#include -#include - -#include - -using namespace std; - -DockingConfiguration::DockingConfiguration (RadioDocking *docking, TQWidget *parent) - : StationSelector(parent), - m_docking(docking), - m_disableGUIUpdates(false) -{ - TQHBoxLayout *layout = new TQHBoxLayout(); - TQHBoxLayout *layout2 = new TQHBoxLayout(); - - m_labelClickMode = new TQLabel(this); - layout->addWidget(m_labelClickMode); - - m_comboClickMode = new TQComboBox(this); - layout->addWidget(m_comboClickMode); - - TQSpacerItem *spacer = new TQSpacerItem( 20, 2, TQSizePolicy::Expanding, TQSizePolicy::Minimum); - layout->addItem(spacer); - - TQFrame *line = new TQFrame(this); - line->setFrameShape ( TQFrame::HLine ); - line->setFrameShadow( TQFrame::Sunken ); - layout2->addWidget(line); - - StationSelectorUILayout->expand(2,0); - StationSelectorUILayout->addMultiCellLayout(layout2, 2, 2, 0, 2); - StationSelectorUILayout->addMultiCellLayout(layout, 3, 3, 0, 2); - - connect(m_comboClickMode, TQT_SIGNAL(activated( int )), this, TQT_SLOT(slotSetDirty())); - - languageChange(); - slotCancel(); -} - - -DockingConfiguration::~DockingConfiguration () -{ -} - - -void DockingConfiguration::languageChange() -{ - StationSelector::languageChange(); - m_labelClickMode->setText( i18n( "Left Mouse Click on Tray" ) ); - - m_comboClickMode->clear(); - m_comboClickMode->insertItem(i18n("Show/Hide all GUI Elements")); - m_comboClickMode->insertItem(i18n("Power On/Off")); -} - -void DockingConfiguration::slotOK() -{ - if (m_dirty) { - StationSelector::slotOK(); - bool old = m_disableGUIUpdates; - m_disableGUIUpdates = true; - if (m_docking) - m_docking->setLeftClickAction((LeftClickAction)m_comboClickMode->currentItem()); - m_disableGUIUpdates = old; - m_dirty = false; - } -} - -void DockingConfiguration::slotCancel() -{ - if (m_dirty) { - StationSelector::slotCancel(); - if (m_docking) - m_comboClickMode->setCurrentItem(m_docking->getLeftClickAction()); - m_dirty = false; - } -} - -void DockingConfiguration::slotLeftClickActionChanged(LeftClickAction action) -{ - if (!m_disableGUIUpdates) { - if (m_docking) - m_comboClickMode->setCurrentItem(action); - } -} - -void DockingConfiguration::slotSetDirty() -{ - m_dirty = true; -} - - -#include "docking-configuration.moc" diff --git a/tderadio3/plugins/gui-docking-menu/docking-configuration.h b/tderadio3/plugins/gui-docking-menu/docking-configuration.h deleted file mode 100644 index 61133c3..0000000 --- a/tderadio3/plugins/gui-docking-menu/docking-configuration.h +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - docking-configuration.h - description - ------------------- - begin : Son Aug 3 2003 - copyright : (C) 2003 by Martin Witte - email : witte@kawo1.rwth-aachen.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KRADIO_DOCKING_CONFIGURATION_H -#define KRADIO_DOCKING_CONFIGURATION_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "../../src/include/stationselector.h" -#include "docking.h" - -class TQComboBox; -class TQLabel; - -class DockingConfiguration : public StationSelector -{ -Q_OBJECT - -public : - DockingConfiguration (RadioDocking *docking, TQWidget *parent); - ~DockingConfiguration (); - -protected slots: - - void slotOK(); - void slotCancel(); - void slotSetDirty(); - - void slotLeftClickActionChanged(LeftClickAction action); - void languageChange(); - -protected: - RadioDocking *m_docking; - TQComboBox *m_comboClickMode; - TQLabel *m_labelClickMode; - bool m_disableGUIUpdates; -}; - -#endif diff --git a/tderadio3/plugins/gui-docking-menu/docking.cpp b/tderadio3/plugins/gui-docking-menu/docking.cpp deleted file mode 100644 index aae4f3f..0000000 --- a/tderadio3/plugins/gui-docking-menu/docking.cpp +++ /dev/null @@ -1,674 +0,0 @@ -/*************************************************************************** - docking.cpp - description - ------------------- - begin : Don M�r 8 21:57:17 CET 2001 - copyright : (C) 2002 by Ernst Martin Witte - email : witte@kawo1.rwth-aachen.de -***************************************************************************/ - -/*************************************************************************** - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../src/include/radiodevice_interfaces.h" -#include "../../src/include/stationlist.h" -#include "../../src/include/pluginmanager.h" -#include "../../src/include/widgetplugins.h" -#include "../../src/include/radiostation.h" -#include "../../src/include/aboutwidget.h" -#include "../../src/include/station-drag-object.h" - -#include "docking.h" -#include "docking-configuration.h" - -#define POPUP_ID_START_RECORDING_DEFAULT 0 -#define POPUP_ID_STOP_RECORDING_BASE 100 - -/////////////////////////////////////////////////////////////////////// - -PLUGIN_LIBRARY_FUNCTIONS(RadioDocking, "tderadio-gui-docking-menu", i18n("Tray Menu for TDERadio")); - -///////////////////////////////////////////////////////////////////////////// - -RadioDocking::RadioDocking(const TQString &name) - : KSystemTray (NULL, name.ascii()), - PluginBase(name, i18n("Docking Plugin")), - m_pluginMenu(NULL), - m_recordingMenu(NULL), - m_NextRecordingMenuID(POPUP_ID_STOP_RECORDING_BASE), - m_leftClickAction(lcaShowHide) -{ - setPixmap(BarIcon("tderadio")); - - m_menu = contextMenu(); - TQObject::connect(m_menu, TQT_SIGNAL(activated(int)), - this, TQT_SLOT(slotMenuItemActivated(int))); - - buildContextMenu (); - show(); - setAcceptDrops(true); -} - -RadioDocking::~RadioDocking() -{ -} - - -bool RadioDocking::connectI (Interface *i) -{ - bool a = IRadioClient::connectI(i); - bool b = ITimeControlClient::connectI(i); - bool c = IRadioDevicePoolClient::connectI(i); - bool d = IStationSelection::connectI(i); - bool e = ISoundStreamClient::connectI(i); - bool f = PluginBase::connectI(i); - return a || b || c || d || e || f; -} - - -bool RadioDocking::disconnectI (Interface *i) -{ - bool a = IRadioClient::disconnectI(i); - bool b = ITimeControlClient::disconnectI(i); - bool c = IRadioDevicePoolClient::disconnectI(i); - bool d = IStationSelection::disconnectI(i); - bool e = ISoundStreamClient::disconnectI(i); - bool f = PluginBase::disconnectI(i); - return a || b || c || d || e || f; -} - - -void RadioDocking::noticeConnectedI (ISoundStreamServer *s, bool pointer_valid) -{ - ISoundStreamClient::noticeConnectedI(s, pointer_valid); - if (s && pointer_valid) { - s->register4_sendStartRecordingWithFormat(this); - s->register4_sendStopRecording (this); - s->register4_notifySoundStreamChanged (this); - } -} - - - -bool RadioDocking::setStationSelection(const TQStringList &sl) -{ - if (m_stationIDs != sl) { - m_stationIDs = sl; - buildContextMenu(); - notifyStationSelectionChanged(m_stationIDs); - } - return true; -} - - -// PluginBase - -void RadioDocking::restoreState (TDEConfig *config) -{ - config->setGroup(TQString("radiodocking-") + name()); - - m_stationIDs.clear(); - int nStations = config->readNumEntry("nStations", 0); - for (int i = 1; i <= nStations; ++i) { - TQString s = config->readEntry(TQString("stationID-") + TQString().setNum(i), TQString()); - if (s.length()) - m_stationIDs += s; - } - - m_leftClickAction = (LeftClickAction)config->readNumEntry("left_click_action", lcaShowHide); - - buildContextMenu(); - notifyStationSelectionChanged(m_stationIDs); - - int n = config->readNumEntry("show_hide_cache_entries", 0); - for (int i = 1; i <= n; ++i) { - TQString s = config->readEntry(TQString("show_hide_cache_id_%1").arg(i), TQString()); - bool b = config->readBoolEntry(TQString("show_hide_cache_value_%1").arg(i), false); - if (!s.isNull()) { - m_widgetsShownCache.insert(s,b); - } - } -} - - -void RadioDocking::saveState (TDEConfig *config) const -{ - config->setGroup(TQString("radiodocking-") + name()); - - config->writeEntry("nStations", m_stationIDs.size()); - int i = 1; - 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 (TQMapConstIterator it = m_widgetsShownCache.begin(); it != m_widgetsShownCache.end(); ++it, ++i) { - config->writeEntry(TQString("show_hide_cache_id_%1").arg(i), it.key()); - config->writeEntry(TQString("show_hide_cache_value_%1").arg(i), *it); - } -} - - -ConfigPageInfo RadioDocking::createConfigurationPage() -{ - DockingConfiguration *conf = new DockingConfiguration(this, NULL); - connectI (conf); - - TQObject::connect(this, TQT_SIGNAL(sigLeftClickActionChanged(LeftClickAction)), - conf, TQT_SLOT(slotLeftClickActionChanged(LeftClickAction))); - - return ConfigPageInfo( - conf, - i18n("Docking Menu"), - i18n("Docking Menu Configuration"), - "kmenuedit" - ); -} - -AboutPageInfo RadioDocking::createAboutPage() -{ -/* TDEAboutData aboutData("tderadio", - NULL, - NULL, - I18N_NOOP("Docking Menu for TDERadio"), - TDEAboutData::License_GPL, - "(c) 2002-2005 Martin Witte, Klas Kalass", - 0, - "http://sourceforge.net/projects/tderadio", - 0); - aboutData.addAuthor("Martin Witte", "", "witte@kawo1.rwth-aachen.de"); - aboutData.addAuthor("Klas Kalass", "", "klas.kalass@gmx.de"); - - return AboutPageInfo( - new TDERadioAboutWidget(aboutData, TDERadioAboutWidget::AbtTabbed), - i18n("Docking Menu"), - i18n("Docking Menu Plugin"), - "kmenuedit" - );*/ - return AboutPageInfo(); -} - - - -void RadioDocking::buildContextMenu() -{ - m_menu->clear(); - m_pluginMenu = NULL; - m_recordingMenu = NULL; - - m_titleID = m_menu->insertTitle ("title-dummy"); - - buildStationList(); - - m_alarmID = m_menu->insertTitle ("alarm-dummy"); - noticeNextAlarmChanged(queryNextAlarm()); - - m_sleepID = m_menu->insertItem(SmallIcon("tderadio_zzz"), "sleep-dummy", - this, TQT_SLOT(slotSleepCountdown())); - noticeCountdownStarted(queryCountdownEnd()); - - m_seekfwID = m_menu->insertItem(SmallIcon("forward"), i18n("Search Next Station"), - this, TQT_SLOT(slotSeekFwd())); - m_seekbwID = m_menu->insertItem(SmallIcon("back"), i18n("Search Previous Station"), - this, TQT_SLOT(slotSeekBkwd())); - - // recording menu - buildRecordingMenu(); - m_menu->insertItem(i18n("Recording"), m_recordingMenu); - - - m_powerID = m_menu->insertItem(SmallIcon("tderadio_muteoff"), "power-dummy", - this, TQT_SLOT(slotPower())); - m_pauseID = m_menu->insertItem(SmallIcon("tderadio_pause"), i18n("Pause Radio"), - this, TQT_SLOT(slotPause())); - noticePowerChanged(queryIsPowerOn()); - - m_menu->insertSeparator(); - - m_menu->insertItem(SmallIcon("tderadio"), i18n("&About"), this, TQT_SLOT(slotShowAbout())); - - // build list of widgets for hide/show items - m_pluginMenu = new TDEPopupMenu(m_menu); - if (m_manager) { - m_manager->addWidgetPluginMenuItems(m_pluginMenu, m_widgetPluginIDs); - m_menu->insertItem(SmallIcon("tderadio_plugins"), i18n("Show/Hide Plugins"), m_pluginMenu); - } - - m_menu->insertSeparator(); - m_menu->insertItem( SmallIcon("system-log-out"), i18n("&Quit" ), kapp, TQT_SLOT(quit()) ); - - - noticeStationChanged(queryCurrentStation(), -1); - -} - - -void RadioDocking::buildStationList() -{ - m_stationMenuIDs.clear(); - - const RawStationList &sl = queryStations().all(); - const RadioStation &crs = queryCurrentStation(); - - int k = 0; - 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; - TQString shortcut = k < 10 ? "&"+TQString().setNum(k) : k == 10 ? "1&0" : TQString().setNum(k); - TQString name = rs.longName().replace("&", "&&"); - TQString item = shortcut + " " + name; - int id = m_menu->insertItem(item); - - m_stationMenuIDs.push_back(id); - m_menu->setItemChecked (id, rs.compare(crs) == 0); - - } else { - m_stationMenuIDs.push_back(-1); - } - } -} - - -void RadioDocking::slotSeekFwd() -{ - ISeekRadio *seeker = dynamic_cast(queryActiveDevice()); - if (seeker) - seeker->startSeekUp(); -} - - -void RadioDocking::slotSeekBkwd() -{ - ISeekRadio *seeker = dynamic_cast(queryActiveDevice()); - if (seeker) - seeker->startSeekUp(); -} - - - -void RadioDocking::slotShowAbout() -{ - if (m_manager) { - KDialogBase *d = m_manager->getAboutDialog(); - if (d) d->show(); - } -} - - -void RadioDocking::slotPower() -{ - if (queryIsPowerOn()) { - sendPowerOff(); - } else { - sendPowerOn(); - } -} - - -void RadioDocking::slotPause() -{ - if (queryIsPowerOn()) { - sendPausePlayback(queryCurrentSoundStreamID()); - } -} - - -void RadioDocking::slotSleepCountdown() -{ - if (queryCountdownEnd().isValid()) { - sendStopCountdown(); - } else { - sendStartCountdown(); - } -} - - -bool RadioDocking::noticeNextAlarmChanged(const Alarm *a) -{ - TQDateTime d; - if (a) d = a->nextAlarm(); - - if (d.isValid()) - m_menu->changeTitle (m_alarmID, i18n("next alarm: %1").arg(d.toString())); - else - m_menu->changeTitle (m_alarmID, i18n("")); - return true; -} - - -bool RadioDocking::noticeCountdownStarted(const TQDateTime &end) -{ - if (end.isValid()) - m_menu->changeItem (m_sleepID, SmallIcon("tderadio_zzz"), i18n("Stop Sleep Countdown (running until %1)").arg(end.toString())); - else - m_menu->changeItem (m_sleepID, SmallIcon("tderadio_zzz"), i18n("Start Sleep Countdown")); - return true; -} - - -bool RadioDocking::noticeCountdownStopped() -{ - m_menu->changeItem (m_sleepID, SmallIcon("tderadio_zzz"), i18n("Start Sleep Countdown")); - return true; -} - - -bool RadioDocking::noticeCountdownZero() -{ - m_menu->changeItem (m_sleepID, SmallIcon("tderadio_zzz"), i18n("Start Sleep Countdown")); - return true; -} - - -bool RadioDocking::noticePowerChanged(bool on) -{ - m_menu->changeItem(m_powerID, SmallIcon(on ? "tderadio_muteon" : "tderadio_muteoff"), - on ? i18n("Power Off") : i18n("Power On")); - m_menu->setItemEnabled(m_pauseID, on); - return true; -} - -bool RadioDocking::noticeCountdownSecondsChanged(int /*n*/) -{ - return false; -} - - - -bool RadioDocking::noticeStationChanged (const RadioStation &rs, int /*idx*/) -{ - TQString s = i18n("invalid station"); - if (rs.isValid()) - s = rs.longName(); - - TQToolTip::add(this, s); - m_menu->changeTitle (m_titleID, i18n("TDERadio: %1").arg(s)); - // FIXME: title does not change in opened popupmenu - - TQValueList::iterator iit = m_stationMenuIDs.begin(); - TQValueList::iterator end = m_stationMenuIDs.end(); - TQStringList::iterator sit = m_stationIDs.begin(); - for (; iit != end; ++iit, ++sit) { - if (*iit != -1) { - bool on = rs.stationID() == *sit; - m_menu->setItemChecked (*iit, on); - } - } - - bool r = false; - SoundFormat sf; - queryIsRecordingRunning(queryCurrentSoundStreamID(), r, sf); - m_recordingMenu->setItemEnabled(m_recordingID, !r); - return true; -} - - -bool RadioDocking::noticeStationsChanged(const StationList &/*sl*/) -{ - buildContextMenu(); - return true; -} - - -void RadioDocking::mousePressEvent( TQMouseEvent *e ) -{ - KSystemTray::mousePressEvent(e); - - switch ( e->button() ) { - case Qt::LeftButton: - switch (m_leftClickAction) { - case lcaShowHide : - ShowHideWidgetPlugins(); - // FIXME: [mcamen] According the KDE usability guidelines a left - // click on the systray icon should show/hide the - // application window - // TODO: [mcamen] Use KSystemtray::toggleActive and friends once we - // depend on KDE 3.3 - break; - case lcaPowerOnOff : - if (queryIsPowerOn()) - sendPowerOff(); - else - sendPowerOn(); - break; - default: - break; - } - break; - default: - // nothing - break; - } -} - -void RadioDocking::ShowHideWidgetPlugins() -{ - // nothing in cache => hide everything - if (!m_widgetsShownCache.count()) { - for (TQMapIterator it = m_widgetPluginIDs.begin(); it != m_widgetPluginIDs.end(); ++it) { - WidgetPluginBase *p = it.key(); - if (p) { - bool visible = p->isAnywhereVisible(); - TQString name = p->name(); - logDebug(TQString("visibility of %1: %2").arg(name).arg(visible)); - m_widgetsShownCache.insert(name, visible); - p->getWidget()->hide(); - } - } - } - else { - TQMap tmpCache = m_widgetsShownCache; - int d = KWin::currentDesktop(); - for (TQMapIterator it = m_widgetPluginIDs.begin(); it != m_widgetPluginIDs.end(); ++it) { - WidgetPluginBase *p = it.key(); - TQString name = p ? p->name() : TQString(); - if (p && tmpCache.contains(name) && tmpCache[name]) { - p->showOnOrgDesktop(); - } - } - m_widgetsShownCache.clear(); - KWin::setCurrentDesktop(d); - } -} - -void RadioDocking::slotMenuItemActivated(int id) -{ - const StationList &sl = queryStations(); - TQValueList::iterator iit = m_stationMenuIDs.begin(); - TQValueList::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); - if (rs.isValid()) - sendActivateStation(rs); - } - } -} - - -void RadioDocking::noticeWidgetPluginShown(WidgetPluginBase *b, bool shown) -{ - if (!m_manager || !b || !m_widgetPluginIDs.contains(b)) - return; - m_manager->updateWidgetPluginMenuItem(b, m_pluginMenu, m_widgetPluginIDs, shown); - - if (shown) - m_widgetsShownCache.clear(); -} - - -void RadioDocking::noticePluginsChanged(const PluginList &/*l*/) -{ - buildContextMenu(); -} - - -// ISoundStreamClient - -bool RadioDocking::startRecordingWithFormat( - SoundStreamID id, - const SoundFormat &/*proposed_format*/, - SoundFormat &/*real_format*/) -{ - if (!id.isValid() || id != queryCurrentSoundStreamID() || m_StreamID2MenuID.contains(id)) - return false; - - TQString descr; - querySoundStreamDescription(id, descr); - int menu_id = m_NextRecordingMenuID++; - m_recordingMenu->insertItem(SmallIcon("tderadio_record"), - i18n("Stop Recording of %1").arg(descr), - menu_id); - m_MenuID2StreamID.insert(menu_id, id); - m_StreamID2MenuID.insert(id, menu_id); - - if (id == queryCurrentSoundStreamID()) - m_recordingMenu->setItemEnabled(m_recordingID, false); - - setPixmap(BarIcon("tderadio_plus_rec")); - return false; // this is only a "hook" that does not initiate the recording so don't say that we handled the event -} - - -bool RadioDocking::stopRecording (SoundStreamID id) -{ - if (!id.isValid() || !m_StreamID2MenuID.contains(id)) - return false; - - int menu_id = m_StreamID2MenuID[id]; - m_recordingMenu->removeItem(menu_id); - m_MenuID2StreamID.remove(menu_id); - m_StreamID2MenuID.remove(id); - - if (id == queryCurrentSoundStreamID()) - m_recordingMenu->setItemEnabled(m_recordingID, true); - - setPixmap(BarIcon("tderadio")); - - return false; -} - - -void RadioDocking::slotRecordingMenu(int i) -{ - if (i == POPUP_ID_START_RECORDING_DEFAULT) { - SoundStreamID id = queryCurrentSoundStreamID(); - bool r = false; - SoundFormat sf; - queryIsRecordingRunning(id, r, sf); - if (!r) { - if (!queryIsPowerOn()) - sendPowerOn(); - sendStartRecording(id); - } - } else if (m_MenuID2StreamID.contains(i)) { - sendStopRecording(m_MenuID2StreamID[i]); - } -} - -void RadioDocking::buildRecordingMenu() -{ - TQMap streams; - queryEnumerateSoundStreams(streams); - - TDEPopupMenu *m = new TDEPopupMenu(m_menu); - - m_recordingID = m->insertItem(SmallIcon("tderadio_record"), i18n("Start Recording"), - POPUP_ID_START_RECORDING_DEFAULT); - TQObject::connect(m, TQT_SIGNAL(activated(int)), - this, TQT_SLOT(slotRecordingMenu(int))); - SoundStreamID currentID = queryCurrentSoundStreamID(); - - TQMapIterator end = streams.end(); - for (TQMapIterator it = streams.begin(); it != end; ++it) { - - SoundStreamID id = *it; - TQString descr = it.key(); - bool r = false; - SoundFormat sf; - queryIsRecordingRunning(id, r, sf); - if (r) { - int menu_id = m_NextRecordingMenuID++; - m->insertItem(SmallIcon("tderadio_record"), - i18n("Stop Recording of %1").arg(descr), - menu_id); - m_MenuID2StreamID.insert(menu_id, id); - m_StreamID2MenuID.insert(id, menu_id); - - if (id == currentID) - m_recordingMenu->setItemEnabled(m_recordingID, false); - } - } - m_recordingMenu = m; -} - - -bool RadioDocking::noticeSoundStreamChanged(SoundStreamID id) -{ - if (m_StreamID2MenuID.contains(id)) { - TQString descr; - querySoundStreamDescription(id, descr); - m_recordingMenu->changeItem(m_StreamID2MenuID[id], - SmallIcon("tderadio_record"), - i18n("Stop Recording of %1").arg(descr)); - return true; - } - return false; -} - - -void RadioDocking::setLeftClickAction(LeftClickAction action) -{ - if (m_leftClickAction != action) { - m_leftClickAction = action; - emit sigLeftClickActionChanged(m_leftClickAction); - } -} - -void RadioDocking::dragEnterEvent(TQDragEnterEvent* event) -{ - bool a = StationDragObject::canDecode(event); - if (a) - IErrorLogClient::staticLogDebug("contentsDragEnterEvent accepted"); - else - IErrorLogClient::staticLogDebug("contentsDragEnterEvent rejected"); - event->accept(a); -} - -void RadioDocking::dropEvent(TQDropEvent* event) -{ - TQStringList list; - - if ( StationDragObject::decode(event, list) ) { - TQStringList l = getStationSelection(); - for (TQValueListConstIterator it = list.begin(); it != list.end(); ++it) - if (!l.contains(*it)) - l.append(*it); - setStationSelection(l); - } -} - -#include "docking.moc" diff --git a/tderadio3/plugins/gui-docking-menu/docking.h b/tderadio3/plugins/gui-docking-menu/docking.h deleted file mode 100644 index c4e5f6d..0000000 --- a/tderadio3/plugins/gui-docking-menu/docking.h +++ /dev/null @@ -1,190 +0,0 @@ -/*************************************************************************** - docking.h - description - ------------------- - begin : Mon Jan 14 2002 - copyright : (C) 2001, 2002 by Frank Schwanz, Ernst Martin Witte - email : schwanz@fh-brandenburg.de, witte@kawo1.rwth-aachen.de - ***************************************************************************/ - -/*************************************************************************** - * * - * This program 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 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KRADIO_DOCKING_H -#define KRADIO_DOCKING_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "../../src/include/timecontrol_interfaces.h" -#include "../../src/include/radio_interfaces.h" -#include "../../src/include/radiodevicepool_interfaces.h" -#include "../../src/include/stationselection_interfaces.h" -#include "../../src/include/plugins.h" -#include "../../src/include/soundstreamclient_interfaces.h" - -enum LeftClickAction { lcaShowHide = 0, lcaPowerOnOff = 1 }; - -class RadioDocking : public KSystemTray, - public PluginBase, - public IRadioClient, - public ITimeControlClient, - public IRadioDevicePoolClient, - public IStationSelection, - public ISoundStreamClient -{ -Q_OBJECT - -public: - RadioDocking (const TQString &name); - virtual ~RadioDocking(); - - virtual bool connectI (Interface *); - virtual bool disconnectI (Interface *); - - virtual TQString pluginClassName() const { return "RadioDocking"; } - - virtual const TQString &name() const { return PluginBase::name(); } - virtual TQString &name() { return PluginBase::name(); } - - - // PluginBase - -public: - virtual void saveState (TDEConfig *) const; - virtual void restoreState (TDEConfig *); - - virtual ConfigPageInfo createConfigurationPage(); - virtual AboutPageInfo createAboutPage(); - - - // IStationSelection - -RECEIVERS: - bool setStationSelection(const TQStringList &sl); - -ANSWERS: - const TQStringList & getStationSelection () const { return m_stationIDs; } - - - // IRadioDevicePoolClient - -RECEIVERS: - bool noticeActiveDeviceChanged(IRadioDevice *) { return false; } - bool noticeDevicesChanged(const TQPtrList &) { return false; } - bool noticeDeviceDescriptionChanged(const TQString &) { return false; } - - // ITimeControlClient - -RECEIVERS: - bool noticeAlarmsChanged(const AlarmVector &) { return false; } - bool noticeAlarm(const Alarm &) { return false; } - bool noticeNextAlarmChanged(const Alarm *); - bool noticeCountdownStarted(const TQDateTime &/*end*/); - bool noticeCountdownStopped(); - bool noticeCountdownZero(); - bool noticeCountdownSecondsChanged(int n); - - - // IRadioClient - -RECEIVERS: - bool noticePowerChanged(bool on); - bool noticeStationChanged (const RadioStation &, int idx); - bool noticeStationsChanged(const StationList &sl); - bool noticePresetFileChanged(const TQString &/*f*/) { return false; } - - bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/) { return false; } - - // ISoundStreamClient - -RECEIVERS: - void noticeConnectedI (ISoundStreamServer *s, bool pointer_valid); - - bool startRecordingWithFormat(SoundStreamID /*id*/, - const SoundFormat &/*proposed_format*/, - SoundFormat &/*real_format*/); - bool stopRecording(SoundStreamID /*id*/); - - bool noticeSoundStreamChanged(SoundStreamID id); - - -protected slots: - - void slotSeekFwd(); - void slotSeekBkwd(); - - void slotPower(); - void slotPause(); - void slotSleepCountdown(); - void slotShowAbout(); - - void slotMenuItemActivated(int id); - void slotRecordingMenu(int i); - -protected: - void mousePressEvent( TQMouseEvent *e ); - - void buildContextMenu(); - void buildRecordingMenu(); - void buildStationList(); - - void noticeWidgetPluginShown(WidgetPluginBase *, bool shown); - void noticePluginsChanged(const PluginList &); - - void showEvent(TQShowEvent *) {} // do nothing, original implementation adds "Quit" menu item - - void ShowHideWidgetPlugins(); - - void dragEnterEvent(TQDragEnterEvent* event); - void dropEvent(TQDropEvent* event); - -public: - - LeftClickAction getLeftClickAction() const { return m_leftClickAction; } - void setLeftClickAction(LeftClickAction action); - -signals: - void sigLeftClickActionChanged(LeftClickAction action); - -protected: - - TDEPopupMenu *m_menu; - TDEPopupMenu *m_pluginMenu; - TDEPopupMenu *m_recordingMenu; - TQStringList m_stationIDs; - - // menu Item IDs - int m_titleID; - int m_alarmID; - int m_recordingID; - int m_powerID; - int m_pauseID; - int m_sleepID; - int m_seekfwID; - int m_seekbwID; - TQValueList m_stationMenuIDs; - - TQMap m_widgetPluginIDs; - - int m_NextRecordingMenuID; - TQMap m_MenuID2StreamID; - TQMap m_StreamID2MenuID; - - LeftClickAction m_leftClickAction; - - TQMap m_widgetsShownCache; -}; - - -#endif diff --git a/tderadio3/plugins/gui-docking-menu/po/Makefile.am b/tderadio3/plugins/gui-docking-menu/po/Makefile.am deleted file mode 100644 index 075b9c1..0000000 --- a/tderadio3/plugins/gui-docking-menu/po/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -PACKAGE = tderadio-gui-docking-menu -POFILES = AUTO -- cgit v1.2.1