[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmix] /: KF5 port. First compiling version. KMix already works partially.
From: Christian Esken <esken () kde ! org>
Date: 2014-08-14 10:52:36
Message-ID: E1XHse4-0003SS-R7 () scm ! kde ! org
[Download RAW message or body]
Git commit f6ff99b87bf6e8c4e8cbb242e9385f118a2c2ccf by Christian Esken.
Committed on 14/08/2014 at 10:52.
Pushed by esken into branch 'master'.
KF5 port. First compiling version. KMix already works partially.
M +32 -5 CMakeLists.txt
M +13 -3 apps/kmix.cpp
M +1 -0 gui/dialogselectmaster.cpp
M +2 -0 gui/dialogviewconfiguration.cpp
M +32 -4 gui/kmixdockwidget.cpp
M +3 -0 gui/kmixdockwidget.h
M +13 -0 gui/kmixprefdlg.cpp
M +3 -0 gui/kmixtoolbox.cpp
M +5 -1 gui/mdwmoveaction.cpp
M +27 -18 gui/mdwslider.cpp
M +1 -1 gui/mdwslider.h
M +1 -1 gui/mixdevicewidget.cpp
M +1 -0 gui/viewbase.cpp
M +1 -0 gui/viewdockareapopup.cpp
http://commits.kde.org/kmix/f6ff99b87bf6e8c4e8cbb242e9385f118a2c2ccf
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 766920c..cc42eaa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,6 +40,8 @@ include(KDECMakeSettings)
find_package(KF5 REQUIRED COMPONENTS I18n Init Config GlobalAccel KDELibs4Support)
# find_package(KF5Solid NO_MODULE) : added according to \
http://api.kde.org/frameworks-api/frameworks5-apidocs/solid/html/index.html \
#find_package(KF5Solid NO_MODULE) +find_package(KF5ConfigWidgets)
+find_package(KF5IconThemes)
find_package(Qt5 REQUIRED COMPONENTS Core DBus Gui Widgets)
#include(KF5InitMacros)
@@ -136,6 +138,10 @@ endif (CANBERRA_FOUND)
#if (KMIX_KF5_BUILD)
# message( WARNING, "Skipping kmix_adaptor_SRCS due to missing \
qt4_add_dbus_adaptor ... KMix will NOT compile until this is fixed!!!" )
+
+####################################################################################################
+########### definitions: DBUSADAPTOR \
############################################################### \
+####################################################################################################
set(kmix_adaptor_SRCS
dbus/dbusmixerwrapper.cpp
dbus/dbusmixsetwrapper.cpp
@@ -157,6 +163,9 @@ qt4_add_dbus_adaptor( kmix_adaptor_SRCS \
dbus/org.kde.kmix.mixset.xml endif()
+####################################################################################################
+########### definitions: backends \
################################################################## \
+####################################################################################################
set(kmix_backend_SRCS
backends/mixer_backend.cpp
backends/mixer_mpris2.cpp
@@ -172,6 +181,12 @@ if (PULSEAUDIO_FOUND)
backends/mixer_pulse.cpp )
endif (PULSEAUDIO_FOUND)
+
+
+####################################################################################################
+########### next target : kmix \
##################################################################### \
+####################################################################################################
+
if (NOT KMIX_KF5_BUILD)
set( kmix_OSD_SRCS gui/osdwidget.cpp )
endif()
@@ -215,10 +230,8 @@ set(kmix_KDEINIT_SRCS ${kmix_adaptor_SRCS} ${kmix_backend_SRCS}
)
if (KMIX_KF5_BUILD)
-# message( WARNING, "Skipping kdeinit_executable due to missing \
KF5_ADD_KDEINIT_EXECUTABLE ... KMix will NOT compile until this is fixed!!!" ) \
kf5_add_kdeinit_executable( kmix ${kmix_KDEINIT_SRCS})
- #target_link_libraries( KF5::UI KF5::Plasma Qt5:XML KF5::Phonon)
- target_link_libraries(kdeinit_kmix KF5::I18n KF5::ConfigCore KF5::ConfigGui \
KF5::Solid KF5::KDELibs4Support Qt5::Core Qt5::Widgets Qt5::DBus Qt5::Xml) + \
target_link_libraries(kdeinit_kmix KF5::I18n KF5::ConfigCore KF5::ConfigGui \
KF5::ConfigWidgets KF5::IconThemes KF5::GlobalAccel KF5::KDELibs4Support Qt5::Core \
Qt5::Widgets Qt5::DBus Qt5::Xml) else()
kde4_add_kdeinit_executable( kmix ${kmix_KDEINIT_SRCS})
target_link_libraries(kdeinit_kmix ${KDE4_SOLID_LIBS} ${KDE4_KDEUI_LIBS} \
${KDE4_PLASMA_LIBS} ${QT_QTXML_LIBRARY} ${KDE4_PHONON_LIBS}) @@ -242,7 +255,12 @@ \
install(TARGETS kdeinit_kmix DESTINATION ${LIB_INSTALL_DIR} ) \
target_link_libraries( kmix kdeinit_kmix ) install(TARGETS kmix \
${INSTALL_TARGETS_DEFAULT_ARGS} )
-########### next target ###############
+
+
+
+####################################################################################################
+########### next target : kmixd \
#################################################################### \
+####################################################################################################
set(kded_kmixd_SRCS ${kmix_adaptor_SRCS} ${kmix_backend_SRCS}
apps/kmixd.cpp
@@ -294,7 +312,11 @@ install(TARGETS kded_kmixd DESTINATION ${PLUGIN_INSTALL_DIR})
install( FILES kmixd.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded )
-########### next target ###############
+
+
+####################################################################################################
+########### next target : kmixctrl \
################################################################# \
+####################################################################################################
set(kmixctrl_KDEINIT_SRCS ${kmix_adaptor_SRCS} ${kmix_backend_SRCS}
apps/kmixctrl.cpp
@@ -344,6 +366,11 @@ if (!KMIX_KF5_BUILD)
add_subdirectory( plasma )
endif()
+
+
+####################################################################################################
+########### INSTALL RULES \
########################################################################## \
+####################################################################################################
install( TARGETS kdeinit_kmixctrl DESTINATION ${LIB_INSTALL_DIR} )
target_link_libraries( kmixctrl kdeinit_kmixctrl )
diff --git a/apps/kmix.cpp b/apps/kmix.cpp
index 8ef488a..df368b0 100644
--- a/apps/kmix.cpp
+++ b/apps/kmix.cpp
@@ -42,7 +42,6 @@
#include <ktoggleaction.h>
#include <kapplication.h>
#include <kstandardaction.h>
-#include <kmenu.h>
#include <khelpmenu.h>
#include <kdebug.h>
#include <kxmlguifactory.h>
@@ -75,7 +74,7 @@
#ifdef X_KMIX_KF5_BUILD
#define CLASS_Action QAction
-#inlcude <QKeySequence>
+#include <QKeySequence>
#define CLASS_KShortcut QKeySequence
#else
#define CLASS_Action KAction
@@ -267,7 +266,6 @@ void KMixWindow::initActionsLate()
globalAction->setText(i18n("Increase Volume"));
#ifdef X_KMIX_KF5_BUILD
- QKeySequence* seq = new QKeySequence(Qt::Key_VolumeUp);
KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_VolumeUp);
#else
globalAction->setGlobalShortcut(CLASS_KShortcut(Qt::Key_VolumeUp));
@@ -277,12 +275,20 @@ void KMixWindow::initActionsLate()
globalAction = actionCollection()->addAction("decrease_volume");
globalAction->setText(i18n("Decrease Volume"));
+#ifdef X_KMIX_KF5_BUILD
+ KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_VolumeDown);
+#else
globalAction->setGlobalShortcut(CLASS_KShortcut(Qt::Key_VolumeDown));
+#endif
connect(globalAction, SIGNAL(triggered(bool)), SLOT(slotDecreaseVolume()));
globalAction = actionCollection()->addAction("mute");
globalAction->setText(i18n("Mute"));
+#ifdef X_KMIX_KF5_BUILD
+ KGlobalAccel::setGlobalShortcut(globalAction, Qt::Key_VolumeMute);
+#else
globalAction->setGlobalShortcut(CLASS_KShortcut(Qt::Key_VolumeMute));
+#endif
connect(globalAction, SIGNAL(triggered(bool)), SLOT(slotMute()));
}
}
@@ -328,7 +334,11 @@ void KMixWindow::initWidgets()
void KMixWindow::setInitialSize()
{
+#ifdef X_KMIX_KF5_BUILD
+ KConfigGroup config(KSharedConfig::openConfig(), "Global");
+#else
KConfigGroup config(KGlobal::config(), "Global");
+#endif
// HACK: QTabWidget will bound its sizeHint to 200x200 unless scrollbuttons
// are disabled, so we disable them, get a decent sizehint and enable them
diff --git a/gui/dialogselectmaster.cpp b/gui/dialogselectmaster.cpp
index bbd545e..cfbbd7f 100644
--- a/gui/dialogselectmaster.cpp
+++ b/gui/dialogselectmaster.cpp
@@ -27,6 +27,7 @@
#include <kcombobox.h>
#include <kdebug.h>
+#include <kiconloader.h>
#include <klocale.h>
#include "core/ControlManager.h"
diff --git a/gui/dialogviewconfiguration.cpp b/gui/dialogviewconfiguration.cpp
index 6caa68c..963627e 100644
--- a/gui/dialogviewconfiguration.cpp
+++ b/gui/dialogviewconfiguration.cpp
@@ -32,6 +32,8 @@
#include <kdebug.h>
#include <kdialog.h>
+#include <kicon.h>
+#include <KIconLoader>
#include <klocale.h>
#include <kvbox.h>
diff --git a/gui/kmixdockwidget.cpp b/gui/kmixdockwidget.cpp
index c1cc0a0..06aaacd 100644
--- a/gui/kmixdockwidget.cpp
+++ b/gui/kmixdockwidget.cpp
@@ -34,6 +34,7 @@
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDesktopWidget>
+#include <QAction>
#include <QApplication>
#include <QTextDocument>
@@ -105,7 +106,7 @@ void KMixDockWidget::controlsChange(int changeType)
// _kmixMainWindow->updateDocking();
// _kmixMainWindow->saveConfig();
refreshVolumeLevels();
- actionCollection()->action(QLatin1String("select_master"))->setEnabled(Mixer::getGlobalMasterMixer() \
!= 0); + findAction("select_master")->setEnabled(Mixer::getGlobalMasterMixer() \
!= 0); break;
case ControlChangeType::Volume:
@@ -117,6 +118,23 @@ void KMixDockWidget::controlsChange(int changeType)
}
}
+QAction* KMixDockWidget::findAction(const char* actionName)
+{
+#ifdef X_KMIX_KF5_BUILD
+ QList<QAction*> actions = actionCollection();
+ int size = actions.size();
+ for (int i=0; i<size; ++i)
+ {
+ QAction* action = actions.at(i);
+ if (action->text() == actionName)
+ return action;
+ }
+ return 0;
+#else
+ return actionCollection()->action(QLatin1String(actionName));
+#endif
+}
+
/**
* Updates all visual parts of the volume, namely tooltip and pixmap
*/
@@ -138,15 +156,25 @@ void KMixDockWidget::createMenuActions()
shared_ptr<MixDevice> md = Mixer::getGlobalMasterMD();
if ( md.get() != 0 && md->hasMuteSwitch() ) {
// Put "Mute" selector in context menu
- KToggleAction *action = actionCollection()->add<KToggleAction>( "dock_mute" \
);
- updateDockMuteAction(action);
+#ifdef X_KMIX_KF5_BUILD
+ KToggleAction *action = new KToggleAction("dock_mute", 0);
+ actionCollection().append(action);
+#else
+ KToggleAction *action = actionCollection()->add<KToggleAction>( "dock_mute" );
+#endif
+ updateDockMuteAction(action);
action->setText( i18n( "M&ute" ) );
connect(action, SIGNAL(triggered(bool)), SLOT(dockMute()));
menu->addAction( action );
}
// Put "Select Master Channel" dialog in context menu
+#ifdef X_KMIX_KF5_BUILD
+ KToggleAction *action = new KToggleAction("select_master", 0);
+ actionCollection().append(action);
+#else
QAction *action = actionCollection()->addAction( "select_master" );
+#endif
action->setText( i18n("Select Master Channel...") );
action->setEnabled(Mixer::getGlobalMasterMixer() != 0);
connect(action, SIGNAL(triggered(bool)), _kmixMainWindow, \
SLOT(slotSelectMaster())); @@ -368,7 +396,7 @@ bool \
KMixDockWidget::onlyHaveOneMouseButtonAction() void \
KMixDockWidget::contextMenuAboutToShow() {
// Enable/Disable "Muted" menu item
- KToggleAction *dockMuteAction = \
static_cast<KToggleAction*>(actionCollection()->action("dock_mute")); + \
KToggleAction *dockMuteAction = static_cast<KToggleAction*>(findAction("dock_mute")); \
updateDockMuteAction(dockMuteAction); }
diff --git a/gui/kmixdockwidget.h b/gui/kmixdockwidget.h
index 6eea270..a0d7a46 100644
--- a/gui/kmixdockwidget.h
+++ b/gui/kmixdockwidget.h
@@ -23,12 +23,14 @@
#ifndef KMIXDOCKWIDGET_H
#define KMIXDOCKWIDGET_H
+class QAction;
class QString;
class QWidgetAction;
class KToggleAction;
#include <kstatusnotifieritem.h>
+class KMenu;
class KMixWindow;
class Mixer;
#include "core/mixdevice.h"
@@ -70,6 +72,7 @@ class KMixDockWidget : public KStatusNotifierItem
bool onlyHaveOneMouseButtonAction();
void refreshVolumeLevels();
void updateDockMuteAction ( KToggleAction* dockMuteAction );
+ QAction* findAction(const char* actionName);
private slots:
void dockMute();
diff --git a/gui/kmixprefdlg.cpp b/gui/kmixprefdlg.cpp
index b4ef9b6..0b7f284 100644
--- a/gui/kmixprefdlg.cpp
+++ b/gui/kmixprefdlg.cpp
@@ -60,9 +60,14 @@ KMixPrefDlg::KMixPrefDlg(QWidget *parent, GlobalConfig& config) :
{
setFaceType(KPageDialog::List);
//setCaption(i18n("Configure"));
+
+#ifdef X_KMIX_KF5_BUILD
+#warning KMixPrefDlgnNeeds to be migrated to KF5 for buttons
+#else
setButtons(Ok | Cancel | Apply);
setDefaultButton(Ok);
+#endif
dvc = 0;
dvcSpacerBelow = 0;
@@ -77,7 +82,11 @@ KMixPrefDlg::KMixPrefDlg(QWidget *parent, GlobalConfig& config) :
createControlsTab();
updateWidgets(); // I thought KConfigDialog would call this, but I saw during a gdb \
session that it does not do so.
+#ifdef X_KMIX_KF5_BUILD
+#warning KMixPrefDlgnNeeds to be migrated to KF5 for buttons
+#else
showButtonSeparator(true);
+#endif
generalPage = addPage(m_generalTab, i18n("General"), "configure");
startupPage = addPage(m_startupTab, i18n("Start"), "preferences-system-login");
@@ -408,7 +417,11 @@ void KMixPrefDlg::showEvent(QShowEvent * event)
}
allowAutostart->setEnabled(autostartFileExists);
+#ifdef X_KMIX_KF5_BUILD
+ KConfigDialog::showEvent(event);
+#else
KDialog::showEvent(event);
+#endif
}
diff --git a/gui/kmixtoolbox.cpp b/gui/kmixtoolbox.cpp
index 07e0df8..988c82e 100644
--- a/gui/kmixtoolbox.cpp
+++ b/gui/kmixtoolbox.cpp
@@ -25,7 +25,10 @@
#include <QString>
//#include <kdebug.h>
+#include <KComponentData>
+#include <kglobal.h>
#include <kglobalaccel.h>
+#include <kiconloader.h>
#include <klocale.h>
#include <knotification.h>
diff --git a/gui/mdwmoveaction.cpp b/gui/mdwmoveaction.cpp
index 4fafdf1..6ef2c5b 100644
--- a/gui/mdwmoveaction.cpp
+++ b/gui/mdwmoveaction.cpp
@@ -20,8 +20,12 @@
*/
-//KMix
#include "mdwmoveaction.h"
+
+// KDE
+#include <kicon.h>
+
+//KMix
#include "core/mixdevice.h"
// Qt
diff --git a/gui/mdwslider.cpp b/gui/mdwslider.cpp
index cb4eeac..d94aa96 100644
--- a/gui/mdwslider.cpp
+++ b/gui/mdwslider.cpp
@@ -39,7 +39,7 @@
#include <QMouseEvent>
#include <QLabel>
#include <qpixmap.h>
-#include <qwmatrix.h>
+//#include <qwmatrix.h>
#include <QBoxLayout>
#include "core/ControlManager.h"
@@ -103,7 +103,7 @@ void MDWSlider::createActions()
taction->setText( i18n("&Split Channels") );
connect( taction, SIGNAL(triggered(bool)), SLOT(toggleStereoLinked()) );
- KAction *action;
+// KAction *action;
// if ( ! m_mixdevice->mixer()->isDynamic() ) {
// action = _mdwActions->add<KToggleAction>( "hide" );
// action->setText( i18n("&Hide") );
@@ -128,17 +128,17 @@ void MDWSlider::createActions()
connect( m_moveMenu, SIGNAL(aboutToShow()), SLOT(showMoveMenu()) );
}
- action = _mdwActions->addAction( "keys" );
- action->setText( i18n("C&onfigure Shortcuts...") );
- connect( action, SIGNAL(triggered(bool)), SLOT(defineKeys()) );
+ QAction* qaction = _mdwActions->addAction( "keys" );
+ qaction->setText( i18n("C&onfigure Shortcuts...") );
+ connect( qaction, SIGNAL(triggered(bool)), SLOT(defineKeys()) );
}
-void MDWSlider::addGlobalShortcut(KAction* action, const QString& label, bool \
dynamicControl) +void MDWSlider::addGlobalShortcut(QAction* qaction, const QString& \
label, bool dynamicControl) {
QString finalLabel(label);
finalLabel += " - " + mixDevice()->readableName() + ", " + \
mixDevice()->mixer()->readableName();
- action->setText(label);
+ qaction->setText(label);
if (!dynamicControl)
{
// virtual / dynamic controls won't get shortcuts
@@ -147,7 +147,12 @@ void MDWSlider::addGlobalShortcut(KAction* action, const \
QString& label, bool dy // #endif
// b->enableGlobalShortcut();
// enableGlobalShortcut() is not there => use workaround
- action->setGlobalShortcut(dummyShortcut);
+#ifdef X_KMIX_KF5_BUILD
+ KGlobalAccel::setGlobalShortcut(qaction, dummyShortcut);
+#else
+ KAction* kaction = (KAction*)qaction;
+ kaction->setGlobalShortcut(dummyShortcut);
+#endif
}
}
@@ -160,28 +165,32 @@ void MDWSlider::createShortcutActions()
I work around this by using a text with setText() that is unique, but still \
readable to the user.
*/
QString actionSuffix = QString(" - %1, %2").arg( mixDevice()->readableName() \
).arg( mixDevice()->mixer()->readableName() );
- KAction *b;
+#ifdef X_KMIX_KF5_BUILD
+ QAction *bi, *bd, *bm;
+#else
+ KAction *bi, *bd, *bm;
+#endif
// -1- INCREASE VOLUME SHORTCUT -----------------------------------------
- b = _mdwPopupActions->addAction( QString("Increase volume %1").arg( actionSuffix \
) ); + bi = _mdwPopupActions->addAction( QString("Increase volume %1").arg( \
actionSuffix ) ); QString increaseVolumeName = i18n( "Increase Volume" );
- addGlobalShortcut(b, increaseVolumeName, dynamicControl);
+ addGlobalShortcut(bi, increaseVolumeName, dynamicControl);
if ( ! dynamicControl )
- connect( b, SIGNAL(triggered(bool)), SLOT(increaseVolume()) );
+ connect( bi, SIGNAL(triggered(bool)), SLOT(increaseVolume()) );
// -2- DECREASE VOLUME SHORTCUT -----------------------------------------
- b = _mdwPopupActions->addAction( QString("Decrease volume %1").arg( actionSuffix \
) ); + bd = _mdwPopupActions->addAction( QString("Decrease volume %1").arg( \
actionSuffix ) ); QString decreaseVolumeName = i18n( "Decrease Volume" );
- addGlobalShortcut(b, decreaseVolumeName, dynamicControl);
+ addGlobalShortcut(bd, decreaseVolumeName, dynamicControl);
if ( ! dynamicControl )
- connect(b, SIGNAL(triggered(bool)), SLOT(decreaseVolume()));
+ connect(bd, SIGNAL(triggered(bool)), SLOT(decreaseVolume()));
// -3- MUTE VOLUME SHORTCUT -----------------------------------------
- b = _mdwPopupActions->addAction( QString("Toggle mute %1").arg( actionSuffix ) \
); + bm = _mdwPopupActions->addAction( QString("Toggle mute %1").arg( actionSuffix \
) ); QString muteVolumeName = i18n( "Toggle Mute" );
- addGlobalShortcut(b, muteVolumeName, dynamicControl);
+ addGlobalShortcut(bm, muteVolumeName, dynamicControl);
if ( ! dynamicControl )
- connect( b, SIGNAL(triggered(bool)), SLOT(toggleMuted()) );
+ connect( bm, SIGNAL(triggered(bool)), SLOT(toggleMuted()) );
}
diff --git a/gui/mdwslider.h b/gui/mdwslider.h
index f3047e9..9414ca0 100644
--- a/gui/mdwslider.h
+++ b/gui/mdwslider.h
@@ -152,7 +152,7 @@ private:
QBoxLayout* layoutForCapture, const QString& captureTooltipText);
void guiAddMuteButton(bool wantsMuteButton, Qt::Alignment alignment, QBoxLayout* \
layoutForMuteButton, const QString& muteTooltipText); void \
guiAddControlIcon(Qt::Alignment alignment, QBoxLayout* layout, const QString& \
tooltipText);
- void addGlobalShortcut(KAction* action, const QString& label, bool dynamicControl);
+ void addGlobalShortcut(QAction* action, const QString& label, bool dynamicControl);
bool m_linked;
diff --git a/gui/mixdevicewidget.cpp b/gui/mixdevicewidget.cpp
index ac7e626..bbc8504 100644
--- a/gui/mixdevicewidget.cpp
+++ b/gui/mixdevicewidget.cpp
@@ -34,7 +34,7 @@
#include <qcursor.h>
#include <QMouseEvent>
#include <qpixmap.h>
-#include <qwmatrix.h>
+//#include <qwmatrix.h>
#include "core/mixer.h"
#include "core/mixertoolbox.h"
diff --git a/gui/viewbase.cpp b/gui/viewbase.cpp
index 964141a..db12917 100644
--- a/gui/viewbase.cpp
+++ b/gui/viewbase.cpp
@@ -27,6 +27,7 @@
// KDE
#include <kaction.h>
+#include <kicon.h>
#include <kmenu.h>
#include <klocale.h>
#include <kiconloader.h>
diff --git a/gui/viewdockareapopup.cpp b/gui/viewdockareapopup.cpp
index 3e9192c..64db6ac 100644
--- a/gui/viewdockareapopup.cpp
+++ b/gui/viewdockareapopup.cpp
@@ -34,6 +34,7 @@
#include <kapplication.h>
#include <kdebug.h>
#include <kdialog.h>
+#include <kicon.h>
#include <klocale.h>
#include <kwindowsystem.h>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic