Commit c6000f25 authored by Tim Beaulen's avatar Tim Beaulen

Less deprecated functions.


svn path=/trunk/KDE/kdemultimedia/juk/; revision=595635
parent 030e24d1
......@@ -21,6 +21,7 @@
#include "ktrm.h"
#include <config-juk.h>
#ifdef HAVE_TUNEPIMP //Silence warning about HAVE_TUNEPIMP not being defined.
#if HAVE_TUNEPIMP
#include <kapplication.h>
......@@ -34,7 +35,6 @@
#include <qevent.h>
#include <QObject>
#include <QFile>
//Added by qt3to4:
#include <QCustomEvent>
#include <tunepimp/tp_c.h>
......@@ -603,6 +603,7 @@ void KTRMLookup::finished()
delete this;
}
#endif
#endif
// vim: set et sw=4 tw=0 sta:
......@@ -54,12 +54,12 @@ protected:
virtual void mousePressEvent(QMouseEvent *e)
{
if(e->button() == Qt::LeftButton) {
QMouseEvent reverse(QEvent::MouseButtonPress, e->pos(), Qt::MidButton, e->state());
QMouseEvent reverse(QEvent::MouseButtonPress, e->pos(), Qt::MidButton, e->buttons(), e->modifiers());
QSlider::mousePressEvent(&reverse);
emit sliderPressed();
}
else if(e->button() == Qt::MidButton) {
QMouseEvent reverse(QEvent::MouseButtonPress, e->pos(), Qt::LeftButton, e->state());
QMouseEvent reverse(QEvent::MouseButtonPress, e->pos(), Qt::LeftButton, e->buttons(), e->modifiers());
QSlider::mousePressEvent(&reverse);
}
}
......@@ -78,7 +78,7 @@ VolumeSlider::VolumeSlider(Qt::Orientation o, QWidget *parent) :
void VolumeSlider::wheelEvent(QWheelEvent *e)
{
if(orientation() == Qt::Horizontal) {
QWheelEvent transposed(e->pos(), -(e->delta()), e->state(), e->orientation());
QWheelEvent transposed(e->pos(), -(e->delta()), e->buttons(), e->modifiers(), e->orientation());
QSlider::wheelEvent(&transposed);
}
else
......@@ -151,6 +151,8 @@ SliderAction::~SliderAction()
int SliderAction::plug(QWidget *parent, int index)
{
Q_UNUSED(index)
m_widget = createWidget(parent);
if(!m_widget)
......@@ -172,7 +174,7 @@ int SliderAction::plug(QWidget *parent, int index)
this, SLOT(slotUpdateOrientation()));
slotUpdateOrientation();
return (containerCount() - 1);
return (associatedWidgets().count() - 1);
}
else
slotUpdateOrientation();
......
......@@ -20,9 +20,9 @@
#include <kdebug.h>
#include <qpainter.h>
//Added by qt3to4:
#include <QPixmap>
#include <QLabel>
#include <QPalette>
#include "splashscreen.h"
......@@ -73,16 +73,20 @@ void SplashScreen::update()
// protected members
////////////////////////////////////////////////////////////////////////////////
SplashScreen::SplashScreen() : QLabel(0 , "splashScreen", Qt::WStyle_Splash)
SplashScreen::SplashScreen() : QLabel(0, Qt::WStyle_Splash)
{
setObjectName("splashScreen");
QPixmap background = UserIcon("splash");
resize(background.size());
setPaletteBackgroundPixmap(background);
QPalette palette;
palette.setBrush(backgroundRole(), QBrush(background));
setMargin(7);
setAlignment(Qt::AlignLeft | Qt::AlignBottom);
setPaletteForegroundColor(QColor(107, 158, 194));
palette.setColor(foregroundRole(), QColor(107, 158, 194));
setPalette(palette);
QFont f = font();
f.setPixelSize(10);
......
......@@ -22,7 +22,6 @@
#include <QToolTip>
#include <QLayout>
//Added by qt3to4:
#include <QMouseEvent>
#include <QLabel>
#include <Q3Frame>
......@@ -88,7 +87,7 @@ StatusLabel::StatusLabel(PlaylistInterface *playlist, QWidget *parent, const cha
jumpBox->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
QPushButton *jumpButton = new QPushButton(jumpBox);
jumpButton->setPixmap(SmallIcon("up"));
jumpButton->setIcon(SmallIcon("up"));
jumpButton->setFlat(true);
jumpButton->setToolTip( i18n("Jump to the currently playing item"));
......@@ -115,7 +114,7 @@ void StatusLabel::updateCurrent()
QString text = file.tag()->artist() + mid + file.tag()->title();
m_trackLabel->setText(text);
m_playlistLabel->setText(playlist()->name().simplifyWhiteSpace());
m_playlistLabel->setText(playlist()->name().simplified());
}
}
......
......@@ -35,7 +35,7 @@
#include <q3valuevector.h>
#include <q3stylesheet.h>
#include <qpalette.h>
//Added by qt3to4:
#include <QWheelEvent>
#include <QPixmap>
#include <QEvent>
......@@ -166,8 +166,8 @@ SystemTray::SystemTray(QWidget *parent) : KSystemTrayIcon(parent),
m_playPix = createPixmap("player_play");
m_pausePix = createPixmap("player_pause");
m_forwardPix = loadIcon("player_end").pixmap();
m_backPix = loadIcon("player_start").pixmap();
m_forwardPix = SmallIcon("player_end");
m_backPix = SmallIcon("player_start");
setIcon(m_appPix);
......@@ -203,7 +203,8 @@ SystemTray::SystemTray(QWidget *parent) : KSystemTrayIcon(parent),
cm->addAction( action("togglePopups") );
m_fadeTimer = new QTimer(this, "systrayFadeTimer");
m_fadeTimer = new QTimer(this);
m_fadeTimer->setObjectName("systrayFadeTimer");
connect(m_fadeTimer, SIGNAL(timeout()), SLOT(slotNextStep()));
if(PlayerManager::instance()->playing())
......@@ -277,8 +278,11 @@ void SystemTray::slotNextStep()
result = interpolateColor(m_step);
for(int i = 0; i < m_labels.capacity() && m_labels[i]; ++i)
m_labels[i]->setPaletteForegroundColor(result);
for(int i = 0; i < m_labels.capacity() && m_labels[i]; ++i) {
QPalette palette;
palette.setColor(m_labels[i]->foregroundRole(), result);
m_labels[i]->setPalette(palette);
}
if(m_step == STEPS) {
m_step = 0;
......@@ -444,7 +448,7 @@ bool SystemTray::buttonsToLeft() const
QPixmap SystemTray::createPixmap(const QString &pixName)
{
QImage bgImage = m_appPix.pixmap().toImage(); // Probably 22x22
QImage bgImage = m_appPix.pixmap(22).toImage(); // 22x22
QImage fgImage = SmallIcon(pixName).toImage(); // Should be 16x16
KIconEffect::semiTransparent(bgImage);
......@@ -460,11 +464,13 @@ void SystemTray::createButtonBox(QWidget *parent)
buttonBox->setSpacing(3);
QPushButton *forwardButton = new QPushButton(m_forwardPix, 0, buttonBox, "popup_forward");
QPushButton *forwardButton = new QPushButton(m_forwardPix, 0, buttonBox);
forwardButton->setObjectName("popup_forward");
forwardButton->setFlat(true);
connect(forwardButton, SIGNAL(clicked()), SLOT(slotForward()));
QPushButton *backButton = new QPushButton(m_backPix, 0, buttonBox, "popup_back");
QPushButton *backButton = new QPushButton(m_backPix, 0, buttonBox);
backButton->setObjectName("popup_back");
backButton->setFlat(true);
connect(backButton, SIGNAL(clicked()), SLOT(slotBack()));
}
......@@ -501,7 +507,7 @@ void SystemTray::addCoverButton(QWidget *parent, const QPixmap &cover)
{
QPushButton *coverButton = new QPushButton(parent);
coverButton->setPixmap(cover);
coverButton->setIcon(cover);
coverButton->setFixedSize(cover.size());
coverButton->setFlat(true);
......@@ -536,7 +542,7 @@ void SystemTray::setToolTip(const QString &tip, const QPixmap &cover)
QImage coverImage = myCover.toImage();
if(coverImage.size().width() > 32 || coverImage.size().height() > 32)
coverImage = coverImage.smoothScale(32, 32);
coverImage = coverImage.scaled(32, 32, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
Q3MimeSourceFactory::defaultFactory()->setImage("tipCover", coverImage);
......@@ -560,7 +566,7 @@ void SystemTray::wheelEvent(QWheelEvent *e)
// that a reinterpret_cast isn't portable when combined with multiple
// inheritance. (This is why I don't check the result.)
switch(e->state()) {
switch(e->modifiers()) {
case Qt::ShiftButton:
if(e->delta() > 0)
action("volumeUp")->trigger();
......@@ -620,9 +626,9 @@ static bool copyImage(QImage &dest, QImage &src, int x, int y)
// However, we do have to specifically ensure that setAlphaBuffer is set
// to false
large_src.setAlphaBuffer(false);
large_src.convertToFormat(QImage::Format_RGB32); // Turn off alpha
large_src.fill(0); // All transparent pixels
large_src.setAlphaBuffer(true);
large_src.convertToFormat(QImage::Format_ARGB32); // Turn on alpha
int w = src.width();
int h = src.height();
......
......@@ -227,11 +227,11 @@ Tag::Tag(const QString &fileName, bool) :
void Tag::setup(TagLib::File *file)
{
m_title = TStringToQString(file->tag()->title()).stripWhiteSpace();
m_artist = TStringToQString(file->tag()->artist()).stripWhiteSpace();
m_album = TStringToQString(file->tag()->album()).stripWhiteSpace();
m_genre = TStringToQString(file->tag()->genre()).stripWhiteSpace();
m_comment = TStringToQString(file->tag()->comment()).stripWhiteSpace();
m_title = TStringToQString(file->tag()->title()).trimmed();
m_artist = TStringToQString(file->tag()->artist()).trimmed();
m_album = TStringToQString(file->tag()->album()).trimmed();
m_genre = TStringToQString(file->tag()->genre()).trimmed();
m_comment = TStringToQString(file->tag()->comment()).trimmed();
m_track = file->tag()->track();
m_year = file->tag()->year();
......
......@@ -42,7 +42,6 @@
#include <QToolTip>
#include <qeventloop.h>
#include <q3dict.h>
//Added by qt3to4:
#include <QEvent>
#include <QKeyEvent>
#include <QHBoxLayout>
......@@ -59,7 +58,10 @@ class FileNameValidator : public QValidator
{
public:
FileNameValidator(QObject *parent, const char *name = 0) :
QValidator(parent, name) {}
QValidator(parent)
{
setObjectName(name);
}
virtual void fixup(QString &s) const
{
......@@ -256,8 +258,8 @@ void TagEditor::slotRefresh()
m_bitrateBox->setText(QString::number(tag->bitrate()));
m_lengthBox->setText(tag->lengthString());
if(m_genreList.findIndex(tag->genre()) >= 0)
m_genreBox->setCurrentIndex(m_genreList.findIndex(tag->genre()) + 1);
if(m_genreList.indexOf(tag->genre()) >= 0)
m_genreBox->setCurrentIndex(m_genreList.indexOf(tag->genre()) + 1);
else {
m_genreBox->setCurrentIndex(0);
m_genreBox->setEditText(tag->genre());
......@@ -453,7 +455,7 @@ void TagEditor::readConfig()
bool show = config.readEntry("Show", false);
ActionCollection::action<KToggleAction>("showEditor")->setChecked(show);
setShown(show);
setVisible(show);
TagLib::StringList genres = TagLib::ID3v1::genreList();
......@@ -686,10 +688,10 @@ void TagEditor::save(const PlaylistItemList &list)
++it;
QString fileName = item->file().fileInfo().dirPath() + QDir::separator() +
QString fileName = item->file().fileInfo().path() + QDir::separator() +
m_fileNameBox->text();
if(list.count() > 1)
fileName = item->file().fileInfo().absFilePath();
fileName = item->file().fileInfo().absoluteFilePath();
Tag *tag = TagTransactionManager::duplicateTag(item->file().tag(), fileName);
......@@ -812,7 +814,7 @@ void TagEditor::showEvent(QShowEvent *e)
bool TagEditor::eventFilter(QObject *watched, QEvent *e)
{
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
if(watched->inherits("QSpinBox") && e->type() == QEvent::KeyRelease && ke->state() == 0)
if(watched->inherits("QSpinBox") && e->type() == QEvent::KeyRelease && ke->modifiers() == 0)
slotDataChanged();
return false;
......
......@@ -102,7 +102,7 @@ QString FileNameScheme::composeRegExp(const QString &s) const
substitutions[ 'T' ] = config.readEntry("Track regexp", "(\\d+)");
substitutions[ 'c' ] = config.readEntry("Comment regexp", "([\\w\\s_]+)");
QString regExp = QRegExp::escape(s.simplifyWhiteSpace());
QString regExp = QRegExp::escape(s.simplified());
regExp = ".*" + regExp;
regExp.replace(' ', "\\s+");
regExp = KMacroExpander::expandMacros(regExp, substitutions);
......@@ -186,11 +186,11 @@ void TagGuesser::guess(const QString &absFileName)
for (; it != end; ++it) {
const FileNameScheme schema(*it);
if(schema.matches(absFileName)) {
m_title = capitalizeWords(schema.title().replace('_', " ")).stripWhiteSpace();
m_artist = capitalizeWords(schema.artist().replace('_', " ")).stripWhiteSpace();
m_album = capitalizeWords(schema.album().replace('_', " ")).stripWhiteSpace();
m_track = schema.track().stripWhiteSpace();
m_comment = schema.comment().replace('_', " ").stripWhiteSpace();
m_title = capitalizeWords(schema.title().replace('_', " ")).trimmed();
m_artist = capitalizeWords(schema.artist().replace('_', " ")).trimmed();
m_album = capitalizeWords(schema.album().replace('_', " ")).trimmed();
m_track = schema.track().trimmed();
m_comment = schema.comment().replace('_', " ").trimmed();
break;
}
}
......
......@@ -18,7 +18,6 @@
#include <qtoolbutton.h>
#include <qevent.h>
//Added by qt3to4:
#include <QKeyEvent>
TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
......@@ -37,8 +36,8 @@ TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
m_child->lvSchemes->setItemsRenameable(true);
m_child->lvSchemes->setSorting(-1);
m_child->lvSchemes->setDefaultRenameAction(Q3ListView::Accept);
m_child->bMoveUp->setIconSet(BarIconSet("1uparrow"));
m_child->bMoveDown->setIconSet(BarIconSet("1downarrow"));
m_child->bMoveUp->setIcon(BarIconSet("1uparrow"));
m_child->bMoveDown->setIcon(BarIconSet("1downarrow"));
const QStringList schemes = TagGuesser::schemeStrings();
QStringList::ConstIterator it = schemes.begin();
......@@ -67,7 +66,7 @@ TagGuesserConfigDlg::TagGuesserConfigDlg(QWidget *parent, const char *name)
void TagGuesserConfigDlg::accept()
{
if(m_child->lvSchemes->renameLineEdit()) {
QKeyEvent returnKeyPress(QEvent::KeyPress, Qt::Key_Return, 0, 0);
QKeyEvent returnKeyPress(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
KApplication::sendEvent(m_child->lvSchemes->renameLineEdit(), &returnKeyPress);
}
......
......@@ -123,14 +123,15 @@ bool TagTransactionManager::undo()
return result;
}
TagTransactionManager::TagTransactionManager(QWidget *parent) : QObject(parent, "tagmanager")
TagTransactionManager::TagTransactionManager(QWidget *parent) : QObject(parent)
{
setObjectName("tagmanager");
m_manager = this;
}
bool TagTransactionManager::renameFile(const QFileInfo &from, const QFileInfo &to) const
{
if(!QFileInfo(to.dirPath()).isWritable() || !from.exists())
if(!QFileInfo(to.path()).isWritable() || !from.exists())
return false;
if(!to.exists() ||
......@@ -139,9 +140,9 @@ bool TagTransactionManager::renameFile(const QFileInfo &from, const QFileInfo &t
i18n("This file already exists.\nDo you want to replace it?"),
i18n("File Exists"),KGuiItem(i18n("Replace"))) == KMessageBox::Continue)
{
kDebug(65432) << "Renaming " << from.absFilePath() << " to " << to.absFilePath() << endl;
kDebug(65432) << "Renaming " << from.absoluteFilePath() << " to " << to.absoluteFilePath() << endl;
QDir currentDir;
return currentDir.rename(from.absFilePath(), to.absFilePath());
return currentDir.rename(from.absoluteFilePath(), to.absoluteFilePath());
}
return false;
......
......@@ -22,7 +22,6 @@
#include <QFile>
#include <QDir>
#include <QDataStream>
//Added by qt3to4:
#include <Q3ValueList>
#include <QResizeEvent>
#include <QEvent>
......@@ -196,7 +195,7 @@ QStringList ViewMode::lines(const PlaylistBox::Item *item,
while(!line.isEmpty()) {
int textLength = line.length();
while(textLength > 0 &&
fm.width(line.mid(0, textLength).stripWhiteSpace()) +
fm.width(line.mid(0, textLength).trimmed()) +
item->listView()->itemMargin() * 2 > width)
{
int i = line.lastIndexOf(QRegExp( "\\W"), textLength - 1);
......@@ -206,7 +205,7 @@ QStringList ViewMode::lines(const PlaylistBox::Item *item,
textLength--;
}
l.append(line.mid(0, textLength).stripWhiteSpace());
l.append(line.mid(0, textLength).trimmed());
line = line.mid(textLength);
}
return l;
......
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