Commit 4160ae25 authored by David Faure's avatar David Faure

Ported to kaction/ktoggleaction api changes

svn path=/trunk/KDE/kdemultimedia/juk/; revision=621745
parent 0a7ec667
......@@ -152,7 +152,8 @@ void JuK::setupActions()
// ### KDE4: Investigate how QActionGroups integrate into menus now.
QActionGroup* randomPlayGroup = new QActionGroup(this);
KAction *act = new KToggleAction(KIcon("player_playlist"), i18n("&Disable Random Play"), collection, "disableRandomPlay");
QAction *act = new KToggleAction(KIcon("player_playlist"), i18n("&Disable Random Play"), collection);
collection->addAction("disableRandomPlay", act);
act->setActionGroup(randomPlayGroup);
actionMenu->addAction(act);
......@@ -163,7 +164,8 @@ void JuK::setupActions()
m_randomPlayAction->setActionGroup(randomPlayGroup);
actionMenu->addAction(m_randomPlayAction);
act = new KToggleAction(KIcon("roll"), i18n("Use &Album Random Play"), collection, "albumRandomPlay");
act = new KToggleAction(KIcon("roll"), i18n("Use &Album Random Play"), collection);
collection->addAction("albumRandomPlay", act);
act->setActionGroup(randomPlayGroup);
connect(act, SIGNAL(triggered(bool)), SLOT(slotCheckAlbumNextAction(bool)));
actionMenu->addAction(act);
......@@ -174,88 +176,100 @@ void JuK::setupActions()
connect(act, SIGNAL(triggered(bool)), clear, SLOT(clear()));
act = new KAction(KIcon("player_play"), i18n("&Play"), collection, "play");
act = new KAction(KIcon("player_play"), i18n("&Play"), collection);
collection->addAction("play", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(play()));
act = new KAction(KIcon("player_pause"), i18n("P&ause"), collection, "pause");
act = new KAction(KIcon("player_pause"), i18n("P&ause"), collection);
collection->addAction("pause", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(pause()));
act = new KAction(KIcon("player_stop"), i18n("&Stop"), collection, "stop");
act = new KAction(KIcon("player_stop"), i18n("&Stop"), collection);
collection->addAction("stop", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(stop()));
act = new KToolBarPopupAction(KIcon("player_start"), i18nc("previous track", "Previous"), collection, "back");
act = new KToolBarPopupAction(KIcon("player_start"), i18nc("previous track", "Previous"), collection);
collection->addAction("back", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(back()));
act = new KAction(KIcon("player_end"), i18nc("next track", "&Next"), collection, "forward");
act = new KAction(KIcon("player_end"), i18nc("next track", "&Next"), collection);
collection->addAction("forward", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(forward()));
act = new KAction(i18n("&Loop Playlist"), collection, "loopPlaylist");
act = new KAction(i18n("&Loop Playlist"), collection);
collection->addAction("loopPlaylist", act);
act->setCheckable(true);
KToggleAction *resizeColumnAction =
new KToggleAction(i18n("&Resize Playlist Columns Manually"),
collection, "resizeColumnsManually");
collection);
collection->addAction("resizeColumnsManually", resizeColumnAction);
resizeColumnAction->setCheckedState(KGuiItem(i18n("&Resize Column Headers Automatically")));
// the following are not visible by default
act = new KAction(KIcon("mute"), i18n("Mute"), collection, "mute");
act = new KAction(KIcon("mute"), i18n("Mute"), collection);
collection->addAction("mute", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(mute()));
act = new KAction(KIcon("volumeUp"), i18n("Volume Up"), collection, "volumeUp");
act = new KAction(KIcon("volumeUp"), i18n("Volume Up"), collection);
collection->addAction("volumeUp", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(volumeUp()));
act = new KAction(KIcon("volumeDown"), i18n("Volume Down"), collection, "volumeDown");
act = new KAction(KIcon("volumeDown"), i18n("Volume Down"), collection);
collection->addAction("volumeDown", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(volumeDown()));
act = new KAction(KIcon("playPause"), i18n("Play / Pause"), collection, "playPause");
act = new KAction(KIcon("playPause"), i18n("Play / Pause"), collection);
collection->addAction("playPause", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(playPause()));
act = new KAction(KIcon("seekForward"), i18n("Seek Forward"), collection, "seekForward");
act = new KAction(KIcon("seekForward"), i18n("Seek Forward"), collection);
collection->addAction("seekForward", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(seekForward()));
act = new KAction(KIcon("seekBack"), i18n("Seek Back"), collection, "seekBack");
act = new KAction(KIcon("seekBack"), i18n("Seek Back"), collection);
collection->addAction("seekBack", act);
connect(act, SIGNAL(triggered(bool)), m_player, SLOT(seekBack()));
act = new KAction(i18n("Show / Hide"), collection, "showHide");
act = new KAction(i18n("Show / Hide"), collection);
collection->addAction("showHide", act);
connect(act, SIGNAL(triggered(bool)), this, SLOT(slotShowHide()));
//////////////////////////////////////////////////
// settings menu
//////////////////////////////////////////////////
m_toggleSplashAction =
new KToggleAction(i18n("Show Splash Screen on Startup"),
collection, "showSplashScreen");
m_toggleSplashAction = new KToggleAction(i18n("Show Splash Screen on Startup"), collection);
collection->addAction("showSplashScreen", m_toggleSplashAction);
m_toggleSplashAction->setCheckedState(KGuiItem(i18n("Hide Splash Screen on Startup")));
m_toggleSystemTrayAction =
new KToggleAction(i18n("&Dock in System Tray"),
collection, "toggleSystemTray");
m_toggleDockOnCloseAction =
new KToggleAction(i18n("&Stay in System Tray on Close"),
collection, "dockOnClose");
m_togglePopupsAction =
new KToggleAction(i18n("Popup &Track Announcement"),
collection, "togglePopups");
new KToggleAction(i18n("Save &Play Queue on Exit"),
collection, "saveUpcomingTracks");
m_toggleSystemTrayAction = new KToggleAction(i18n("&Dock in System Tray"), collection);
collection->addAction("toggleSystemTray", m_toggleSystemTrayAction);
m_toggleDockOnCloseAction = new KToggleAction(i18n("&Stay in System Tray on Close"), collection);
collection->addAction("dockOnClose", m_toggleDockOnCloseAction);
m_togglePopupsAction = new KToggleAction(i18n("Popup &Track Announcement"), collection);
collection->addAction("togglePopups", m_togglePopupsAction);
act = new KToggleAction(i18n("Save &Play Queue on Exit"), collection);
collection->addAction("saveUpcomingTracks", act);
connect(m_toggleSystemTrayAction, SIGNAL(toggled(bool)),
this, SLOT(slotToggleSystemTray(bool)));
act = new KAction(i18n("&Tag Guesser..."), collection, "tagGuesserConfig");
act = new KAction(i18n("&Tag Guesser..."), collection);
collection->addAction("tagGuesserConfig", act);
connect(act, SIGNAL(triggered(bool)), SLOT(slotConfigureTagGuesser()));
act = new KAction(i18n("&File Renamer..."), collection, "fileRenamerConfig");
act = new KAction(i18n("&File Renamer..."), collection);
collection->addAction("fileRenamerConfig", act);
connect(act, SIGNAL(triggered(bool)), SLOT(slotConfigureFileRenamer()));
//////////////////////////////////////////////////
// just in the toolbar
//////////////////////////////////////////////////
m_sliderAction = new SliderAction(i18n("Track Position"), collection,
"trackPositionAction");
m_sliderAction = new SliderAction(i18n("Track Position"), this);
collection->addAction("trackPositionAction", m_sliderAction);
}
void JuK::setupSystemTray()
......
......@@ -49,12 +49,11 @@ PlaylistAction *K3bExporter::m_action = 0;
class PlaylistAction : public KAction
{
public:
PlaylistAction(const char *name,
const QString &userText,
PlaylistAction(const QString &userText,
const QIcon &pix,
const char *slot,
const KShortcut &cut = KShortcut()) :
KAction(userText, actions(), name),
KAction(userText, actions()),
m_slot(slot)
{
setShortcut(cut);
......@@ -107,7 +106,6 @@ KAction *K3bExporter::action()
{
if(!m_action && !KStandardDirs::findExe("k3b").isNull()) {
m_action = new PlaylistAction(
"export_to_k3b",
i18n("Add Selected Items to Audio or Data CD"),
SmallIconSet("k3b"),
SLOT(slotExport())
......@@ -278,8 +276,7 @@ KAction *K3bPlaylistExporter::action()
if(!KStandardDirs::findExe("k3b").isNull()) {
KAction *action = new KAction(KIcon("k3b"),
i18n("Add Playlist to Audio or Data CD"),
actions(),
"export_playlist_to_k3b"
actions()
);
connect(action, SIGNAL(triggered(bool)), SLOT(slotExport()));
return action;
......
......@@ -79,6 +79,7 @@
#include "coverdialog.h"
#include "tagtransactionmanager.h"
#include "cache.h"
#include <kactioncollection.h>
using namespace ActionCollection;
......@@ -1557,7 +1558,8 @@ void Playlist::polish()
// setup header RMB menu
//////////////////////////////////////////////////
m_columnVisibleAction = new KActionMenu(i18n("&Show Columns"), ActionCollection::actions(), "showColumns");
m_columnVisibleAction = new KActionMenu(i18n("&Show Columns"), this);
ActionCollection::actions()->addAction("showColumns", m_columnVisibleAction);
m_headerMenu = m_columnVisibleAction->menu();
......@@ -2077,7 +2079,6 @@ void Playlist::slotShowRMBMenu(Q3ListViewItem *item, const QPoint &point, int co
if(!m_rmbMenu) {
// A bit of a hack to get a pointer to the action collection.
// Probably more of these actions should be ported over to using KActions.
m_rmbMenu = new KMenu(this);
......
......@@ -19,6 +19,7 @@
#include <kmessagebox.h>
#include <kmenu.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <kdebug.h>
#include <ktoggleaction.h>
#include <kselectaction.h>
......@@ -101,7 +102,8 @@ PlaylistBox::PlaylistBox(QWidget *parent, Q3WidgetStack *playlistStack) :
// add the view modes stuff
KSelectAction *viewModeAction =
new KSelectAction( KIcon("view_choose"), i18n("View Modes"), ActionCollection::actions(), "viewModeMenu");
new KSelectAction( KIcon("view_choose"), i18n("View Modes"), ActionCollection::actions());
ActionCollection::actions()->addAction("viewModeMenu", viewModeAction);
m_viewModes.append(new ViewMode(this));
m_viewModes.append(new CompactViewMode(this));
......
......@@ -50,9 +50,10 @@
#include <QtDBus>
#include <kaction.h>
#include "collectionadaptor.h"
#include <kactioncollection.h>
#include <ktoggleaction.h>
#include <kactionmenu.h>
#include "collectionadaptor.h"
#define widget (kapp->mainWidget())
......@@ -851,7 +852,8 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
// "New" menu
menu = new KActionMenu(KIcon("filenew"), i18n("&New"), actions(), "file_new");
menu = new KActionMenu(KIcon("filenew"), i18n("&New"), actions());
actions()->addAction("file_new", menu);
menu->addAction(createAction(i18n("&Empty Playlist..."), SLOT(slotCreatePlaylist()),
"newPlaylist", "window_new", KShortcut(Qt::CTRL + Qt::Key_N)));
......@@ -863,7 +865,9 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
// Guess tag info menu
#ifdef HAVE_TUNEPIMP
menu = new KActionMenu(i18n("&Guess Tag Information"), actions(), "guessTag");
menu = new KActionMenu(i18n("&Guess Tag Information"), actions());
actions()->addAction("guessTag", menu);
/* menu->setIconSet(SmallIconSet("wizard")); */
menu->addAction(createAction(i18n("From &File Name"), SLOT(slotGuessTagFromFile()),
......@@ -893,7 +897,8 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
createAction(i18n("Refresh"), SLOT(slotRefreshItems()), "refresh", "reload");
createAction(i18n("&Rename File"), SLOT(slotRenameItems()), "renameFile", "filesaveas", KShortcut(Qt::CTRL + Qt::Key_R));
menu = new KActionMenu(i18n("Cover Manager"), actions(), "coverManager");
menu = new KActionMenu(i18n("Cover Manager"), actions());
actions()->addAction("coverManager", menu);
/* menu->setIconSet(SmallIconSet("image")); */
menu->addAction(createAction(i18n("&View Cover"),
SLOT(slotViewCovers()), "viewCover", "viewmag"));
......@@ -907,16 +912,18 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
SLOT(slotShowCoverManager()), "showCoverManager"));
KToggleAction *historyAction =
new KToggleAction(KIcon("history"), i18n("Show &History"), actions(), "showHistory");
new KToggleAction(KIcon("history"), i18n("Show &History"), actions());
actions()->addAction("showHistory", historyAction);
historyAction->setCheckedState(KGuiItem(i18n("Hide &History")));
KToggleAction *upcomingAction =
new KToggleAction(KIcon("today"), i18n("Show &Play Queue"), actions(), "showUpcoming");
new KToggleAction(KIcon("today"), i18n("Show &Play Queue"), actions());
actions()->addAction("showUpcoming", upcomingAction);
upcomingAction->setCheckedState(KGuiItem(i18n("Hide &Play Queue")));
connect(action<KToggleAction>("showHistory"), SIGNAL(toggled(bool)),
connect(historyAction, SIGNAL(toggled(bool)),
this, SLOT(slotSetHistoryPlaylistEnabled(bool)));
connect(action<KToggleAction>("showUpcoming"), SIGNAL(toggled(bool)),
connect(upcomingAction, SIGNAL(toggled(bool)),
this, SLOT(slotSetUpcomingPlaylistEnabled(bool)));
}
......@@ -928,9 +935,10 @@ KAction *PlaylistCollection::ActionHandler::createAction(const QString &text,
{
KAction *action;
if(icon.isNull())
action = new KAction(text, actions(), name);
action = new KAction(text, actions());
else
action = new KAction(KIcon(icon), text, actions(), name);
action = new KAction(KIcon(icon), text, actions());
actions()->addAction(name, action);
connect( action, SIGNAL(triggered(bool)), slot);
action->setShortcut(shortcut);
return action;
......
......@@ -16,6 +16,7 @@
#include <kicon.h>
#include <kaction.h>
#include <kglobal.h>
#include <kactioncollection.h>
#include <kdebug.h>
#include <ktoggleaction.h>
......@@ -123,11 +124,15 @@ Playlist *PlaylistSplitter::visiblePlaylist() const
void PlaylistSplitter::setupActions()
{
KActionCollection* coll = ActionCollection::actions();
KToggleAction *showSearch =
new KToggleAction(KIcon("filefind"), i18n("Show &Search Bar"), ActionCollection::actions(), "showSearch");
new KToggleAction(KIcon("filefind"), i18n("Show &Search Bar"), this);
coll->addAction("showSearch", showSearch);
showSearch->setCheckedState(KGuiItem(i18n("Hide &Search Bar")));
KAction *act = new KAction(KIcon("edit_clear"), i18n("Edit Track Search"), ActionCollection::actions(), "editTrackSearch");
KAction *act = new KAction(KIcon("edit_clear"), i18n("Edit Track Search"), this);
coll->addAction("editTrackSearch", act);
act->setShortcut(Qt::Key_F6);
connect(act, SIGNAL(triggered(bool)), SLOT(setFocus()));
}
......
......@@ -30,6 +30,7 @@
#include <QBoxLayout>
#include "slideraction.h"
#include <kactioncollection.h>
////////////////////////////////////////////////////////////////////////////////
// convenience class
......@@ -132,8 +133,8 @@ void VolumeSlider::slotValueChanged(int value)
const int SliderAction::minPosition = 0;
const int SliderAction::maxPosition = 1000;
SliderAction::SliderAction(const QString &text, KActionCollection* collection, const char *name)
: KAction(text, collection, name),
SliderAction::SliderAction(const QString &text, QObject* parent)
: KAction(text, parent),
m_toolBar(0),
m_widget(0),
m_layout(0),
......
......@@ -23,6 +23,7 @@
#include <QFocusEvent>
#include <QBoxLayout>
#include <ktoolbar.h>
class KActionCollection;
class QBoxLayout;
class Q3DockWindow;
......@@ -54,7 +55,7 @@ class SliderAction : public KAction
Q_OBJECT
public:
SliderAction(const QString &text, KActionCollection* collection, const char *name);
SliderAction(const QString &text, QObject* parent);
virtual ~SliderAction();
VolumeSlider *volumeSlider() const { return m_volumeSlider; }
......
......@@ -54,6 +54,7 @@
#include "playermanager.h"
#include "collectionlist.h"
#include "coverinfo.h"
#include <kactioncollection.h>
using namespace ActionCollection;
......@@ -176,7 +177,8 @@ SystemTray::SystemTray(QWidget *parent) : KSystemTrayIcon(parent),
// Just create this here so that it show up in the DCOP interface and the key
// bindings dialog.
KAction *rpaction = new KAction(i18n("Redisplay Popup"), ActionCollection::actions(), "showPopup");
KAction *rpaction = new KAction(i18n("Redisplay Popup"), this);
ActionCollection::actions()->addAction("showPopup", rpaction);
connect(rpaction, SIGNAL(triggered(bool) ), SLOT(slotPlay()));
QMenu *cm = contextMenu();
......@@ -195,7 +197,8 @@ SystemTray::SystemTray(QWidget *parent) : KSystemTrayIcon(parent),
// Pity the actionCollection doesn't keep track of what sub-menus it has.
KActionMenu *menu = new KActionMenu(i18n("&Random Play"), actionCollection(), "randomplay");
KActionMenu *menu = new KActionMenu(i18n("&Random Play"), this);
actionCollection()->addAction("randomplay", menu);
menu->addAction(action("disableRandomPlay"));
menu->addAction(action("randomPlay"));
menu->addAction(action("albumRandomPlay"));
......
......@@ -51,6 +51,7 @@
#include <ktoggleaction.h>
#include <id3v1genres.h>
#include <kactioncollection.h>
#undef KeyRelease
......@@ -58,7 +59,7 @@ class FileNameValidator : public QValidator
{
public:
FileNameValidator(QObject *parent, const char *name = 0) :
QValidator(parent)
QValidator(parent)
{
setObjectName(name);
}
......@@ -493,11 +494,13 @@ void TagEditor::saveConfig()
void TagEditor::setupActions()
{
KToggleAction *show = new KToggleAction(KIcon("edit"), i18n("Show &Tag Editor"), ActionCollection::actions(), "showEditor");
KToggleAction *show = new KToggleAction(KIcon("edit"), i18n("Show &Tag Editor"), this);
ActionCollection::actions()->addAction("showEditor", show);
show->setCheckedState(KGuiItem(i18n("Hide &Tag Editor")));
connect(show, SIGNAL(toggled(bool)), this, SLOT(setShown(bool)));
KAction *act = new KAction(KIcon("filesave"), i18n("&Save"), ActionCollection::actions(), "saveItem");
KAction *act = new KAction(KIcon("filesave"), i18n("&Save"), this);
ActionCollection::actions()->addAction("saveItem", act);
act->setShortcut(Qt::CTRL + Qt::Key_T);
connect(act, SIGNAL(triggered(bool)), SLOT(slotSave()));
}
......
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