Commit 31a60576 authored by David Faure's avatar David Faure

Fixed compilation with Qt4 and current kdelibs snapshot.

svn path=/trunk/KDE/kdemultimedia/juk/; revision=514509
parent 01e1f6a4
......@@ -209,7 +209,8 @@ void JuK::setupActions()
void JuK::setupSystemTray()
{
if(m_toggleSystemTrayAction && m_toggleSystemTrayAction->isChecked()) {
m_systemTray = new SystemTray(this, "systemTray");
m_systemTray = new SystemTray(this);
m_systemTray->setObjectName( "systemTray" );
m_systemTray->show();
m_toggleDockOnCloseAction->setEnabled(true);
......
......@@ -79,6 +79,7 @@ private:
class NowPlayingItem
{
public:
virtual ~NowPlayingItem() {}
virtual void update(const FileHandle &file) = 0;
NowPlaying *parent() const { return m_parent; }
protected:
......
......@@ -20,7 +20,7 @@
#include <qevent.h>
#include <QVBoxLayout>
#include <Q3ValueList>
#include <QList>
#include "playlistsplitter.h"
#include "searchwidget.h"
......@@ -31,8 +31,6 @@
#include "playermanager.h"
#include "nowplaying.h"
using namespace ActionCollection;
////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////
......@@ -121,10 +119,10 @@ Playlist *PlaylistSplitter::visiblePlaylist() const
void PlaylistSplitter::setupActions()
{
KToggleAction *showSearch =
new KToggleAction(i18n("Show &Search Bar"), "filefind", 0, actions(), "showSearch");
new KToggleAction(i18n("Show &Search Bar"), "filefind", 0, ActionCollection::actions(), "showSearch");
showSearch->setCheckedState(i18n("Hide &Search Bar"));
new KAction(i18n("Edit Track Search"), "edit_clear", "F6", this, SLOT(setFocus()), actions(), "editTrackSearch");
new KAction(i18n("Edit Track Search"), "edit_clear", "F6", this, SLOT(setFocus()), ActionCollection::actions(), "editTrackSearch");
}
void PlaylistSplitter::setupLayout()
......@@ -153,7 +151,8 @@ void PlaylistSplitter::setupLayout()
// Create the PlaylistBox
m_playlistBox = new PlaylistBox(this, m_playlistStack, "playlistBox");
m_playlistBox = new PlaylistBox(this, m_playlistStack);
m_playlistStack->setObjectName( "playlistBox" );
connect(m_playlistBox->object(), SIGNAL(signalSelectedItemsChanged()),
this, SLOT(slotPlaylistSelectionChanged()));
......@@ -178,7 +177,7 @@ void PlaylistSplitter::setupLayout()
m_playlistBox->object(), SLOT(slotCreateSearchPlaylist()));
connect(m_searchWidget, SIGNAL(signalShown(bool)),
m_playlistBox->object(), SLOT(slotSetSearchEnabled(bool)));
connect(action<KToggleAction>("showSearch"), SIGNAL(toggled(bool)),
connect(ActionCollection::action<KToggleAction>("showSearch"), SIGNAL(toggled(bool)),
m_searchWidget, SLOT(setEnabled(bool)));
topLayout->addWidget(nowPlaying);
......@@ -193,7 +192,7 @@ void PlaylistSplitter::readConfig()
{
KConfigGroup config(KGlobal::config(), "Splitter");
Q3ValueList<int> splitterSizes = config.readEntry("PlaylistSplitterSizes");
QList<int> splitterSizes = config.readEntry("PlaylistSplitterSizes",QList<int>());
if(splitterSizes.isEmpty()) {
splitterSizes.append(100);
splitterSizes.append(640);
......@@ -201,7 +200,7 @@ void PlaylistSplitter::readConfig()
setSizes(splitterSizes);
bool showSearch = config.readEntry("ShowSearch", true);
action<KToggleAction>("showSearch")->setChecked(showSearch);
ActionCollection::action<KToggleAction>("showSearch")->setChecked(showSearch);
m_searchWidget->setShown(showSearch);
}
......@@ -209,7 +208,7 @@ void PlaylistSplitter::saveConfig()
{
KConfigGroup config(KGlobal::config(), "Splitter");
config.writeEntry("PlaylistSplitterSizes", sizes());
config.writeEntry("ShowSearch", action<KToggleAction>("showSearch")->isChecked());
config.writeEntry("ShowSearch", ActionCollection::action<KToggleAction>("showSearch")->isChecked());
}
void PlaylistSplitter::slotShowSearchResults()
......
......@@ -51,12 +51,14 @@ SearchLine::SearchLine(QWidget *parent, bool simple, const char *name) :
setSpacing(5);
if(!m_simple) {
m_searchFieldsBox = new KComboBox(this, "searchFields");
m_searchFieldsBox = new KComboBox(this);
m_searchFieldsBox->setObjectName( "searchFields" );
connect(m_searchFieldsBox, SIGNAL(activated(int)),
this, SIGNAL(signalQueryChanged()));
}
m_lineEdit = new KLineEdit(this, "searchLineEdit");
m_lineEdit = new KLineEdit(this);
m_lineEdit->setObjectName( "searchLineEdit" );
m_lineEdit->installEventFilter(this);
connect(m_lineEdit, SIGNAL(textChanged(const QString &)),
this, SIGNAL(signalQueryChanged()));
......
......@@ -47,18 +47,18 @@ class TrackPositionSlider : public QSlider
public:
TrackPositionSlider(QWidget *parent, const char *name) : QSlider(parent, name)
{
setFocusPolicy(NoFocus);
setFocusPolicy(Qt::NoFocus);
}
protected:
virtual void mousePressEvent(QMouseEvent *e)
{
if(e->button() == LeftButton) {
if(e->button() == Qt::LeftButton) {
QMouseEvent reverse(QEvent::MouseButtonPress, e->pos(), Qt::MidButton, e->state());
QSlider::mousePressEvent(&reverse);
emit sliderPressed();
}
else if(e->button() == MidButton) {
else if(e->button() == Qt::MidButton) {
QMouseEvent reverse(QEvent::MouseButtonPress, e->pos(), Qt::LeftButton, e->state());
QSlider::mousePressEvent(&reverse);
}
......@@ -77,7 +77,7 @@ VolumeSlider::VolumeSlider(Qt::Orientation o, QWidget *parent, const char *name)
void VolumeSlider::wheelEvent(QWheelEvent *e)
{
if(orientation() == Horizontal) {
if(orientation() == Qt::Horizontal) {
QWheelEvent transposed(e->pos(), -(e->delta()), e->state(), e->orientation());
QSlider::wheelEvent(&transposed);
}
......@@ -92,7 +92,7 @@ void VolumeSlider::focusInEvent(QFocusEvent *)
int VolumeSlider::volume() const
{
if(orientation() == Horizontal)
if(orientation() == Qt::Horizontal)
return value();
else
return maxValue() - value();
......@@ -100,7 +100,7 @@ int VolumeSlider::volume() const
void VolumeSlider::setVolume(int value)
{
if(orientation() == Horizontal)
if(orientation() == Qt::Horizontal)
setValue(value);
else
setValue(maxValue() - value);
......@@ -132,8 +132,8 @@ void VolumeSlider::slotValueChanged(int value)
const int SliderAction::minPosition = 0;
const int SliderAction::maxPosition = 1000;
SliderAction::SliderAction(const QString &text, QObject *parent, const char *name)
: KAction(text, 0, parent, name),
SliderAction::SliderAction(const QString &text, KActionCollection* collection, const char *name)
: KAction(text, 0, 0, 0, collection, name),
m_toolBar(0),
m_layout(0),
m_trackPositionSlider(0),
......@@ -211,13 +211,13 @@ void SliderAction::slotUpdateOrientation()
return;
if(m_toolBar->barPos() == KToolBar::Right || m_toolBar->barPos() == KToolBar::Left) {
m_trackPositionSlider->setOrientation(Vertical);
m_volumeSlider->setOrientation(Vertical);
m_trackPositionSlider->setOrientation(Qt::Vertical);
m_volumeSlider->setOrientation(Qt::Vertical);
m_layout->setDirection(QBoxLayout::TopToBottom);
}
else {
m_trackPositionSlider->setOrientation(Horizontal);
m_volumeSlider->setOrientation(Horizontal);
m_trackPositionSlider->setOrientation(Qt::Horizontal);
m_volumeSlider->setOrientation(Qt::Horizontal);
m_layout->setDirection(QBoxLayout::LeftToRight);
}
slotUpdateSize();
......@@ -239,12 +239,12 @@ QWidget *SliderAction::createWidget(QWidget *parent) // virtual -- used by base
if(toolBar)
toolBar->setStretchableWidget(base);
Orientation orientation;
Qt::Orientation orientation;
if(toolBar && toolBar->barPos() == KToolBar::Right || toolBar->barPos() == KToolBar::Left)
orientation = Vertical;
orientation = Qt::Vertical;
else
orientation = Horizontal;
orientation = Qt::Horizontal;
m_layout = new QBoxLayout(base, QBoxLayout::TopToBottom, 5, 5);
......
......@@ -54,7 +54,7 @@ class SliderAction : public KAction
Q_OBJECT
public:
SliderAction(const QString &text, QObject *parent, const char *name);
SliderAction(const QString &text, KActionCollection* collection, const char *name);
virtual ~SliderAction();
VolumeSlider *volumeSlider() const { return m_volumeSlider; }
......
......@@ -57,23 +57,23 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent, const cha
5, "trackAndPlaylistLayout");
trackAndPlaylistLayout->addSpacing(5);
m_playlistLabel = new KSqueezedTextLabel(trackAndPlaylist, "playlistLabel");
m_playlistLabel = new KSqueezedTextLabel(trackAndPlaylist);
trackAndPlaylistLayout->addWidget(m_playlistLabel);
m_playlistLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_playlistLabel->setTextFormat(PlainText);
m_playlistLabel->setAlignment(AlignLeft | AlignVCenter);
m_playlistLabel->setTextFormat(Qt::PlainText);
m_playlistLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_trackLabel = new KSqueezedTextLabel(trackAndPlaylist, "trackLabel");
m_trackLabel = new KSqueezedTextLabel(trackAndPlaylist);
trackAndPlaylistLayout->addWidget(m_trackLabel);
m_trackLabel->setAlignment(AlignRight | AlignVCenter);
m_trackLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_trackLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_trackLabel->setTextFormat(PlainText);
m_trackLabel->setTextFormat(Qt::PlainText);
trackAndPlaylistLayout->addSpacing(5);
m_itemTimeLabel = new QLabel(this);
QFontMetrics fontMetrics(font());
m_itemTimeLabel->setAlignment(AlignCenter);
m_itemTimeLabel->setAlignment(Qt::AlignCenter);
m_itemTimeLabel->setMinimumWidth(fontMetrics.boundingRect("000:00 / 000:00").width());
m_itemTimeLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
m_itemTimeLabel->setFrameStyle(Box | Sunken);
......@@ -183,7 +183,7 @@ bool StatusLabel::eventFilter(QObject *o, QEvent *e)
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(e);
if(e->type() == QEvent::MouseButtonRelease &&
mouseEvent->button() == LeftButton)
mouseEvent->button() == Qt::LeftButton)
{
if(o == m_itemTimeLabel) {
m_showTimeRemaining = !m_showTimeRemaining;
......
......@@ -17,7 +17,7 @@
#define STRINGHASH_H
#include <q3ptrvector.h>
#include <Q3ValueList>
#include <QList>
#include <Q3CString>
#include "filehandle.h"
......@@ -51,7 +51,7 @@ public:
*/
bool remove(T value);
Q3ValueList<T> values() const;
QList<T> values() const;
int hash(T key) const;
......@@ -270,9 +270,9 @@ bool Hash<T>::remove(T value)
}
template <class T>
Q3ValueList<T> Hash<T>::values() const
QList<T> Hash<T>::values() const
{
Q3ValueList<T> l;
QList<T> l;
Node *n;
......
......@@ -37,6 +37,7 @@
#include <QWheelEvent>
#include <QPixmap>
#include <QEvent>
#include <Q3MimeSourceFactory>
#include <Q3Frame>
#include <QLabel>
#include <QMouseEvent>
......@@ -56,6 +57,7 @@ using namespace ActionCollection;
static bool copyImage(QImage &dest, QImage &src, int x, int y);
#if 0 // not necessary in Qt-4.1
class FlickerFreeLabel : public QLabel
{
public:
......@@ -64,7 +66,7 @@ public:
{
m_textColor = paletteForegroundColor();
m_bgColor = parentWidget()->paletteBackgroundColor();
setBackgroundMode(NoBackground);
//setBackgroundMode(Qt::NoBackground);
}
QColor textColor() const
......@@ -98,9 +100,10 @@ protected:
QColor m_textColor;
QColor m_bgColor;
};
#endif
PassiveInfo::PassiveInfo(QWidget *parent, const char *name) :
KPassivePopup(parent, name), m_timer(new QTimer), m_justDie(false)
PassiveInfo::PassiveInfo(QWidget *parent) :
KPassivePopup(parent), m_timer(new QTimer), m_justDie(false)
{
// I'm so sick and tired of KPassivePopup screwing this up
// that I'll just handle the timeout myself, thank you very much.
......@@ -146,10 +149,10 @@ void PassiveInfo::leaveEvent(QEvent *)
// public methods
////////////////////////////////////////////////////////////////////////////////
SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent, name),
m_popup(0),
m_fadeTimer(0),
m_fade(true)
SystemTray::SystemTray(QWidget *parent) : KSystemTray(parent),
m_popup(0),
m_fadeTimer(0),
m_fade(true)
{
// This should be initialized to the number of labels that are used.
......@@ -172,7 +175,7 @@ SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent,
// bindings dialog.
new KAction(i18n("Redisplay Popup"), KShortcut(), this,
SLOT(slotPlay()), actions(), "showPopup");
SLOT(slotPlay()), ActionCollection::actions(), "showPopup");
KMenu *cm = contextMenu();
......@@ -190,7 +193,7 @@ SystemTray::SystemTray(QWidget *parent, const char *name) : KSystemTray(parent,
// Pity the actionCollection doesn't keep track of what sub-menus it has.
KActionMenu *menu = new KActionMenu(i18n("&Random Play"), this);
KActionMenu *menu = new KActionMenu(i18n("&Random Play"), actionCollection(), "randomplay");
menu->insert(action("disableRandomPlay"));
menu->insert(action("randomPlay"));
menu->insert(action("albumRandomPlay"));
......@@ -256,7 +259,7 @@ void SystemTray::slotStop()
void SystemTray::slotPopupDestroyed()
{
for(unsigned i = 0; i < m_labels.capacity(); ++i)
for(int i = 0; i < m_labels.capacity(); ++i)
m_labels[i] = 0;
}
......@@ -272,7 +275,7 @@ void SystemTray::slotNextStep()
result = interpolateColor(m_step);
for(unsigned i = 0; i < m_labels.capacity() && m_labels[i]; ++i)
for(int i = 0; i < m_labels.capacity() && m_labels[i]; ++i)
m_labels[i]->setPaletteForegroundColor(result);
if(m_step == STEPS) {
......@@ -284,8 +287,8 @@ void SystemTray::slotNextStep()
void SystemTray::slotFadeOut()
{
m_startColor = m_labels[0]->textColor();
m_endColor = m_labels[0]->backgroundColor();
m_startColor = m_labels[0]->palette().color( QPalette::Text ); //textColor();
m_endColor = m_labels[0]->palette().color( QPalette::Window ); //backgroundColor();
connect(this, SIGNAL(fadeDone()), m_popup, SLOT(hide()));
connect(m_popup, SIGNAL(mouseEntered()), this, SLOT(slotMouseInPopup()));
......@@ -297,7 +300,7 @@ void SystemTray::slotFadeOut()
// don't have to do it ourselves.
void SystemTray::slotMouseInPopup()
{
m_endColor = m_labels[0]->textColor();
m_endColor = m_labels[0]->palette().color( QPalette::Text ); //textColor();
disconnect(SIGNAL(fadeDone()));
m_step = STEPS - 1; // Simulate end of fade to solid text
......@@ -356,7 +359,7 @@ void SystemTray::createPopup()
// If the action exists and it's checked, do our stuff
if(!action<KToggleAction>("togglePopups")->isChecked())
if(!ActionCollection::action<KToggleAction>("togglePopups")->isChecked())
return;
delete m_popup;
......@@ -377,9 +380,9 @@ void SystemTray::createPopup()
Q3VBox *infoBox = createPopupLayout(box, playingFile);
for(unsigned i = 0; i < m_labels.capacity(); ++i) {
m_labels[i] = new FlickerFreeLabel(" ", infoBox);
m_labels[i]->setAlignment(AlignRight | AlignVCenter);
for(int i = 0; i < m_labels.capacity(); ++i) {
m_labels[i] = new QLabel /*FlickerFreeLabel*/(" ", infoBox);
m_labels[i]->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
}
// We don't want an autodelete popup. There are times when it will need
......@@ -407,8 +410,10 @@ void SystemTray::createPopup()
m_labels[labelCount++]->setText(s);
}
m_startColor = m_labels[0]->backgroundColor();
m_endColor = m_labels[0]->textColor();
m_startColor = m_labels[0]->palette().color( QPalette::Window ); //backgroundColor();
m_endColor = m_labels[0]->palette().color( QPalette::Text ); //textColor();
//m_startColor = m_labels[0]->backgroundColor();
//m_endColor = m_labels[0]->textColor();
slotNextStep();
m_fadeTimer->start(1500 / STEPS);
......@@ -549,7 +554,7 @@ void SystemTray::setToolTip(const QString &tip, const QPixmap &cover)
void SystemTray::wheelEvent(QWheelEvent *e)
{
if(e->orientation() == Horizontal)
if(e->orientation() == Qt::Horizontal)
return;
// I already know the type here, but this file doesn't (and I don't want it
......@@ -558,7 +563,7 @@ void SystemTray::wheelEvent(QWheelEvent *e)
// inheritance. (This is why I don't check the result.)
switch(e->state()) {
case ShiftButton:
case Qt::ShiftButton:
if(e->delta() > 0)
action("volumeUp")->activate();
else
......@@ -580,12 +585,12 @@ void SystemTray::wheelEvent(QWheelEvent *e)
void SystemTray::mousePressEvent(QMouseEvent *e)
{
switch(e->button()) {
case LeftButton:
case RightButton:
case Qt::LeftButton:
case Qt::RightButton:
default:
KSystemTray::mousePressEvent(e);
break;
case MidButton:
case Qt::MidButton:
if(!rect().contains(e->pos()))
return;
if(action("pause")->isEnabled())
......
......@@ -44,7 +44,7 @@ class PassiveInfo : public KPassivePopup
{
Q_OBJECT
public:
PassiveInfo(QWidget *parent = 0, const char *name = 0);
PassiveInfo(QWidget *parent = 0);
public slots:
void setTimeout(int delay);
......@@ -71,7 +71,7 @@ class SystemTray : public KSystemTray
Q_OBJECT
public:
SystemTray(QWidget *parent = 0, const char *name = 0);
SystemTray(QWidget *parent = 0);
virtual ~SystemTray();
signals:
......@@ -129,7 +129,7 @@ private:
QColor m_startColor, m_endColor;
PassiveInfo *m_popup;
Q3ValueVector<FlickerFreeLabel *> m_labels;
Q3ValueVector<QLabel /*FlickerFreeLabel*/ *> m_labels;
QTimer *m_fadeTimer;
int m_step;
bool m_fade;
......
......@@ -32,6 +32,7 @@
#include <kactionclasses.h>
#include <qlabel.h>
#include <qapplication.h>
#include <qcheckbox.h>
#include <qlayout.h>
#include <qdir.h>
......@@ -51,8 +52,6 @@
#undef KeyRelease
using namespace ActionCollection;
class FileNameValidator : public QValidator
{
public:
......@@ -72,6 +71,7 @@ public:
}
};
#if 0 // Qt4 porting: this needs to be in the ::event() for m_fileNameBox (i.e. it needs a KLineEdit-derived class)
class FileBoxToolTip : public QToolTip
{
public:
......@@ -85,6 +85,7 @@ protected:
private:
TagEditor *m_editor;
};
#endif
class FixedHLayout : public QHBoxLayout
{
......@@ -237,7 +238,8 @@ void TagEditor::slotRefresh()
m_albumNameBox->setEditText(tag->album());
m_fileNameBox->setText(item->file().fileInfo().fileName());
new FileBoxToolTip(this, m_fileNameBox);
//// TODO: new FileBoxToolTip(this, m_fileNameBox);
m_bitrateBox->setText(QString::number(tag->bitrate()));
m_lengthBox->setText(tag->lengthString());
......@@ -388,14 +390,14 @@ void TagEditor::updateCollection()
QStringList artistList = list->uniqueSet(CollectionList::Artists);
artistList.sort();
m_artistNameBox->listBox()->clear();
m_artistNameBox->listBox()->insertStringList(artistList);
m_artistNameBox->clear();
m_artistNameBox->insertStringList(artistList);
m_artistNameBox->completionObject()->setItems(artistList);
QStringList albumList = list->uniqueSet(CollectionList::Albums);
albumList.sort();
m_albumNameBox->listBox()->clear();
m_albumNameBox->listBox()->insertStringList(albumList);
m_albumNameBox->clear();
m_albumNameBox->insertStringList(albumList);
m_albumNameBox->completionObject()->setItems(albumList);
// Merge the list of genres found in tags with the standard ID3v1 set.
......@@ -415,9 +417,9 @@ void TagEditor::updateCollection()
m_genreList = genreHash.values();
m_genreList.sort();
m_genreBox->listBox()->clear();
m_genreBox->listBox()->insertItem(QString::null);
m_genreBox->listBox()->insertStringList(m_genreList);
m_genreBox->clear();
m_genreBox->insertItem(QString::null);
m_genreBox->insertStringList(m_genreList);
m_genreBox->completionObject()->setItems(m_genreList);
}
......@@ -437,7 +439,7 @@ void TagEditor::readConfig()
}
bool show = config.readEntry("Show", false);
action<KToggleAction>("showEditor")->setChecked(show);
ActionCollection::action<KToggleAction>("showEditor")->setChecked(show);
setShown(show);
TagLib::StringList genres = TagLib::ID3v1::genreList();
......@@ -455,7 +457,7 @@ void TagEditor::readConfig()
void TagEditor::readCompletionMode(KConfigBase *config, KComboBox *box, const QString &key)
{
KGlobalSettings::Completion mode =
KGlobalSettings::Completion(config->readEntry(key, KGlobalSettings::CompletionAuto));
KGlobalSettings::Completion(config->readEntry(key, (int)KGlobalSettings::CompletionAuto));
box->setCompletionMode(mode);
}
......@@ -467,20 +469,20 @@ void TagEditor::saveConfig()
KConfigGroup config(KGlobal::config(), "TagEditor");
if(m_artistNameBox && m_albumNameBox) {
config.writeEntry("ArtistNameBoxMode", m_artistNameBox->completionMode());
config.writeEntry("AlbumNameBoxMode", m_albumNameBox->completionMode());
config.writeEntry("GenreBoxMode", m_genreBox->completionMode());
config.writeEntry("ArtistNameBoxMode", (int)m_artistNameBox->completionMode());
config.writeEntry("AlbumNameBoxMode", (int)m_albumNameBox->completionMode());
config.writeEntry("GenreBoxMode", (int)m_genreBox->completionMode());
}
config.writeEntry("Show", action<KToggleAction>("showEditor")->isChecked());
config.writeEntry("Show", ActionCollection::action<KToggleAction>("showEditor")->isChecked());
}
void TagEditor::setupActions()
{
KToggleAction *show = new KToggleAction(i18n("Show &Tag Editor"), "edit", 0, actions(), "showEditor");
KToggleAction *show = new KToggleAction(i18n("Show &Tag Editor"), "edit", 0, ActionCollection::actions(), "showEditor");
show->setCheckedState(i18n("Hide &Tag Editor"));
connect(show, SIGNAL(toggled(bool)), this, SLOT(setShown(bool)));
new KAction(i18n("&Save"), "filesave", "CTRL+t", this, SLOT(slotSave()), actions(), "saveItem");
new KAction(i18n("&Save"), "filesave", "CTRL+t", this, SLOT(slotSave()), ActionCollection::actions(), "saveItem");
}
void TagEditor::setupLayout()
......@@ -509,7 +511,8 @@ void TagEditor::setupLayout()
m_artistNameBox->setCompletionMode(KGlobalSettings::CompletionAuto);
addItem(i18n("&Artist name:"), m_artistNameBox, leftColumnLayout, "personal");
m_trackNameBox = new KLineEdit(this, "trackNameBox");
m_trackNameBox = new KLineEdit(this);
m_trackNameBox->setObjectName( "trackNameBox" );
addItem(i18n("&Track name:"), m_trackNameBox, leftColumnLayout, "player_play");
m_albumNameBox = new KComboBox( true, this );
......@@ -533,7 +536,8 @@ void TagEditor::setupLayout()
QHBoxLayout *fileNameLayout = new QHBoxLayout(rightColumnLayout,
horizontalSpacing);
m_fileNameBox = new KLineEdit(this, "fileNameBox");
m_fileNameBox = new KLineEdit(this);
m_fileNameBox->setObjectName( "fileNameBox" );
m_fileNameBox->setValidator(new FileNameValidator(m_fileNameBox));
QLabel *fileNameIcon = new QLabel(this);
......@@ -551,14 +555,16 @@ void TagEditor::setupLayout()
FixedHLayout *trackRowLayout = new FixedHLayout(rightColumnLayout,
horizontalSpacing);
m_trackSpin = new KIntSpinBox(0, 9999, 1, 0, 10, this, "trackSpin");
m_trackSpin = new KIntSpinBox(0, 9999, 1, 0, this);
m_trackSpin->setObjectName( "trackSpin" );
addItem(i18n("T&rack:"), m_trackSpin, trackRowLayout);
m_trackSpin->installEventFilter(this);
trackRowLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding,
QSizePolicy::Minimum));
m_yearSpin = new KIntSpinBox(0, 9999, 1, 0, 10, this, "yearSpin");
m_yearSpin = new KIntSpinBox(0, 9999, 1, 0, this );
m_yearSpin->setObjectName( "yearSpin" );
addItem(i18n("&Year:"), m_yearSpin, trackRowLayout);
m_yearSpin->installEventFilter(this);
......@@ -566,7 +572,8 @@ void TagEditor::setupLayout()
QSizePolicy::Minimum));
trackRowLayout->addWidget(addHidden(new QLabel(i18n("Length:"), this)));
m_lengthBox = new KLineEdit(this, "lengthBox");
m_lengthBox = new KLineEdit(this);
m_lengthBox->setObjectName( "lengthBox" );
// addItem(i18n("Length:"), m_lengthBox, trackRowLayout);
m_lengthBox->setMinimumWidth(fontMetrics().width("00:00") + trackRowLayout->spacing());
m_lengthBox->setMaximumWidth(50);
......@@ -578,7 +585,8 @@ void TagEditor::setupLayout()
QSizePolicy::Minimum));
trackRowLayout->addWidget(addHidden(new QLabel(i18n("Bitrate:"), this)));
m_bitrateBox = new KLineEdit(this, "bitrateBox");
m_bitrateBox = new KLineEdit(this);
m_bitrateBox->setObjectName( "bitrateBox" );
// addItem(i18n("Bitrate:"), m_bitrateBox, trackRowLayout);
m_bitrateBox->setMinimumWidth(fontMetrics().width("000") + trackRowLayout->spacing());
m_bitrateBox->setMaximumWidth(50);
......@@ -644,7 +652,7 @@ void TagEditor::save(const PlaylistItemList &list)
// playlists will try to modify the file we edit if the tag changes
// due to our alterations here.
kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
qApp->processEvents(QEventLoop::ExcludeUserInput);
PlaylistItem *item = *it;
......
......@@ -13,6 +13,7 @@
#include <kdebug.h>
#include <kglobal.h>
#include <kmacroexpander.h>
#include <qhash.h>
FileNameScheme::FileNameScheme(const QString &s)
: m_regExp(),
......@@ -25,7 +26,7 @@ FileNameScheme::FileNameScheme(const QString &s)
int fieldNumber = 1;
int i = s.find('%');
while (i > -1) {
switch (s[ i + 1 ]) {
switch (s[ i + 1 ].toLatin1()) {
case 't': m_titleField = fieldNumber++;
break;
case 'a': m_artistField = fieldNumber++;
......@@ -91,7 +92,7 @@ QString FileNameScheme::comment() const
QString FileNameScheme::composeRegExp(const QString &s) const
{
QMap<QChar, QString> substitutions;
QHash<QChar, QString> substitutions;
KConfigGroup config(KGlobal::config(), "TagGuesser");
......@@ -114,7 +115,7 @@ QStringList TagGuesser::schemeStrings()
QStringList schemes;
KConfigGroup config(KGlobal::config(), "TagGuesser");
schemes = config.readEntry("Filename schemes");
schemes = config.readEntry("Filename schemes", QStringList());
if ( schemes.isEmpty() ) {
schemes += "%a - (%T) - %t [%c]";
......@@ -151,10 +152,8 @@ QStringList TagGuesser::schemeStrings()
void TagGuesser::setSchemeStrings(const QStringList &schemes)
{
KConfig *cfg = KGlobal::config();
{
KConfigGroupSaver saver(cfg, "TagGuesser");
cfg->writeEntry("Filename schemes", schemes);
}
KConfigGroup group(cfg, "TagGuesser");
group.writeEntry("Filename schemes", schemes);
cfg->sync();
}
......
......@@ -62,7 +62,7 @@ TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
void TagGuesserConfigDlg::accept()
{
if(m_child->lvSchemes->renameLineEdit()) {
QKeyEvent returnKeyPress(QEvent::KeyPress, Key_Return, 0, 0);
QKeyEvent returnKeyPress(QEvent::KeyPress, Qt::Key_Return, 0, 0);
KApplication::sendEvent(m_child->lvSchemes->renameLineEdit(), &returnKeyPress);
}
......
......@@ -67,12 +67,12 @@ TagRenamerOptions::TagRenamerOptions(const CategoryID &category)
if(categoryNum > 0)
typeKey.append(QString::number(categoryNum));
setSuffix(config.readEntry(QString("%1Suffix").arg(typeKey)));