icon loader and icons for media control

pull/1/head
Emanoil Kotsev 5 years ago
parent 75c50b0b8b
commit ac69199619

@ -9,19 +9,6 @@
#
#################################################
#/opt/trinity/share/icons
#install( FILES
# hi128-app-tdebluez.png
# hi16-app-tdebluez.png
# hi22-app-tdebluelock.png
# hi22-app-tdebluez.png
# hi32-app-bluetooth.png
# hi32-app-tdebluelock.png
# hi32-app-tdebluez.png
# hi48-app-bluetooth.png
# hi48-app-tdebluez.png
# hi64-app-tdebluez.png
# DESTINATION ${DATA_INSTALL_DIR}/tdebluez/icons )
##### install import cmake modules ###############
##### install icons in /opt/trinity/share/icons ###############
tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/tdebluez/icons )

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

@ -26,26 +26,38 @@
#include <kdebug.h>
#include <ntqpushbutton.h>
#include <ntqslider.h>
#include <kiconloader.h>
#include "mediacontrol.h"
#define MEDIAPLAYBACK_START "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-playback-start.png"
#define MEDIAPLAYBACK_PAUSE "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-playback-pause.png"
#define MEDIAPLAYBACK_SEEKFWD "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-seek-forward.png"
#define MEDIAPLAYBACK_SEEKBWD "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-seek-backward.png"
#define MEDIAPLAYBACK_FWD "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-skip-forward.png"
#define MEDIAPLAYBACK_BWD "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-skip-backward.png"
#define MEDIAPLAYBACK_STOP "/opt/trinity/share/icons/kdeclassic/22x22/actions/media-playback-stop.png"
MediaControl::MediaControl(TQString path, TQT_DBusConnection *conn)
: MediaCtlDlg()
{
kdDebug() << "Path :" << path << endl;
tQPushButtonPlay->setPixmap(TQPixmap(MEDIAPLAYBACK_START));
tQPushButtonSeekForward->setPixmap(TQPixmap(MEDIAPLAYBACK_SEEKFWD));
tQPushButtonSeekBackward->setPixmap(TQPixmap(MEDIAPLAYBACK_SEEKBWD));
tQPushButtonForward->setPixmap(TQPixmap(MEDIAPLAYBACK_FWD));
tQPushButtonBackward->setPixmap(TQPixmap(MEDIAPLAYBACK_BWD));
tQPushButtonStop->setPixmap(TQPixmap(MEDIAPLAYBACK_STOP));
pixStart = TDEGlobal::iconLoader()->loadIcon("media-playback-start", TDEIcon::Small, 22);
pixPause = TDEGlobal::iconLoader()->loadIcon("media-playback-pause", TDEIcon::Small, 22);
tQPushButtonPlay->setPixmap(pixStart);
tQPushButtonSeekForward->setPixmap(
TDEGlobal::iconLoader()->loadIcon("media-seek-forward", TDEIcon::Small, 22)
);
tQPushButtonSeekBackward->setPixmap(
TDEGlobal::iconLoader()->loadIcon("media-seek-backward", TDEIcon::Small, 22)
);
tQPushButtonForward->setPixmap(
TDEGlobal::iconLoader()->loadIcon("media-skip-forward", TDEIcon::Small, 22)
);
tQPushButtonBackward->setPixmap(
TDEGlobal::iconLoader()->loadIcon("media-skip-backward", TDEIcon::Small, 22)
);
tQPushButtonStop->setPixmap(
TDEGlobal::iconLoader()->loadIcon("media-playback-stop", TDEIcon::Small, 22)
);
tQVolumeSlider->setTracking(false);
tQVolumeSlider->setRange(0,100);
volume=50;
tQVolumeSlider->setValue(volume);
mPath = path;
mediaCtlProxy = new org::bluez::MediaControl1("org.bluez", path);
@ -59,7 +71,7 @@ MediaControl::MediaControl(TQString path, TQT_DBusConnection *conn)
connect((TQObject*)tQPushButtonBackward, SIGNAL(clicked()), this, SLOT(slotPrevious()));
connect((TQObject*)tQPushButtonStop, SIGNAL(clicked()), this, SLOT(slotStop()));
// tQProgressSlider
// tQVolumeSlider
connect((TQObject*)tQVolumeSlider, SIGNAL(valueChanged(int)), this, SLOT(slotVolumeValueChanged(int)));
// tQPushButtonRepeat
show();
}
@ -80,9 +92,7 @@ void MediaControl::slotPlay()
{
kdDebug() << k_funcinfo << endl;
TQT_DBusError error;
if (mediaCtlProxy->Play(error))
isPlaying = true;
else
if (! mediaCtlProxy->Play(error))
//TODO: implement error dialog
kdDebug() << "Play failed: " << error.message() << endl;
}
@ -91,11 +101,11 @@ void MediaControl::slotPlayToggled(bool state)
{
kdDebug() << k_funcinfo << endl;
if (state) {
tQPushButtonPlay->setPixmap(TQPixmap(MEDIAPLAYBACK_PAUSE));
tQPushButtonPlay->setPixmap(pixPause);
}
else {
slotPause();
tQPushButtonPlay->setPixmap(TQPixmap(MEDIAPLAYBACK_START));
tQPushButtonPlay->setPixmap(pixStart);
}
}
@ -104,8 +114,8 @@ void MediaControl::slotStop()
kdDebug() << k_funcinfo << endl;
TQT_DBusError error;
if (mediaCtlProxy->Stop(error)) {
isPlaying = false;
if ( tQPushButtonPlay->isOn() ) tQPushButtonPlay->toggle();
if ( tQPushButtonPlay->isOn() )
tQPushButtonPlay->toggle();
}
else
//TODO: implement error dialog
@ -116,9 +126,7 @@ void MediaControl::slotPause()
{
kdDebug() << k_funcinfo << endl;
TQT_DBusError error;
if (mediaCtlProxy->Pause(error))
isPlaying = false;
else
if (! mediaCtlProxy->Pause(error))
//TODO: implement error dialog
kdDebug() << "Stop failed" << error.message() << endl;
}
@ -159,15 +167,22 @@ void MediaControl::slotRewind()
kdDebug() << "Rewind failed" << error.message() << endl;
}
void MediaControl::slotVolumeUp()
{
kdDebug() << k_funcinfo << endl;
}
void MediaControl::slotVolumeDown()
void MediaControl::slotVolumeValueChanged(int val)
{
kdDebug() << k_funcinfo << endl;
if (val > volume) {
TQT_DBusError error;
if (! mediaCtlProxy->VolumeUp(error))
//TODO: implement error dialog
kdDebug() << "VolumeUp failed" << error.message() << endl;
}
if (val < volume) {
TQT_DBusError error;
if (! mediaCtlProxy->VolumeDown(error))
//TODO: implement error dialog
kdDebug() << "VolumeDown failed" << error.message() << endl;
}
volume=val;
}

@ -50,13 +50,14 @@ class MediaControl : public MediaCtlDlg {
void slotPrevious();
void slotFastForward();
void slotRewind();
void slotVolumeUp();
void slotVolumeDown();
void slotVolumeValueChanged(int);
private:
TQString mPath;
bool isPlaying;
int volume;
org::bluez::MediaControl1 *mediaCtlProxy;
TQPixmap pixStart;
TQPixmap pixPause;
};

@ -6,12 +6,24 @@
</property>
<property name="geometry">
<rect>
<x>0</x>
<x>1</x>
<y>0</y>
<width>257</width>
<height>178</height>
<width>140</width>
<height>140</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>140</width>
<height>140</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>140</width>
<height>140</height>
</size>
</property>
<property name="caption">
<string>Media Control</string>
</property>
@ -23,8 +35,8 @@
<rect>
<x>0</x>
<y>10</y>
<width>247</width>
<height>159</height>
<width>120</width>
<height>120</height>
</rect>
</property>
<grid>
@ -84,8 +96,8 @@
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
@ -111,8 +123,8 @@
</property>
<property name="maximumSize">
<size>
<width>31</width>
<height>32</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
@ -135,8 +147,8 @@
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
@ -159,8 +171,8 @@
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
@ -183,8 +195,8 @@
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
@ -207,8 +219,8 @@
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">

@ -158,7 +158,7 @@ TrayIcon::TrayIcon(TDEBluetoothApp* app)
// showIconAction->setText(i18n("Always &Visible"));
// configActionMenu->insert(showIconAction);
KPixmap logoPixmap = TDEGlobal::iconLoader()->loadIcon("tdebluez", TDEIcon::Small, 22);
TQPixmap logoPixmap = TDEGlobal::iconLoader()->loadIcon("tdebluez", TDEIcon::Small, 22);
iconIdle = logoPixmap;
iconOff = logoPixmap;
iconConnected = logoPixmap;

@ -35,7 +35,7 @@
#include <algorithm>
#include <ksystemtray.h>
#include <kpixmap.h>
#include <ntqpixmap.h>
//#include <tdeaboutapplication.h>
#include <tdeaction.h>
#include <tdeapplication.h>

Loading…
Cancel
Save