Commit 6fcead44 authored by David Faure's avatar David Faure

Some Qt4/KDE4 porting.

Does nobody care about juk anymore, that I have to port it regularly so that kdemultimedia compiles?
CCMAIL: kde-multimedia@kde.org

SliderAction remains to be ported (by providing a QActionWidgetFactory-derived class, apparently).

svn path=/trunk/KDE/kdemultimedia/juk/; revision=526141
parent 14c5a5bb
...@@ -3,7 +3,7 @@ project(juk) ...@@ -3,7 +3,7 @@ project(juk)
add_subdirectory( pics ) add_subdirectory( pics )
include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( ${KDE4_INCLUDE_DIR}/taglib ${KDE4_INCLUDES} )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
########### next target ############### ########### next target ###############
......
...@@ -23,7 +23,8 @@ namespace ActionCollection ...@@ -23,7 +23,8 @@ namespace ActionCollection
KActionCollection *actions() KActionCollection *actions()
{ {
static KActionCollection *a = static KActionCollection *a =
new KActionCollection(static_cast<QWidget *>(0)); new KActionCollection(static_cast<QObject *>(0));
// The widget of the action collection is set in Juk::setupActions().
return a; return a;
} }
......
...@@ -56,12 +56,12 @@ void DeleteWidget::slotShouldDelete(bool shouldDelete) ...@@ -56,12 +56,12 @@ void DeleteWidget::slotShouldDelete(bool shouldDelete)
ddDeleteText->setText(i18n("<qt>These items will be <b>permanently " ddDeleteText->setText(i18n("<qt>These items will be <b>permanently "
"deleted</b> from your hard disk.</qt>")); "deleted</b> from your hard disk.</qt>"));
ddWarningIcon->setPixmap(KGlobal::iconLoader()->loadIcon("messagebox_warning", ddWarningIcon->setPixmap(KGlobal::iconLoader()->loadIcon("messagebox_warning",
KIcon::Desktop, KIcon::SizeLarge)); K3Icon::Desktop, K3Icon::SizeLarge));
} }
else { else {
ddDeleteText->setText(i18n("<qt>These items will be moved to the Trash Bin.</qt>")); ddDeleteText->setText(i18n("<qt>These items will be moved to the Trash Bin.</qt>"));
ddWarningIcon->setPixmap(KGlobal::iconLoader()->loadIcon("trashcan_full", ddWarningIcon->setPixmap(KGlobal::iconLoader()->loadIcon("trashcan_full",
KIcon::Desktop, KIcon::SizeLarge)); K3Icon::Desktop, K3Icon::SizeLarge));
} }
} }
......
...@@ -112,7 +112,7 @@ void JuK::setupLayout() ...@@ -112,7 +112,7 @@ void JuK::setupLayout()
void JuK::setupActions() void JuK::setupActions()
{ {
ActionCollection::actions()->setWidget(this); ActionCollection::actions()->setAssociatedWidget(this);
KStdAction::quit(this, SLOT(slotQuit()), ActionCollection::actions()); KStdAction::quit(this, SLOT(slotQuit()), ActionCollection::actions());
KStdAction::undo(this, SLOT(slotUndo()), ActionCollection::actions()); KStdAction::undo(this, SLOT(slotUndo()), ActionCollection::actions());
...@@ -124,19 +124,21 @@ void JuK::setupActions() ...@@ -124,19 +124,21 @@ void JuK::setupActions()
new KAction(i18n("Remove From Playlist"), "edit_remove", 0, kapp, SLOT(clear()), ActionCollection::actions(), "removeFromPlaylist"); new KAction(i18n("Remove From Playlist"), "edit_remove", 0, kapp, SLOT(clear()), ActionCollection::actions(), "removeFromPlaylist");
KActionMenu *actionMenu = new KActionMenu(i18n("&Random Play"), "roll", ActionCollection::actions(), "actionMenu"); KActionMenu *actionMenu = new KActionMenu(KIcon("roll"), i18n("&Random Play"), ActionCollection::actions(), "actionMenu");
actionMenu->setDelayed(false); actionMenu->setDelayed(false);
KRadioAction *ka = new KRadioAction(i18n("&Disable Random Play"), "player_playlist", 0, ActionCollection::actions(), "disableRandomPlay"); QActionGroup* randomPlayGroup = new QActionGroup( this );
ka->setExclusiveGroup("randomPlayGroup");
KAction *ka = new KAction(KIcon("player_playlist"), i18n("&Disable Random Play"), ActionCollection::actions(), "disableRandomPlay");
ka->setActionGroup(randomPlayGroup);
actionMenu->insert(ka); actionMenu->insert(ka);
m_randomPlayAction = new KRadioAction(i18n("Use &Random Play"), "roll", 0, ActionCollection::actions(), "randomPlay"); m_randomPlayAction = new KAction(KIcon("roll"), i18n("Use &Random Play"), ActionCollection::actions(), "randomPlay");
m_randomPlayAction->setExclusiveGroup("randomPlayGroup"); m_randomPlayAction->setActionGroup(randomPlayGroup);
actionMenu->insert(m_randomPlayAction); actionMenu->insert(m_randomPlayAction);
ka = new KRadioAction(i18n("Use &Album Random Play"), "roll", 0, ActionCollection::actions(), "albumRandomPlay"); ka = new KAction(i18n("Use &Album Random Play"), "roll", ActionCollection::actions(), "albumRandomPlay");
ka->setExclusiveGroup("randomPlayGroup"); ka->setActionGroup(randomPlayGroup);
connect(ka, SIGNAL(toggled(bool)), SLOT(slotCheckAlbumNextAction(bool))); connect(ka, SIGNAL(toggled(bool)), SLOT(slotCheckAlbumNextAction(bool)));
actionMenu->insert(ka); actionMenu->insert(ka);
...@@ -229,18 +231,18 @@ void JuK::setupGlobalAccels() ...@@ -229,18 +231,18 @@ void JuK::setupGlobalAccels()
{ {
m_accel = new KGlobalAccel(this); m_accel = new KGlobalAccel(this);
KeyDialog::insert(m_accel, "Play", i18n("Play"), action("play"), SLOT(activate())); KeyDialog::insert(m_accel, "Play", i18n("Play"), action("play"), SLOT(trigger()));
KeyDialog::insert(m_accel, "PlayPause", i18n("Play / Pause"), action("playPause"), SLOT(activate())); KeyDialog::insert(m_accel, "PlayPause", i18n("Play / Pause"), action("playPause"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Stop", i18n("Stop Playing"), action("stop"), SLOT(activate())); KeyDialog::insert(m_accel, "Stop", i18n("Stop Playing"), action("stop"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Back", i18n("Back"), action("back"), SLOT(activate())); KeyDialog::insert(m_accel, "Back", i18n("Back"), action("back"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Forward", i18n("Forward"), action("forward"), SLOT(activate())); KeyDialog::insert(m_accel, "Forward", i18n("Forward"), action("forward"), SLOT(trigger()));
KeyDialog::insert(m_accel, "SeekBack", i18n("Seek Back"), action("seekBack"), SLOT(activate())); KeyDialog::insert(m_accel, "SeekBack", i18n("Seek Back"), action("seekBack"), SLOT(trigger()));
KeyDialog::insert(m_accel, "SeekForward", i18n("Seek Forward"), action("seekForward"), SLOT(activate())); KeyDialog::insert(m_accel, "SeekForward", i18n("Seek Forward"), action("seekForward"), SLOT(trigger()));
KeyDialog::insert(m_accel, "VolumeUp", i18n("Volume Up"), action("volumeUp"), SLOT(activate())); KeyDialog::insert(m_accel, "VolumeUp", i18n("Volume Up"), action("volumeUp"), SLOT(trigger()));
KeyDialog::insert(m_accel, "VolumeDown", i18n("Volume Down"), action("volumeDown"), SLOT(activate())); KeyDialog::insert(m_accel, "VolumeDown", i18n("Volume Down"), action("volumeDown"), SLOT(trigger()));
KeyDialog::insert(m_accel, "Mute", i18n("Mute"), action("mute"), SLOT(activate())); KeyDialog::insert(m_accel, "Mute", i18n("Mute"), action("mute"), SLOT(trigger()));
KeyDialog::insert(m_accel, "ShowHide", i18n("Show / Hide"), this, SLOT(slotShowHide())); KeyDialog::insert(m_accel, "ShowHide", i18n("Show / Hide"), this, SLOT(slotShowHide()));
KeyDialog::insert(m_accel, "ForwardAlbum", i18n("Play Next Album"), action("forwardAlbum"), SLOT(activate())); KeyDialog::insert(m_accel, "ForwardAlbum", i18n("Play Next Album"), action("forwardAlbum"), SLOT(trigger()));
m_accel->setConfigGroup("Shortcuts"); m_accel->setConfigGroup("Shortcuts");
m_accel->readSettings(); m_accel->readSettings();
...@@ -379,7 +381,7 @@ bool JuK::queryExit() ...@@ -379,7 +381,7 @@ bool JuK::queryExit()
hide(); hide();
action("stop")->activate(); action("stop")->trigger();
delete m_systemTray; delete m_systemTray;
m_systemTray = 0; m_systemTray = 0;
......
...@@ -83,7 +83,7 @@ private: ...@@ -83,7 +83,7 @@ private:
SystemTray *m_systemTray; SystemTray *m_systemTray;
SliderAction *m_sliderAction; SliderAction *m_sliderAction;
KToggleAction *m_randomPlayAction; KAction *m_randomPlayAction;
KToggleAction *m_toggleSystemTrayAction; KToggleAction *m_toggleSystemTrayAction;
KToggleAction *m_toggleDockOnCloseAction; KToggleAction *m_toggleDockOnCloseAction;
KToggleAction *m_togglePopupsAction; KToggleAction *m_togglePopupsAction;
......
...@@ -244,7 +244,7 @@ void PlayerManager::setStatusLabel(StatusLabel *label) ...@@ -244,7 +244,7 @@ void PlayerManager::setStatusLabel(StatusLabel *label)
KSelectAction *PlayerManager::playerSelectAction() // static KSelectAction *PlayerManager::playerSelectAction() // static
{ {
KSelectAction *action = KSelectAction *action =
new KSelectAction(i18n("&Output To"), 0, ActionCollection::actions(), "outputSelect"); new KSelectAction(i18n("&Output To"), ActionCollection::actions(), "outputSelect");
QStringList l; QStringList l;
#if HAVE_ARTS #if HAVE_ARTS
...@@ -420,7 +420,7 @@ void PlayerManager::seekBack() ...@@ -420,7 +420,7 @@ void PlayerManager::seekBack()
void PlayerManager::playPause() void PlayerManager::playPause()
{ {
playing() ? action("pause")->activate() : action("play")->activate(); playing() ? action("pause")->trigger() : action("play")->trigger();
} }
void PlayerManager::forward() void PlayerManager::forward()
......
...@@ -483,7 +483,7 @@ void Playlist::playFirst() ...@@ -483,7 +483,7 @@ void Playlist::playFirst()
{ {
TrackSequenceManager::instance()->setNextItem(static_cast<PlaylistItem *>( TrackSequenceManager::instance()->setNextItem(static_cast<PlaylistItem *>(
Q3ListViewItemIterator(const_cast<Playlist *>(this), Q3ListViewItemIterator::Visible).current())); Q3ListViewItemIterator(const_cast<Playlist *>(this), Q3ListViewItemIterator::Visible).current()));
action("forward")->activate(); action("forward")->trigger();
} }
void Playlist::playNextAlbum() void Playlist::playNextAlbum()
...@@ -499,7 +499,7 @@ void Playlist::playNextAlbum() ...@@ -499,7 +499,7 @@ void Playlist::playNextAlbum()
current = TrackSequenceManager::instance()->nextItem(); current = TrackSequenceManager::instance()->nextItem();
TrackSequenceManager::instance()->setNextItem(current); TrackSequenceManager::instance()->setNextItem(current);
action("forward")->activate(); action("forward")->trigger();
} }
void Playlist::playNext() void Playlist::playNext()
...@@ -993,7 +993,7 @@ void Playlist::removeFromDisk(const PlaylistItemList &items) ...@@ -993,7 +993,7 @@ void Playlist::removeFromDisk(const PlaylistItemList &items)
for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it) { for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it) {
if(playingItem() == *it) if(playingItem() == *it)
action("forward")->activate(); action("forward")->trigger();
QString removePath = (*it)->file().absFilePath(); QString removePath = (*it)->file().absFilePath();
if((!shouldDelete && KIO::NetAccess::synchronousRun(KIO::trash(removePath), this)) || if((!shouldDelete && KIO::NetAccess::synchronousRun(KIO::trash(removePath), this)) ||
...@@ -1646,7 +1646,7 @@ void Playlist::slotPlayFromBackMenu(int number) const ...@@ -1646,7 +1646,7 @@ void Playlist::slotPlayFromBackMenu(int number) const
return; return;
TrackSequenceManager::instance()->setNextItem(m_backMenuItems[number]); TrackSequenceManager::instance()->setNextItem(m_backMenuItems[number]);
action("forward")->activate(); action("forward")->trigger();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -2323,7 +2323,7 @@ void Playlist::slotPlayCurrent() ...@@ -2323,7 +2323,7 @@ void Playlist::slotPlayCurrent()
Q3ListViewItemIterator it(this, Q3ListViewItemIterator::Selected); Q3ListViewItemIterator it(this, Q3ListViewItemIterator::Selected);
PlaylistItem *next = static_cast<PlaylistItem *>(it.current()); PlaylistItem *next = static_cast<PlaylistItem *>(it.current());
TrackSequenceManager::instance()->setNextItem(next); TrackSequenceManager::instance()->setNextItem(next);
action("forward")->activate(); action("forward")->trigger();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
...@@ -112,10 +112,15 @@ PlaylistBox::PlaylistBox(QWidget *parent, Q3WidgetStack *playlistStack) : ...@@ -112,10 +112,15 @@ PlaylistBox::PlaylistBox(QWidget *parent, Q3WidgetStack *playlistStack) :
viewModeAction->setItems(modeNames); viewModeAction->setItems(modeNames);
#ifdef __GNUC__
#warning This needs to be ported to proper QActions
#endif
#if 0
QMenu *p = viewModeAction->popupMenu(); QMenu *p = viewModeAction->popupMenu();
p->changeItem(0, SmallIconSet("view_detailed"), modeNames[0]); p->changeItem(0, SmallIconSet("view_detailed"), modeNames[0]);
p->changeItem(1, SmallIconSet("view_text"), modeNames[1]); p->changeItem(1, SmallIconSet("view_text"), modeNames[1]);
p->changeItem(2, SmallIconSet("view_tree"), modeNames[2]); p->changeItem(2, SmallIconSet("view_tree"), modeNames[2]);
#endif
CollectionList::initialize(this); CollectionList::initialize(this);
Cache::loadPlaylists(this); Cache::loadPlaylists(this);
...@@ -647,8 +652,8 @@ void PlaylistBox::slotPlaylistChanged() ...@@ -647,8 +652,8 @@ void PlaylistBox::slotPlaylistChanged()
void PlaylistBox::slotDoubleClicked() void PlaylistBox::slotDoubleClicked()
{ {
action("stop")->activate(); action("stop")->trigger();
action("play")->activate(); action("play")->trigger();
} }
void PlaylistBox::slotShowContextMenu(Q3ListViewItem *, const QPoint &point, int) void PlaylistBox::slotShowContextMenu(Q3ListViewItem *, const QPoint &point, int)
......
...@@ -838,7 +838,7 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection) ...@@ -838,7 +838,7 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
// "New" menu // "New" menu
menu = new KActionMenu(i18n("&New"), "filenew", actions(), "file_new"); menu = new KActionMenu(KIcon("filenew"), i18n("&New"), actions(), "file_new");
menu->insert(createAction(i18n("&Empty Playlist..."), SLOT(slotCreatePlaylist()), menu->insert(createAction(i18n("&Empty Playlist..."), SLOT(slotCreatePlaylist()),
"newPlaylist", "window_new", "CTRL+n")); "newPlaylist", "window_new", "CTRL+n"));
...@@ -880,7 +880,7 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection) ...@@ -880,7 +880,7 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection)
createAction(i18n("Refresh"), SLOT(slotRefreshItems()), "refresh", "reload"); createAction(i18n("Refresh"), SLOT(slotRefreshItems()), "refresh", "reload");
createAction(i18n("&Rename File"), SLOT(slotRenameItems()), "renameFile", "filesaveas", "CTRL+r"); createAction(i18n("&Rename File"), SLOT(slotRenameItems()), "renameFile", "filesaveas", "CTRL+r");
menu = new KActionMenu(i18n("Cover Manager"), QString::null, actions(), "coverManager"); menu = new KActionMenu(i18n("Cover Manager"), actions(), "coverManager");
/* menu->setIconSet(SmallIconSet("image")); */ /* menu->setIconSet(SmallIconSet("image")); */
menu->insert(createAction(i18n("&View Cover"), menu->insert(createAction(i18n("&View Cover"),
SLOT(slotViewCovers()), "viewCover", "viewmag")); SLOT(slotViewCovers()), "viewCover", "viewmag"));
......
...@@ -154,8 +154,8 @@ bool SearchLine::eventFilter(QObject *watched, QEvent *e) ...@@ -154,8 +154,8 @@ bool SearchLine::eventFilter(QObject *watched, QEvent *e)
void SearchLine::slotActivate() void SearchLine::slotActivate()
{ {
action("stop")->activate(); action("stop")->trigger();
action("playFirst")->activate(); action("playFirst")->trigger();
} }
void SearchLine::updateColumns() void SearchLine::updateColumns()
...@@ -267,7 +267,7 @@ void SearchWidget::updateColumns() ...@@ -267,7 +267,7 @@ void SearchWidget::updateColumns()
void SearchWidget::setupLayout() void SearchWidget::setupLayout()
{ {
boxLayout()->setSpacing(5); /// Qt4 porting: disabled this: boxLayout()->setSpacing(5);
QToolButton *clearSearchButton = new QToolButton(this); QToolButton *clearSearchButton = new QToolButton(this);
clearSearchButton->setTextLabel(i18n("Clear Search"), true); clearSearchButton->setTextLabel(i18n("Clear Search"), true);
...@@ -282,7 +282,11 @@ void SearchWidget::setupLayout() ...@@ -282,7 +282,11 @@ void SearchWidget::setupLayout()
connect(m_searchLine, SIGNAL(signalQueryChanged()), this, SIGNAL(signalQueryChanged())); connect(m_searchLine, SIGNAL(signalQueryChanged()), this, SIGNAL(signalQueryChanged()));
connect(m_searchLine, SIGNAL(signalDownPressed()), this, SIGNAL(signalDownPressed())); connect(m_searchLine, SIGNAL(signalDownPressed()), this, SIGNAL(signalDownPressed()));
connect(clearSearchButton, SIGNAL(pressed()), m_searchLine, SLOT(clear())); connect(clearSearchButton, SIGNAL(pressed()), m_searchLine, SLOT(clear()));
setStretchableWidget(m_searchLine);
#ifdef __GNUC__
#warning TODO Find replacement for KToolBar::setStretchableWidget
#endif
//setStretchableWidget(m_searchLine);
// I've decided that I think this is ugly, for now. // I've decided that I think this is ugly, for now.
......
...@@ -91,7 +91,7 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent, const cha ...@@ -91,7 +91,7 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent, const cha
jumpButton->setFlat(true); jumpButton->setFlat(true);
jumpButton->setToolTip( i18n("Jump to the currently playing item")); jumpButton->setToolTip( i18n("Jump to the currently playing item"));
connect(jumpButton, SIGNAL(clicked()), action("showPlaying"), SLOT(activate())); connect(jumpButton, SIGNAL(clicked()), action("showPlaying"), SLOT(trigger()));
installEventFilter(this); installEventFilter(this);
...@@ -190,7 +190,7 @@ bool StatusLabel::eventFilter(QObject *o, QEvent *e) ...@@ -190,7 +190,7 @@ bool StatusLabel::eventFilter(QObject *o, QEvent *e)
updateTime(); updateTime();
} }
else else
action("showPlaying")->activate(); action("showPlaying")->trigger();
return true; return true;
} }
......
...@@ -470,19 +470,19 @@ void SystemTray::createButtonBox(QWidget *parent) ...@@ -470,19 +470,19 @@ void SystemTray::createButtonBox(QWidget *parent)
} }
/** /**
* What happens here is that the action->activate() call will end up invoking * What happens here is that the action->trigger() call will end up invoking
* createPopup(), which sets m_fade to true. Before the text starts fading * createPopup(), which sets m_fade to true. Before the text starts fading
* control returns to this function, which resets m_fade to false. * control returns to this function, which resets m_fade to false.
*/ */
void SystemTray::slotBack() void SystemTray::slotBack()
{ {
action("back")->activate(); action("back")->trigger();
m_fade = false; m_fade = false;
} }
void SystemTray::slotForward() void SystemTray::slotForward()
{ {
action("forward")->activate(); action("forward")->trigger();
m_fade = false; m_fade = false;
} }
...@@ -565,15 +565,15 @@ void SystemTray::wheelEvent(QWheelEvent *e) ...@@ -565,15 +565,15 @@ void SystemTray::wheelEvent(QWheelEvent *e)
switch(e->state()) { switch(e->state()) {
case Qt::ShiftButton: case Qt::ShiftButton:
if(e->delta() > 0) if(e->delta() > 0)
action("volumeUp")->activate(); action("volumeUp")->trigger();
else else
action("volumeDown")->activate(); action("volumeDown")->trigger();
break; break;
default: default:
if(e->delta() > 0) if(e->delta() > 0)
action("forward")->activate(); action("forward")->trigger();
else else
action("back")->activate(); action("back")->trigger();
break; break;
} }
e->accept(); e->accept();
...@@ -594,9 +594,9 @@ void SystemTray::mousePressEvent(QMouseEvent *e) ...@@ -594,9 +594,9 @@ void SystemTray::mousePressEvent(QMouseEvent *e)
if(!rect().contains(e->pos())) if(!rect().contains(e->pos()))
return; return;
if(action("pause")->isEnabled()) if(action("pause")->isEnabled())
action("pause")->activate(); action("pause")->trigger();
else else
action("play")->activate(); action("play")->trigger();
break; break;
} }
} }
......
...@@ -597,7 +597,8 @@ void TagEditor::setupLayout() ...@@ -597,7 +597,8 @@ void TagEditor::setupLayout()
trackRowLayout->setWidth(); trackRowLayout->setWidth();
} }
m_commentBox = new KEdit(this, "commentBox"); m_commentBox = new KEdit(this);
m_commentBox->setObjectName( "commentBox" );
m_commentBox->setTextFormat(Qt::PlainText); m_commentBox->setTextFormat(Qt::PlainText);
addItem(i18n("&Comment:"), m_commentBox, rightColumnLayout, "edit"); addItem(i18n("&Comment:"), m_commentBox, rightColumnLayout, "edit");
fileNameLabel->setMinimumHeight(m_trackSpin->height()); fileNameLabel->setMinimumHeight(m_trackSpin->height());
......
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