summaryrefslogtreecommitdiffstats
path: root/kradio3/plugins/gui-quickbar
diff options
context:
space:
mode:
Diffstat (limited to 'kradio3/plugins/gui-quickbar')
-rw-r--r--kradio3/plugins/gui-quickbar/Makefile.am18
-rw-r--r--kradio3/plugins/gui-quickbar/buttonflowlayout.cpp268
-rw-r--r--kradio3/plugins/gui-quickbar/buttonflowlayout.h64
-rw-r--r--kradio3/plugins/gui-quickbar/po/Makefile.am2
-rw-r--r--kradio3/plugins/gui-quickbar/po/de.po53
-rw-r--r--kradio3/plugins/gui-quickbar/po/ru.po55
-rw-r--r--kradio3/plugins/gui-quickbar/quickbar-configuration.cpp35
-rw-r--r--kradio3/plugins/gui-quickbar/quickbar-configuration.h37
-rw-r--r--kradio3/plugins/gui-quickbar/quickbar.cpp424
-rw-r--r--kradio3/plugins/gui-quickbar/quickbar.h139
10 files changed, 0 insertions, 1095 deletions
diff --git a/kradio3/plugins/gui-quickbar/Makefile.am b/kradio3/plugins/gui-quickbar/Makefile.am
deleted file mode 100644
index 09c58ee..0000000
--- a/kradio3/plugins/gui-quickbar/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-SUBDIRS = po .
-
-INCLUDES = -I$(top_builddir)/kradio3/src $(all_includes)
-METASOURCES = AUTO
-
-libkradio_LTLIBRARIES = libquickbar.la
-libquickbar_la_SOURCES = buttonflowlayout.cpp quickbar.cpp \
- quickbar-configuration.cpp
-libquickbar_la_LDFLAGS = -module -avoid-version $(KDE_RPATH) $(all_libraries)
-
-noinst_HEADERS = buttonflowlayout.h quickbar-configuration.h quickbar.h
-
-#messages: rc.cpp
-# $(XGETTEXT) *.cpp *.h -o po/kradio-gui-quickbar.pot
-
-messages: rc.cpp
- $(EXTRACTRC) *.rc *.ui >> rc.cpp
- $(XGETTEXT) rc.cpp *.h *.cpp -o po/kradio-gui-quickbar.pot
diff --git a/kradio3/plugins/gui-quickbar/buttonflowlayout.cpp b/kradio3/plugins/gui-quickbar/buttonflowlayout.cpp
deleted file mode 100644
index 5d4ec18..0000000
--- a/kradio3/plugins/gui-quickbar/buttonflowlayout.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/****************************************************************************
-** $Id: buttonflowtqlayout.cpp 272 2005-05-18 08:12:51Z emw $
-**
-** Implementing your own layout: flow example
-**
-** Copyright (C) 1996 by Trolltech AS. All rights reserved.
-**
-** This file is part of an example program for TQt. This example
-** program may be used, distributed and modified without limitation.
-**
-*****************************************************************************/
-/**
- Modified 2002 by Klas Kalass ([email protected]) for kradio
- */
-
-#include <kdebug.h>
-
-#include "buttonflowlayout.h"
-
-/*********************************************/
-/* Iterator */
-class ButtonFlowLayoutIterator :public TQGLayoutIterator
-{
-public:
- ButtonFlowLayoutIterator( TQPtrList<TQLayoutItem> *l ) :idx(0), list(l) {}
- uint count() const;
- TQLayoutItem *current();
- TQLayoutItem *next();
- TQLayoutItem *takeCurrent();
-
-private:
- int idx;
- TQPtrList<TQLayoutItem> *list;
-
-};
-
-uint ButtonFlowLayoutIterator::count() const
-{
- return list->count();
-}
-
-TQLayoutItem *ButtonFlowLayoutIterator::current()
-{
- return idx < int(count()) ? list->at(idx) : 0;
-}
-
-TQLayoutItem *ButtonFlowLayoutIterator::next()
-{
- idx++; return current();
-}
-
-TQLayoutItem *ButtonFlowLayoutIterator::takeCurrent()
-{
- return idx < int(count()) ? list->take( idx ) : 0;
-}
-
-/**************************************************************/
-
-ButtonFlowLayout::ButtonFlowLayout( TQWidget *parent, int margin, int spacing,
- const char *name )
- : TQLayout( parent, margin, spacing, name ),
- cached_width(0)
-{
-}
-
-ButtonFlowLayout::ButtonFlowLayout( TQLayout* parentLayout, int spacing, const char *name )
- : TQLayout( parentLayout, spacing, name ),
- cached_width(0)
-{
-}
-
-ButtonFlowLayout::ButtonFlowLayout( int spacing, const char *name )
- : TQLayout( spacing, name ),
- cached_width(0)
-{
-}
-
-ButtonFlowLayout::~ButtonFlowLayout()
-{
- deleteAllItems();
-}
-
-
-int ButtonFlowLayout::heightForWidth( int w ) const
-{
- if ( cached_width != w ) {
- //Not all C++ compilers support "mutable" yet:
- ButtonFlowLayout * mthis = (ButtonFlowLayout*)this;
- int h = mthis->doLayout( TQRect(0,0,w,0), TRUE );
- mthis->cached_hfw = h;
- mthis->cached_width = w;
- return h;
- }
- return cached_hfw;
-}
-
-void ButtonFlowLayout::addItem( TQLayoutItem *item)
-{
- list.append( TQT_TQLAYOUTITEM(item) );
-}
-
-bool ButtonFlowLayout::hasHeightForWidth() const
-{
- return TRUE;
-}
-
-TQSize ButtonFlowLayout::sizeHint() const
-{
- return minimumSize();
-}
-
-TQSizePolicy::ExpandData ButtonFlowLayout::expanding() const
-{
- return TQ_SPNoDirection;
-}
-
-TQLayoutIterator ButtonFlowLayout::iterator()
-{
- // [FIXME]
-#ifdef USE_QT4
- #warning [FIXME] ContainerAreaLayout iterators may not function correctly under Qt4
- return TQLayoutIterator( this ); // [FIXME]
-#else // USE_QT4
- return TQLayoutIterator( new ButtonFlowLayoutIterator( &list ) );
-#endif // USE_QT4
-}
-
-void ButtonFlowLayout::setGeometry( const TQRect &r )
-{
- TQLayout::setGeometry( r );
- doLayout( r );
-}
-
-int ButtonFlowLayout::doLayout( const TQRect &r, bool testonly )
-{
-/* kdDebug() << "buttonflowlayout::doLayout ("
- << r.x() << "," << r.y() << ","
- << r.width() << "," << r.height() << ", " << testonly << ")\n";
-*/
- float x = r.x();
- float y = r.y();
- int h = 0; //height of this line so far.
- float buttonWidth = 0;
- int buttonHeight = 0;
- int linecount = 0;
- int totalWidth = r.width();
- int totalHeight = r.height();
-
- TQPtrListIterator<TQLayoutItem> it(list);
- TQLayoutItem *o;
-
- // get the width of the biggest Button
-
- it.toFirst();
- while ( (o=it.current()) != 0 ) {
- ++it;
- buttonWidth = TQMAX( buttonWidth, o->sizeHint().width() );
- buttonHeight = TQMAX( buttonHeight, o->sizeHint().height() );
- }
-
- // calculate the optimal width
- unsigned int columns = (totalWidth + spacing()) /
- ((int)buttonWidth + spacing());
- if (columns > it.count() ) columns = it.count();
- if (columns == 0) columns = 1; // avoid division by zero
-
-
- int rows = (it.count() - 1) / columns + 1;
- float deltaH = (float)(totalHeight - rows * buttonHeight - (rows - 1) * spacing())
- / (float)(rows + 1) ;
- if (deltaH < 0) deltaH = 0;
-
- y += deltaH;
-
- buttonWidth = (float)(totalWidth - spacing()*(columns-1)) / (float)columns;
-
-/* fprintf (stderr, "cols = %i col-width = %f\n"
- "rows = %i row-height = %i\n"
- "w = %i h = %i\n",
- columns, buttonWidth,
- rows, buttonHeight,
- totalWidth, totalHeight
- );
-*/
- // calculate the positions and sizes
- it.toFirst();
- while ( (o = it.current()) != 0 ) {
-
-// fprintf (stderr, "x = %i y = %i\n", x, (int)y);
- ++it;
- int btnRight = (int)rint(x + buttonWidth) - 1,
- btnLeft = (int)rint(x);
-
- if ( btnRight > r.right() && h > 0 ) {
- x = r.x();
- btnRight = (int)rint(x + buttonWidth) - 1;
- btnLeft = (int)rint(x);
-
- y += h + spacing() + deltaH;
- h = 0;
- linecount++;
- }
- if (!testonly)
- o->setGeometry( TQRect( TQPoint( btnLeft, (int)rint(y) ),
- TQSize( btnRight - btnLeft + 1,
- buttonHeight) )
- );
-
- x += buttonWidth + spacing();
- h = TQMAX( h, buttonHeight );
- }
-
- int ret = (int)rint(y + h + deltaH) - r.y();
-
-// kdDebug() << "ButtonFlowLayout::doLayout() = " << ret << endl;
- return ret;
-}
-
-
-TQSize ButtonFlowLayout::minimumSize() const
-{
- return minimumSize(geometry().size());
-}
-
-
-TQSize ButtonFlowLayout::minimumSize(const TQSize &r) const
-{
- TQSize s(0, 0);
-
- for (TQPtrListIterator<TQLayoutItem> it(list); it.current(); ++it) {
- TQLayoutItem *o = it.current();
- s = s.expandedTo( o->sizeHint()); //minimumSize() );
- }
-
- s.setHeight(heightForWidth(r.width()));
-
- return s;
-}
-
-#ifdef USE_QT4
-/*!
- \reimp
-*/
-int ButtonFlowLayout::count() const {
- return list.count();
-}
-
-/*!
- \reimp
-*/
-TQLayoutItem* ButtonFlowLayout::itemAt(int index) const {
- return index >= 0 && index < list.count() ? (const_cast<TQPtrList<TQLayoutItem>&>(list).at(index)) : 0;
-}
-
-/*!
- \reimp
-*/
-TQLayoutItem* ButtonFlowLayout::takeAt(int index) {
- if (index < 0 || index >= list.count())
- return 0;
- TQLayoutItem *item = list.at(index);
- list.remove(list.at(index));
- delete item;
-
- invalidate();
- return item;
-}
-#endif // USE_QT4
diff --git a/kradio3/plugins/gui-quickbar/buttonflowlayout.h b/kradio3/plugins/gui-quickbar/buttonflowlayout.h
deleted file mode 100644
index 2cb8444..0000000
--- a/kradio3/plugins/gui-quickbar/buttonflowlayout.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-** $Id: buttonflowtqlayout.h 471 2006-11-11 17:04:51Z emw $
-**
-** Definition of simple flow layout for custom layout example
-**
-** Created : 979899
-**
-** Copyright (C) 1997 by Trolltech AS. All rights reserved.
-**
-** This file is part of an example program for TQt. This example
-** program may be used, distributed and modified without limitation.
-**
-*****************************************************************************/
-/**
- Modified 2002 by Klas Kalass ([email protected]) for kradio
- */
-#ifndef BUTTONFLOWLAYOUT_H
-#define BUTTONFLOWLAYOUT_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "../../src/include/utils.h"
-
-#include <tqlayout.h>
-#include <tqptrlist.h>
-
-class ButtonFlowLayout : public TQLayout
-{
-public:
- ButtonFlowLayout( TQWidget *parent, int margin = 0, int spacing=-1,
- const char *name=0 );
-
- ButtonFlowLayout( TQLayout* parentLayout, int spacing=-1, const char *name=0 );
-
- ButtonFlowLayout( int spacing=-1, const char *name=0 );
-
- ~ButtonFlowLayout();
-
- void addItem( TQLayoutItem *item);
- bool hasHeightForWidth() const;
- int heightForWidth( int ) const;
- TQSize sizeHint() const;
- TQSize minimumSize() const;
- TQSize minimumSize(const TQSize &r) const; // minimumSize is dependent from width
- TQLayoutIterator iterator();
- TQSizePolicy::ExpandData expanding() const;
-
-#ifdef USE_QT4
- QLAYOUT_REQUIRED_METHOD_DECLARATIONS
-#endif // USE_QT4
-
-protected:
- void setGeometry( const TQRect& );
-
-private:
- int doLayout( const TQRect&, bool testonly = FALSE );
- TQPtrList<TQLayoutItem> list;
- int cached_width;
- int cached_hfw;
-};
-
-#endif
diff --git a/kradio3/plugins/gui-quickbar/po/Makefile.am b/kradio3/plugins/gui-quickbar/po/Makefile.am
deleted file mode 100644
index fbee5b4..0000000
--- a/kradio3/plugins/gui-quickbar/po/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-PACKAGE = kradio-gui-quickbar
-POFILES = AUTO
diff --git a/kradio3/plugins/gui-quickbar/po/de.po b/kradio3/plugins/gui-quickbar/po/de.po
deleted file mode 100644
index 9ac8533..0000000
--- a/kradio3/plugins/gui-quickbar/po/de.po
+++ /dev/null
@@ -1,53 +0,0 @@
-# translation of de.po to
-# translation of kradio-gui-quickbar.po to
-# This file is put in the public domain.
-#
-# Ernst Martin Witte <[email protected]>, 2006.
-msgid ""
-msgstr ""
-"Project-Id-Version: de\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-11-10 23:20+0100\n"
-"PO-Revision-Date: 2006-11-06 00:32+0100\n"
-"Last-Translator: Ernst Martin Witte <[email protected]>\n"
-"Language-Team: <[email protected]>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-
-#: _translatorinfo.cpp:1
-msgid ""
-"_: NAME OF TRANSLATORS\n"
-"Your names"
-msgstr "Ernst Martin Witte "
-
-#: _translatorinfo.cpp:3
-msgid ""
-"_: EMAIL OF TRANSLATORS\n"
-"Your emails"
-
-#: quickbar.cpp:42
-msgid "Radio Station Quick Selection Toolbar"
-msgstr "Senderkurzwahlfenster"
-
-#: quickbar.cpp:48
-msgid "Quickbar Plugin"
-msgstr "Schnellauswahlfenster"
-
-#: quickbar.cpp:139
-msgid "Quickbar"
-msgstr "Kurzwahlfenster"
-
-#: quickbar.cpp:140
-msgid "Quickbar Configuration"
-msgstr "Konfiguration des Kurzwahlfensters"
-
-#: quickbar.cpp:404
-msgid "contentsDragEnterEvent accepted"
-msgstr "contentsDragEnterEvent angenommen"
-
-#: quickbar.cpp:406
-msgid "contentsDragEnterEvent rejected"
-msgstr "contentsDragEnterEvent abgelehnt"
diff --git a/kradio3/plugins/gui-quickbar/po/ru.po b/kradio3/plugins/gui-quickbar/po/ru.po
deleted file mode 100644
index 7742fde..0000000
--- a/kradio3/plugins/gui-quickbar/po/ru.po
+++ /dev/null
@@ -1,55 +0,0 @@
-# translation of ru.po to
-# translation of kradio-gui-quickbar.po to
-# This file is put in the public domain.
-# Алексей Кузнецов <[email protected]>, 2006.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: ru\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-11-11 02:11+0100\n"
-"PO-Revision-Date: 2006-11-08 12:00+0300\n"
-"Last-Translator: Алексей Кузнецов <[email protected]>\n"
-"Language-Team: <[email protected]>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.10\n"
-
-#: _translatorinfo.cpp:1
-msgid ""
-"_: NAME OF TRANSLATORS\n"
-"Your names"
-msgstr "Алексей Кузнецов"
-
-#: _translatorinfo.cpp:3
-msgid ""
-"_: EMAIL OF TRANSLATORS\n"
-"Your emails"
-
-#: quickbar.cpp:42
-msgid "Radio Station Quick Selection Toolbar"
-msgstr "Панель быстрого выбора радиостанций"
-
-#: quickbar.cpp:48
-msgid "Quickbar Plugin"
-msgstr "Панель быстрого доступа"
-
-#: quickbar.cpp:139
-msgid "Quickbar"
-msgstr ""
-"Панель\n"
-" радиостанций"
-
-#: quickbar.cpp:140
-msgid "Quickbar Configuration"
-msgstr "Настройка панели быстрого доступа"
-
-#: quickbar.cpp:404
-msgid "contentsDragEnterEvent accepted"
-msgstr "contentsDragEnterEvent accepted"
-
-#: quickbar.cpp:406
-msgid "contentsDragEnterEvent rejected"
-msgstr "contentsDragEnterEvent rejected"
diff --git a/kradio3/plugins/gui-quickbar/quickbar-configuration.cpp b/kradio3/plugins/gui-quickbar/quickbar-configuration.cpp
deleted file mode 100644
index 7fcedb1..0000000
--- a/kradio3/plugins/gui-quickbar/quickbar-configuration.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/***************************************************************************
- quickbar-configuration.cpp - description
- -------------------
- begin : Son Aug 3 2003
- copyright : (C) 2003 by Martin Witte
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * 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 "quickbar-configuration.h"
-
-using namespace std;
-
-QuickbarConfiguration::QuickbarConfiguration (TQWidget *parent)
- : StationSelector(parent)
-{
-}
-
-
-QuickbarConfiguration::~QuickbarConfiguration ()
-{
-}
-
-
-
-
-#include "quickbar-configuration.moc"
diff --git a/kradio3/plugins/gui-quickbar/quickbar-configuration.h b/kradio3/plugins/gui-quickbar/quickbar-configuration.h
deleted file mode 100644
index e431921..0000000
--- a/kradio3/plugins/gui-quickbar/quickbar-configuration.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/***************************************************************************
- quickbar-configuration.h - description
- -------------------
- begin : Son Aug 3 2003
- copyright : (C) 2003 by Martin Witte
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * 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_QUICKBAR_CONFIGURATION_H
-#define KRADIO_QUICKBAR_CONFIGURATION_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "../../src/include/stationselector.h"
-
-class QuickbarConfiguration : public StationSelector
-{
-Q_OBJECT
-
-public :
- QuickbarConfiguration (TQWidget *parent);
- ~QuickbarConfiguration ();
-
-};
-
-#endif
diff --git a/kradio3/plugins/gui-quickbar/quickbar.cpp b/kradio3/plugins/gui-quickbar/quickbar.cpp
deleted file mode 100644
index e5ee743..0000000
--- a/kradio3/plugins/gui-quickbar/quickbar.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-/***************************************************************************
- quickbar.cpp - description
- -------------------
- begin : Mon Feb 11 2002
- copyright : (C) 2002 by Martin Witte / Frank Schwanz
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * 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 <tqtooltip.h>
-#include <tqnamespace.h>
-#include <tqhbuttongroup.h>
-#include <tqvbuttongroup.h>
-
-#include <ktoolbarbutton.h>
-#include <twin.h>
-#include <klocale.h>
-#include <kglobal.h>
-#include <tdeconfig.h>
-#include <kaboutdata.h>
-
-#include "../../src/include/aboutwidget.h"
-#include "../../src/include/station-drag-object.h"
-#include "../../src/include/stationlist.h"
-#include "../../src/include/radiostation.h"
-
-#include "buttonflowlayout.h"
-#include "quickbar-configuration.h"
-#include "quickbar.h"
-
-///////////////////////////////////////////////////////////////////////
-//// plugin library functions
-
-PLUGIN_LIBRARY_FUNCTIONS(QuickBar, "kradio-gui-quickbar", i18n("Radio Station Quick Selection Toolbar"));
-
-/////////////////////////////////////////////////////////////////////////////
-
-QuickBar::QuickBar(const TQString &name)
- : TQWidget(NULL, name.ascii()),
- WidgetPluginBase(name, i18n("Quickbar Plugin")),
- m_layout(NULL),
- m_buttonGroup(NULL),
- m_showShortName(true),
- m_ignoreNoticeActivation(false)
-{
- autoSetCaption();
- setAcceptDrops(true);
-}
-
-
-QuickBar::~QuickBar()
-{
-}
-
-
-bool QuickBar::connectI(Interface *i)
-{
- bool a = IRadioClient::connectI(i);
- bool b = IStationSelection::connectI(i);
- bool c = PluginBase::connectI(i);
-
- return a || b || c;
-}
-
-
-bool QuickBar::disconnectI(Interface *i)
-{
- bool a = IRadioClient::disconnectI(i);
- bool b = IStationSelection::disconnectI(i);
- bool c = PluginBase::disconnectI(i);
-
- return a || b || c;
-}
-
-
-// IStationSelection
-
-bool QuickBar::setStationSelection(const TQStringList &sl)
-{
- if (m_stationIDs != sl) {
- m_stationIDs = sl;
- rebuildGUI();
- notifyStationSelectionChanged(m_stationIDs);
- }
- return true;
-}
-
-// PluginBase methods
-
-
-void QuickBar::restoreState (TDEConfig *config)
-{
- config->setGroup(TQString("quickBar-") + name());
-
- WidgetPluginBase::restoreState(config, false);
-
- int nStations = config->readNumEntry("nStations", 0);
- m_stationIDs.clear();
- for (int i = 1; i <= nStations; ++i) {
- TQString s = config->readEntry(TQString("stationID-") + TQString().setNum(i), TQString());
- if (s.length())
- m_stationIDs += s;
- }
-
- rebuildGUI();
- notifyStationSelectionChanged(m_stationIDs);
-}
-
-
-void QuickBar::saveState (TDEConfig *config) const
-{
- config->setGroup(TQString("quickBar-") + name());
-
- WidgetPluginBase::saveState(config);
-
- 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);
- }
-}
-
-
-ConfigPageInfo QuickBar::createConfigurationPage()
-{
- QuickbarConfiguration *conf = new QuickbarConfiguration(NULL);
- connectI (conf);
- return ConfigPageInfo(
- conf,
- i18n("Quickbar"),
- i18n("Quickbar Configuration"),
- "view_icon"
- );
-}
-
-
-AboutPageInfo QuickBar::createAboutPage()
-{
-/* TDEAboutData aboutData("kradio",
- NULL,
- NULL,
- I18N_NOOP("Quickback for TDERadio"),
- TDEAboutData::License_GPL,
- "(c) 2002-2005 Martin Witte, Klas Kalass",
- 0,
- "http://sourceforge.net/projects/kradio",
- 0);
- aboutData.addAuthor("Martin Witte", "", "[email protected]");
- aboutData.addAuthor("Klas Kalass", "", "[email protected]");
-
- return AboutPageInfo(
- new TDERadioAboutWidget(aboutData, TDERadioAboutWidget::AbtTabbed),
- i18n("Quickbar"),
- i18n("Quickbar Plugin"),
- "view_icon"
- );*/
- return AboutPageInfo();
-}
-
-
-// IRadio methods
-
-bool QuickBar::noticePowerChanged(bool /*on*/)
-{
- activateCurrentButton();
- autoSetCaption();
- return true;
-}
-
-
-bool QuickBar::noticeStationChanged (const RadioStation &rs, int /*idx*/)
-{
- if (!m_ignoreNoticeActivation)
- activateButton(rs);
- autoSetCaption();
- return true;
-}
-
-
-bool QuickBar::noticeStationsChanged(const StationList &/*sl*/)
-{
- // FIXME
- // we can remove no longer existent stationIDs,
- // but it doesn't matter if we don't care.
- rebuildGUI();
- return true;
-}
-
-
-// button management methods
-
-void QuickBar::buttonClicked(int id)
-{
- // ouch, but we are still using TQStringList :(
- if (queryIsPowerOn() && id == getButtonID(queryCurrentStation())) {
- sendPowerOff();
- } else {
-
- int k = 0;
- TQStringList::iterator end = m_stationIDs.end();
- for (TQStringList::iterator it = m_stationIDs.begin(); it != end; ++it, ++k) {
- if (k == id) {
- const RawStationList &sl = queryStations().all();
- const RadioStation &rs = sl.stationWithID(*it);
- bool old = m_ignoreNoticeActivation;
- m_ignoreNoticeActivation = true;
- sendActivateStation(rs);
- m_ignoreNoticeActivation = old;
- sendPowerOn();
- }
- }
- }
- // Problem: if we click a button twice, there will be no
- // "station changed"-notification. Thus it would be possible to
- // enable a button even if power is off or the radio does not
- // accept the radiostation
- //activateCurrentButton();
-}
-
-
-int QuickBar::getButtonID(const RadioStation &rs) const
-{
- TQString stationID = rs.stationID();
- int k = 0;
- TQStringList::const_iterator end = m_stationIDs.end();
- for (TQStringList::const_iterator it = m_stationIDs.begin(); it != end; ++it, ++k) {
- if (*it == stationID)
- return k;
- }
- return -1;
-}
-
-
-void QuickBar::activateCurrentButton()
-{
- activateButton(queryCurrentStation());
-}
-
-
-void QuickBar::activateButton(const RadioStation &rs)
-{
- int buttonID = getButtonID(rs);
- bool pwr = queryIsPowerOn();
-
- if (pwr && buttonID >= 0) {
- m_buttonGroup->setButton(buttonID);
- } else {
- for (TQToolButton *b = m_buttons.first(); b; b = m_buttons.next()) {
- b->setOn(false);
- }
- }
- autoSetCaption();
-}
-
-
-
-// KDE/TQt gui
-
-
-void QuickBar::rebuildGUI()
-{
- if (m_layout) delete m_layout;
- if (m_buttonGroup) delete m_buttonGroup;
-
- for (TQPtrListIterator<TQToolButton> it(m_buttons); it.current(); ++it)
- delete it.current();
- m_buttons.clear();
-
- m_layout = new ButtonFlowLayout(this);
- m_layout->setMargin(1);
- m_layout->setSpacing(2);
-
- m_buttonGroup = new TQButtonGroup(this);
- TQObject::connect (m_buttonGroup, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(buttonClicked(int)));
- // we use buttonGroup to enable automatic toggle/untoggle
- m_buttonGroup->setExclusive(true);
- m_buttonGroup->setFrameStyle(TQFrame::NoFrame);
- m_buttonGroup->show();
-
- int buttonID = 0;
- const RawStationList &stations = queryStations().all();
-
- TQStringList::iterator end = m_stationIDs.end();
- for (TQStringList::iterator it = m_stationIDs.begin(); it != end; ++it, ++buttonID) {
-
- const RadioStation &rs = stations.stationWithID(*it);
- if (! rs.isValid()) continue;
-
- TQToolButton *b = new TQToolButton(this);
- m_buttons.append(b);
- b->setToggleButton(true);
- if (rs.iconName().length())
- b->setIconSet(TQPixmap(rs.iconName()));
- else
- b->setText(m_showShortName ? rs.shortName() : rs.name());
-
- b->setSizePolicy(TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Preferred));
-
- TQToolTip::add(b, rs.longName());
- if (isVisible()) b->show();
-
-
- m_buttonGroup->insert(b, buttonID);
- m_layout->add(b);
- }
-
- // activate correct button
- activateCurrentButton();
-
- // calculate geometry
- if (m_layout) {
- TQRect r = geometry();
- int h = m_layout->heightForWidth( r.width());
-
- if (h > r.height())
- setGeometry(r.x(), r.y(), r.width(), h);
- }
-}
-
-
-
-
-void QuickBar::show()
-{
-// KWin::setType(winId(), NET::Toolbar);
- WidgetPluginBase::pShow();
- TQWidget::show();
-}
-
-
-void QuickBar::showOnOrgDesktop()
-{
- WidgetPluginBase::pShowOnOrgDesktop();
- //TQWidget::show();
-}
-
-
-void QuickBar::hide()
-{
- WidgetPluginBase::pHide();
- TQWidget::hide();
-}
-
-void QuickBar::showEvent(TQShowEvent *e)
-{
- TQWidget::showEvent(e);
- WidgetPluginBase::pShowEvent(e);
-}
-
-void QuickBar::hideEvent(TQHideEvent *e)
-{
- TQWidget::hideEvent(e);
- WidgetPluginBase::pHideEvent(e);
-}
-
-
-void QuickBar::setGeometry (int x, int y, int w, int h)
-{
- if (m_layout) {
- TQSize marginSize(m_layout->margin()*2, m_layout->margin()*2);
- setMinimumSize(m_layout->minimumSize(TQSize(w, h) - marginSize) + marginSize);
- }
- TQWidget::setGeometry (x, y, w, h);
-}
-
-
-void QuickBar::setGeometry (const TQRect &r)
-{
- setGeometry (r.x(), r.y(), r.width(), r.height());
-}
-
-
-void QuickBar::resizeEvent (TQResizeEvent *e)
-{
- // minimumSize might change because of the flow layout
- if (m_layout) {
- TQSize marginSize(m_layout->margin()*2, m_layout->margin()*2);
- setMinimumSize(m_layout->minimumSize(e->size() - marginSize) + marginSize);
- }
-
- TQWidget::resizeEvent (e);
-}
-
-
-void QuickBar::autoSetCaption()
-{
- const RadioStation &rs = queryCurrentStation();
- setCaption((queryIsPowerOn() && rs.isValid()) ? rs.longName() : TQString("TDERadio"));
-}
-
-void QuickBar::dragEnterEvent(TQDragEnterEvent* event)
-{
- bool a = StationDragObject::canDecode(event);
- if (a)
- IErrorLogClient::staticLogDebug(i18n("contentsDragEnterEvent accepted"));
- else
- IErrorLogClient::staticLogDebug(i18n("contentsDragEnterEvent rejected"));
- event->accept(a);
-}
-
-void QuickBar::dropEvent(TQDropEvent* event)
-{
- TQStringList list;
-
- if ( StationDragObject::decode(event, list) ) {
- TQStringList l = getStationSelection();
- for (TQValueListConstIterator<TQString> it = list.begin(); it != list.end(); ++it)
- if (!l.contains(*it))
- l.append(*it);
- setStationSelection(l);
- }
-}
-
-
-#include "quickbar.moc"
diff --git a/kradio3/plugins/gui-quickbar/quickbar.h b/kradio3/plugins/gui-quickbar/quickbar.h
deleted file mode 100644
index 2ec4f6b..0000000
--- a/kradio3/plugins/gui-quickbar/quickbar.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/***************************************************************************
- quickbar.h - description
- -------------------
- begin : Mon Feb 11 2002
- copyright : (C) 2002 by Martin Witte / Klas Kalass
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * 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_QUICKBAR_H
-#define KRADIO_QUICKBAR_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <tqwidget.h>
-
-#include "../../src/include/radio_interfaces.h"
-#include "../../src/include/widgetplugins.h"
-#include "../../src/include/stationselection_interfaces.h"
-
-class ButtonFlowLayout;
-class TQButtonGroup;
-class TDEConfig;
-class TQToolButton;
-
-/**
- *@author Martin Witte / Klas Kalass
- */
-
-class QuickBar : public TQWidget,
- public WidgetPluginBase,
- public IRadioClient,
- public IStationSelection
-{
-Q_OBJECT
-
-public:
- QuickBar(const TQString &name = TQString());
- ~QuickBar();
-
- virtual TQString pluginClassName() const { return "QuickBar"; }
-
- const TQString &name() const { return PluginBase::name(); }
- TQString &name() { return PluginBase::name(); }
-
- virtual bool connectI(Interface *i);
- virtual bool disconnectI(Interface *i);
-
- // IStationSelection
-
-RECEIVERS:
- bool setStationSelection(const TQStringList &sl);
-
-ANSWERS:
- const TQStringList & getStationSelection () const { return m_stationIDs; }
-
-
- // PluginBase
-
-public:
- virtual void saveState (TDEConfig *) const;
- virtual void restoreState (TDEConfig *);
-
- virtual ConfigPageInfo createConfigurationPage();
- virtual AboutPageInfo createAboutPage();
-
- // 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; }
-
- // button/station Management
-
-
-protected slots:
-
- void buttonClicked(int id);
-
-protected:
-
- int getButtonID(const RadioStation &rs) const;
- void activateCurrentButton();
- void activateButton(const RadioStation &);
-
- void autoSetCaption();
-
-
- void dragEnterEvent(TQDragEnterEvent* event);
- void dropEvent(TQDropEvent* event);
-
- // KDE/QT
-
-public slots:
-
- void toggleShown() { WidgetPluginBase::pToggleShown(); }
- void show();
- void hide();
- void showOnOrgDesktop();
- void setGeometry (const TQRect &r);
- void setGeometry (int x, int y, int w, int h);
-
-protected:
- void rebuildGUI();
- void showEvent(TQShowEvent *);
- void hideEvent(TQHideEvent *);
- void resizeEvent(TQResizeEvent *);
-
- const TQWidget *getWidget() const { return this; }
- TQWidget *getWidget() { return this; }
-
-protected :
-
- ButtonFlowLayout *m_layout;
- TQButtonGroup *m_buttonGroup;
-
- TQPtrList<TQToolButton> m_buttons;
-
- // config
- bool m_showShortName;
- TQStringList m_stationIDs;
-
- bool m_ignoreNoticeActivation;
-};
-#endif