Commit 3dc41085 authored by Michael Pyne's avatar Michael Pyne

Port KAction -> QAction.

This seemed a bit too easy, even with the convert scripts... be wary of
potential bugs.
parent 76924566
......@@ -45,7 +45,7 @@ namespace ActionCollection
#ifndef NO_DEBUG
QAction *a = actions()->action(key);
if(!a)
qCWarning(JUK_LOG) << "KAction \"" << key << "\" is not defined yet.";
qCWarning(JUK_LOG) << "QAction \"" << key << "\" is not defined yet.";
return a;
#else
return actions()->action(key);
......
......@@ -26,7 +26,7 @@
#include <ktoggleaction.h>
#include <kactionmenu.h>
#include <QIcon>
#include <kaction.h>
#include <QAction>
#include <kconfiggroup.h>
#include <kapplication.h>
#include <kglobal.h>
......@@ -432,7 +432,7 @@ void JuK::readConfig()
bool enableCrossfade = playerConfig.readEntry("CrossfadeTracks", true);
m_player->setCrossfadeEnabled(enableCrossfade);
//ActionCollection::action<KAction>("crossfadeTracks")->setChecked(enableCrossfade);
//ActionCollection::action<QAction>("crossfadeTracks")->setChecked(enableCrossfade);
}
// Default to no random play
......@@ -443,10 +443,10 @@ void JuK::readConfig()
if(randomPlayMode == "true" || randomPlayMode == "Normal")
m_randomPlayAction->setChecked(true);
else if(randomPlayMode == "AlbumRandomPlay")
ActionCollection::action<KAction>("albumRandomPlay")->setChecked(true);
ActionCollection::action<QAction>("albumRandomPlay")->setChecked(true);
bool loopPlaylist = playerConfig.readEntry("LoopPlaylist", false);
//ActionCollection::action<KAction>("loopPlaylist")->setChecked(loopPlaylist);
//ActionCollection::action<QAction>("loopPlaylist")->setChecked(loopPlaylist);
// general settings
......@@ -477,13 +477,13 @@ void JuK::saveConfig()
playerConfig.writeEntry("RandomPlay", m_randomPlayAction->isChecked());
KAction *a = ActionCollection::action<KAction>("loopPlaylist");
QAction *a = ActionCollection::action<QAction>("loopPlaylist");
playerConfig.writeEntry("LoopPlaylist", a->isChecked());
a = ActionCollection::action<KAction>("crossfadeTracks");
a = ActionCollection::action<QAction>("crossfadeTracks");
playerConfig.writeEntry("CrossfadeTracks", a->isChecked());
a = ActionCollection::action<KAction>("albumRandomPlay");
a = ActionCollection::action<QAction>("albumRandomPlay");
if(a->isChecked())
playerConfig.writeEntry("RandomPlay", "AlbumRandomPlay");
else if(m_randomPlayAction->isChecked())
......
......@@ -22,11 +22,14 @@
#include <klocale.h>
#include <kshortcutseditor.h>
#include <kglobal.h>
#include <kaction.h>
#include <QAction>
#include <kvbox.h>
#include <kconfiggroup.h>
#include <KShortcut>
#include <KGlobalAccel>
#include <QAction>
#include <QKeySequence>
#include <QList>
#include <QHBoxLayout>
#include <QTimer>
#include <QButtonGroup>
......@@ -38,54 +41,54 @@
struct KeyDialog::KeyInfo {
QString action;
KShortcut shortcut[3];
QKeySequence shortcut[3];
};
const KeyDialog::KeyInfo KeyDialog::keyInfo[] = {
{ "playPause",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_P),
KShortcut(Qt::Key_MediaPlay) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_P),
QKeySequence(Qt::Key_MediaPlay) } },
{ "stop",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_S),
KShortcut(Qt::Key_MediaStop) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_S),
QKeySequence(Qt::Key_MediaStop) } },
{ "back",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_Left),
KShortcut(Qt::Key_MediaPrevious) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_Left),
QKeySequence(Qt::Key_MediaPrevious) } },
{ "forward",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_Right),
KShortcut(Qt::Key_MediaNext) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_Right),
QKeySequence(Qt::Key_MediaNext) } },
{ "forwardAlbum",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_Up),
KShortcut(Qt::CTRL+Qt::Key_MediaNext) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_Up),
QKeySequence(Qt::CTRL+Qt::Key_MediaNext) } },
{ "seekBack",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Left),
KShortcut(Qt::SHIFT+Qt::Key_MediaPrevious) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Left),
QKeySequence(Qt::SHIFT+Qt::Key_MediaPrevious) } },
{ "seekForward",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Right),
KShortcut(Qt::SHIFT+Qt::Key_MediaNext) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_Right),
QKeySequence(Qt::SHIFT+Qt::Key_MediaNext) } },
{ "volumeUp",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Up),
KShortcut(Qt::Key_VolumeUp) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Up),
QKeySequence(Qt::Key_VolumeUp) } },
{ "volumeDown",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Down),
KShortcut(Qt::Key_VolumeDown) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::SHIFT+Qt::Key_Down),
QKeySequence(Qt::Key_VolumeDown) } },
{ "mute",
{ KShortcut(),
KShortcut(Qt::CTRL+Qt::ALT+Qt::Key_M),
KShortcut(Qt::Key_VolumeMute) } },
{ QKeySequence(),
QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_M),
QKeySequence(Qt::Key_VolumeMute) } },
{ "showHide",
{ KShortcut(),
KShortcut(),
KShortcut() } }
{ QKeySequence(),
QKeySequence(),
QKeySequence() } }
};
const uint KeyDialog::keyInfoCount = sizeof(KeyDialog::keyInfo) / sizeof(KeyDialog::keyInfo[0]);
......@@ -163,13 +166,20 @@ void KeyDialog::slotKeys(int group)
{
// Set modifier keys according to key group and modifier keys
auto globalAccel = KGlobalAccel::self();
for(uint i = 0; i < keyInfoCount; i++) {
KAction *a = ActionCollection::action<KAction>(keyInfo[i].action);
QAction *a = ActionCollection::action<QAction>(keyInfo[i].action);
if(a) {
KShortcut shortcut(keyInfo[i].shortcut[group]);
a->setGlobalShortcut(shortcut, KAction::ActiveShortcut, KAction::NoAutoloading);
if (group == 0) {
globalAccel->removeAllShortcuts(a);
}
else {
QKeySequence shortcut(keyInfo[i].shortcut[group]);
QList<QKeySequence> shortcutList{shortcut};
globalAccel->setShortcut(a, shortcutList, KGlobalAccel::NoAutoloading);
}
}
}
......@@ -200,7 +210,7 @@ int KeyDialog::configure(KActionCollection *actionCollection, QWidget *parent)
void KeyDialog::setupActionShortcut(const QString &actionName)
{
// Find and insert a standard key
KShortcut shortcut = KShortcut();
QKeySequence shortcut = QKeySequence();
// Find out what type is selected so we know what keys to setup.
KConfigGroup config(KSharedConfig::openConfig(), "Shortcuts");
......@@ -216,9 +226,10 @@ void KeyDialog::setupActionShortcut(const QString &actionName)
if(shortcut.isEmpty())
return; // We have no shortcut to set.
KAction *a = ActionCollection::action<KAction>(actionName);
if(a)
a->setGlobalShortcut(shortcut);
QAction *a = ActionCollection::action<QAction>(actionName);
if(a) {
KGlobalAccel::setGlobalShortcut(a, shortcut);
}
}
// vim: set et sw=4 tw=0 sta:
......@@ -18,7 +18,7 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <KAction>
#include <QAction>
#include <KLocalizedString>
#include <KActionCollection>
#include <KToggleAction>
......
......@@ -20,7 +20,7 @@
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kmenu.h>
#include <kaction.h>
#include <QAction>
#include <kactioncollection.h>
#include <kdebug.h>
#include <ktoggleaction.h>
......
......@@ -136,7 +136,7 @@ private:
QHash<Playlist *, Item*> m_playlistDict;
int m_viewModeIndex;
QList<ViewMode *> m_viewModes;
KAction *m_k3bAction;
QAction *m_k3bAction;
bool m_hasSelection;
bool m_doingMultiSelect;
Item *m_dropItem;
......
......@@ -18,13 +18,11 @@
#include "playlistcollection.h"
#include <kurl.h>
#include <QIcon>
#include <kiconloader.h>
#include <kapplication.h>
#include <kinputdialog.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <ktoggleaction.h>
#include <kactionmenu.h>
......@@ -34,10 +32,12 @@
#include <config-juk.h>
#include <QAction>
#include <QIcon>
#include <QMutableListIterator>
#include <QObject>
#include <QPixmap>
#include <QStackedWidget>
#include <QMutableListIterator>
#include <sys/types.h>
#include <dirent.h>
......@@ -981,20 +981,20 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
this, SLOT(slotSetUpcomingPlaylistEnabled(bool)));
}
KAction *PlaylistCollection::ActionHandler::createAction(const QString &text,
QAction *PlaylistCollection::ActionHandler::createAction(const QString &text,
const char *slot,
const char *name,
const QString &icon,
const KShortcut &shortcut)
{
KAction *action;
QAction *action;
if(icon.isNull())
action = new KAction(text, actions());
action = new QAction(text, actions());
else
action = new KAction(QIcon::fromTheme(icon), text, actions());
action = new QAction(QIcon::fromTheme(icon), text, actions());
actions()->addAction(name, action);
connect( action, SIGNAL(triggered(bool)), slot);
action->setShortcut(shortcut);
action->setShortcut(shortcut.toList().constFirst());
return action;
}
......
......@@ -29,7 +29,7 @@
class QPixmap;
class QStackedWidget;
class KAction;
class QAction;
class HistoryPlaylist;
class UpcomingPlaylist;
......@@ -241,7 +241,7 @@ public:
ActionHandler(PlaylistCollection *collection);
private:
KAction *createAction(const QString &text,
QAction *createAction(const QString &text,
const char *slot,
const char *name,
const QString &icon = QString(),
......
......@@ -18,7 +18,7 @@
#include "playlistsplitter.h"
#include <QIcon>
#include <kaction.h>
#include <QAction>
#include <kglobal.h>
#include <kactioncollection.h>
#include <kdebug.h>
......@@ -163,7 +163,7 @@ void PlaylistSplitter::setupActions()
new KToggleAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18n("Show &Search Bar"), this);
coll->addAction("showSearch", showSearch);
KAction *act = new KAction(QIcon::fromTheme(QStringLiteral("edit-clear")), i18n("Edit Track Search"), this);
QAction *act = new QAction(QIcon::fromTheme(QStringLiteral("edit-clear")), i18n("Edit Track Search"), this);
coll->addAction("editTrackSearch", act);
act->setShortcut(Qt::Key_F6);
connect(act, SIGNAL(triggered(bool)), SLOT(setFocus()));
......
......@@ -25,7 +25,7 @@
#include <kiconloader.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <kaction.h>
#include <QAction>
#include <QLabel>
#include <QCheckBox>
......
......@@ -33,7 +33,7 @@
#include "juk.h"
TrackPositionAction::TrackPositionAction(const QString &text, QObject *parent) :
KAction(text, parent)
QAction(text, parent)
{
}
......@@ -72,7 +72,7 @@ void TrackPositionAction::totalTimeChanged(int ms)
}
VolumeAction::VolumeAction(const QString &text, QObject *parent) :
KAction(text, parent),
QAction(text, parent),
m_button(0)
{
......
......@@ -17,14 +17,14 @@
#ifndef SLIDERACTION_H
#define SLIDERACTION_H
#include <kaction.h>
#include <QAction>
#include <QBoxLayout>
#include "volumepopupbutton.h"
class Slider;
class TrackPositionAction : public KAction
class TrackPositionAction : public QAction
{
Q_OBJECT
public:
......@@ -37,7 +37,7 @@ private slots:
void totalTimeChanged(int ms);
};
class VolumeAction : public KAction
class VolumeAction : public QAction
{
Q_OBJECT
public:
......
......@@ -16,7 +16,7 @@
#include "statuslabel.h"
#include <kaction.h>
#include <QAction>
#include <kiconloader.h>
#include <ksqueezedtextlabel.h>
#include <klocale.h>
......
......@@ -20,7 +20,7 @@
#include <klocale.h>
#include <kiconloader.h>
#include <kaction.h>
#include <QAction>
#include <kdebug.h>
#include <kactioncollection.h>
#include <kactionmenu.h>
......@@ -163,7 +163,7 @@ SystemTray::SystemTray(PlayerManager *player, QWidget *parent) :
// Just create this here so that it show up in the DBus interface and the
// key bindings dialog.
KAction *rpaction = new KAction(i18n("Redisplay Popup"), this);
QAction *rpaction = new QAction(i18n("Redisplay Popup"), this);
ActionCollection::actions()->addAction("showPopup", rpaction);
connect(rpaction, SIGNAL(triggered(bool)), SLOT(slotPlay()));
......
......@@ -21,7 +21,7 @@
#include "actioncollection.h"
#include "tagtransactionmanager.h"
#include <kaction.h>
#include <QAction>
#include <kactioncollection.h>
#include <kconfiggroup.h>
#include <kcombobox.h>
......@@ -490,7 +490,7 @@ void TagEditor::setupActions()
ActionCollection::actions()->addAction("showEditor", show);
connect(show, SIGNAL(toggled(bool)), this, SLOT(setVisible(bool)));
KAction *act = new KAction(QIcon::fromTheme(QLatin1String( "document-save")), i18n("&Save"), this);
QAction *act = new QAction(QIcon::fromTheme(QLatin1String( "document-save")), i18n("&Save"), this);
ActionCollection::actions()->addAction("saveItem", act);
act->setShortcut(Qt::CTRL + Qt::Key_T);
connect(act, SIGNAL(triggered(bool)), SLOT(slotSave()));
......
......@@ -19,7 +19,7 @@
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kaction.h>
#include <QAction>
#include <kapplication.h>
#include <QFileInfo>
......
......@@ -16,7 +16,7 @@
#include "tracksequenceiterator.h"
#include <kaction.h>
#include <QAction>
#include <kapplication.h>
#include <kdebug.h>
#include <krandom.h>
......@@ -77,7 +77,7 @@ void DefaultSequenceIterator::advance()
return;
bool isRandom = action("randomPlay") && action<KToggleAction>("randomPlay")->isChecked();
bool loop = action<KAction>("loopPlaylist") && action<KAction>("loopPlaylist")->isChecked();
bool loop = action<QAction>("loopPlaylist") && action<QAction>("loopPlaylist")->isChecked();
bool albumRandom = action("albumRandomPlay") && action<KToggleAction>("albumRandomPlay")->isChecked();
if(isRandom || albumRandom) {
......
......@@ -16,7 +16,7 @@
#include <kconfig.h>
#include <klocale.h>
#include <kaction.h>
#include <QAction>
#include <kmenu.h>
#include "actioncollection.h"
......
......@@ -19,7 +19,7 @@
#include <kdebug.h>
#include <kapplication.h>
#include <kaction.h>
#include <QAction>
#include "playlistitem.h"
#include "playlistcollection.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment