summaryrefslogtreecommitdiffstats
path: root/kradio3/plugins/gui-quickbar/quickbar.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-01 03:43:07 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-01 03:43:07 +0000
commit70b9eea2ba01c3691497f49e4c45cb070c16193c (patch)
tree9a6df61aa247a27275aad9c5245e419e89c2c640 /kradio3/plugins/gui-quickbar/quickbar.cpp
parent998c1384ace4ae4655997c181fa33242148cd0a4 (diff)
downloadtderadio-70b9eea2ba01c3691497f49e4c45cb070c16193c.tar.gz
tderadio-70b9eea2ba01c3691497f49e4c45cb070c16193c.zip
TQt4 port kradio
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kradio@1238952 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kradio3/plugins/gui-quickbar/quickbar.cpp')
-rw-r--r--kradio3/plugins/gui-quickbar/quickbar.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/kradio3/plugins/gui-quickbar/quickbar.cpp b/kradio3/plugins/gui-quickbar/quickbar.cpp
index 628a1bf..1ae3623 100644
--- a/kradio3/plugins/gui-quickbar/quickbar.cpp
+++ b/kradio3/plugins/gui-quickbar/quickbar.cpp
@@ -15,10 +15,10 @@
* *
***************************************************************************/
-#include <qtooltip.h>
-#include <qnamespace.h>
-#include <qhbuttongroup.h>
-#include <qvbuttongroup.h>
+#include <tqtooltip.h>
+#include <tqnamespace.h>
+#include <tqhbuttongroup.h>
+#include <tqvbuttongroup.h>
#include <ktoolbarbutton.h>
#include <kwin.h>
@@ -43,8 +43,8 @@ PLUGIN_LIBRARY_FUNCTIONS(QuickBar, "kradio-gui-quickbar", i18n("Radio Station Qu
/////////////////////////////////////////////////////////////////////////////
-QuickBar::QuickBar(const QString &name)
- : QWidget(NULL, name.ascii()),
+QuickBar::QuickBar(const TQString &name)
+ : TQWidget(NULL, name.ascii()),
WidgetPluginBase(name, i18n("Quickbar Plugin")),
m_layout(NULL),
m_buttonGroup(NULL),
@@ -83,7 +83,7 @@ bool QuickBar::disconnectI(Interface *i)
// IStationSelection
-bool QuickBar::setStationSelection(const QStringList &sl)
+bool QuickBar::setStationSelection(const TQStringList &sl)
{
if (m_stationIDs != sl) {
m_stationIDs = sl;
@@ -98,14 +98,14 @@ bool QuickBar::setStationSelection(const QStringList &sl)
void QuickBar::restoreState (KConfig *config)
{
- config->setGroup(QString("quickBar-") + name());
+ 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) {
- 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;
}
@@ -117,15 +117,15 @@ void QuickBar::restoreState (KConfig *config)
void QuickBar::saveState (KConfig *config) const
{
- config->setGroup(QString("quickBar-") + name());
+ config->setGroup(TQString("quickBar-") + name());
WidgetPluginBase::saveState(config);
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);
}
}
@@ -200,14 +200,14 @@ bool QuickBar::noticeStationsChanged(const StationList &/*sl*/)
void QuickBar::buttonClicked(int id)
{
- // ouch, but we are still using QStringList :(
+ // ouch, but we are still using TQStringList :(
if (queryIsPowerOn() && id == getButtonID(queryCurrentStation())) {
sendPowerOff();
} else {
int k = 0;
- QStringList::iterator end = m_stationIDs.end();
- for (QStringList::iterator it = m_stationIDs.begin(); it != end; ++it, ++k) {
+ 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);
@@ -229,10 +229,10 @@ void QuickBar::buttonClicked(int id)
int QuickBar::getButtonID(const RadioStation &rs) const
{
- QString stationID = rs.stationID();
+ TQString stationID = rs.stationID();
int k = 0;
- QStringList::const_iterator end = m_stationIDs.end();
- for (QStringList::const_iterator it = m_stationIDs.begin(); it != end; ++it, ++k) {
+ TQStringList::const_iterator end = m_stationIDs.end();
+ for (TQStringList::const_iterator it = m_stationIDs.begin(); it != end; ++it, ++k) {
if (*it == stationID)
return k;
}
@@ -254,7 +254,7 @@ void QuickBar::activateButton(const RadioStation &rs)
if (pwr && buttonID >= 0) {
m_buttonGroup->setButton(buttonID);
} else {
- for (QToolButton *b = m_buttons.first(); b; b = m_buttons.next()) {
+ for (TQToolButton *b = m_buttons.first(); b; b = m_buttons.next()) {
b->setOn(false);
}
}
@@ -263,7 +263,7 @@ void QuickBar::activateButton(const RadioStation &rs)
-// KDE/Qt gui
+// KDE/TQt gui
void QuickBar::rebuildGUI()
@@ -271,7 +271,7 @@ void QuickBar::rebuildGUI()
if (m_layout) delete m_layout;
if (m_buttonGroup) delete m_buttonGroup;
- for (QPtrListIterator<QToolButton> it(m_buttons); it.current(); ++it)
+ for (TQPtrListIterator<TQToolButton> it(m_buttons); it.current(); ++it)
delete it.current();
m_buttons.clear();
@@ -279,33 +279,33 @@ void QuickBar::rebuildGUI()
m_layout->setMargin(1);
m_layout->setSpacing(2);
- m_buttonGroup = new QButtonGroup(this);
- QObject::connect (m_buttonGroup, SIGNAL(clicked(int)), this, SLOT(buttonClicked(int)));
+ 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(QFrame::NoFrame);
+ m_buttonGroup->setFrameStyle(TQFrame::NoFrame);
m_buttonGroup->show();
int buttonID = 0;
const RawStationList &stations = queryStations().all();
- QStringList::iterator end = m_stationIDs.end();
- for (QStringList::iterator it = m_stationIDs.begin(); it != end; ++it, ++buttonID) {
+ 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;
- QToolButton *b = new QToolButton(this);
+ TQToolButton *b = new TQToolButton(this);
m_buttons.append(b);
b->setToggleButton(true);
if (rs.iconName().length())
- b->setIconSet(QPixmap(rs.iconName()));
+ b->setIconSet(TQPixmap(rs.iconName()));
else
b->setText(m_showShortName ? rs.shortName() : rs.name());
- b->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
+ b->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Preferred));
- QToolTip::add(b, rs.longName());
+ TQToolTip::add(b, rs.longName());
if (isVisible()) b->show();
@@ -316,9 +316,9 @@ void QuickBar::rebuildGUI()
// activate correct button
activateCurrentButton();
- // calculate geometry
+ // calculate tqgeometry
if (m_layout) {
- QRect r = geometry();
+ TQRect r = tqgeometry();
int h = m_layout->heightForWidth( r.width());
if (h > r.height())
@@ -333,32 +333,32 @@ void QuickBar::show()
{
// KWin::setType(winId(), NET::Toolbar);
WidgetPluginBase::pShow();
- QWidget::show();
+ TQWidget::show();
}
void QuickBar::showOnOrgDesktop()
{
WidgetPluginBase::pShowOnOrgDesktop();
- //QWidget::show();
+ //TQWidget::show();
}
void QuickBar::hide()
{
WidgetPluginBase::pHide();
- QWidget::hide();
+ TQWidget::hide();
}
-void QuickBar::showEvent(QShowEvent *e)
+void QuickBar::showEvent(TQShowEvent *e)
{
- QWidget::showEvent(e);
+ TQWidget::showEvent(e);
WidgetPluginBase::pShowEvent(e);
}
-void QuickBar::hideEvent(QHideEvent *e)
+void QuickBar::hideEvent(TQHideEvent *e)
{
- QWidget::hideEvent(e);
+ TQWidget::hideEvent(e);
WidgetPluginBase::pHideEvent(e);
}
@@ -366,38 +366,38 @@ void QuickBar::hideEvent(QHideEvent *e)
void QuickBar::setGeometry (int x, int y, int w, int h)
{
if (m_layout) {
- QSize marginSize(m_layout->margin()*2, m_layout->margin()*2);
- setMinimumSize(m_layout->minimumSize(QSize(w, h) - marginSize) + marginSize);
+ TQSize marginSize(m_layout->margin()*2, m_layout->margin()*2);
+ setMinimumSize(m_layout->tqminimumSize(TQSize(w, h) - marginSize) + marginSize);
}
- QWidget::setGeometry (x, y, w, h);
+ TQWidget::setGeometry (x, y, w, h);
}
-void QuickBar::setGeometry (const QRect &r)
+void QuickBar::setGeometry (const TQRect &r)
{
setGeometry (r.x(), r.y(), r.width(), r.height());
}
-void QuickBar::resizeEvent (QResizeEvent *e)
+void QuickBar::resizeEvent (TQResizeEvent *e)
{
- // minimumSize might change because of the flow layout
+ // tqminimumSize might change because of the flow tqlayout
if (m_layout) {
- QSize marginSize(m_layout->margin()*2, m_layout->margin()*2);
- setMinimumSize(m_layout->minimumSize(e->size() - marginSize) + marginSize);
+ TQSize marginSize(m_layout->margin()*2, m_layout->margin()*2);
+ setMinimumSize(m_layout->tqminimumSize(e->size() - marginSize) + marginSize);
}
- QWidget::resizeEvent (e);
+ TQWidget::resizeEvent (e);
}
void QuickBar::autoSetCaption()
{
const RadioStation &rs = queryCurrentStation();
- setCaption((queryIsPowerOn() && rs.isValid()) ? rs.longName() : QString("KRadio"));
+ setCaption((queryIsPowerOn() && rs.isValid()) ? rs.longName() : TQString("KRadio"));
}
-void QuickBar::dragEnterEvent(QDragEnterEvent* event)
+void QuickBar::dragEnterEvent(TQDragEnterEvent* event)
{
bool a = StationDragObject::canDecode(event);
if (a)
@@ -407,14 +407,14 @@ void QuickBar::dragEnterEvent(QDragEnterEvent* event)
event->accept(a);
}
-void QuickBar::dropEvent(QDropEvent* event)
+void QuickBar::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);
}