Commit 030e24d1 authored by Tim Beaulen's avatar Tim Beaulen

Less use of deprecated functions.


svn path=/trunk/KDE/kdemultimedia/juk/; revision=595556
parent 8b7ff425
......@@ -20,10 +20,10 @@
QString CategoryReaderInterface::value(const CategoryID &category) const
{
QString value = categoryValue(category.category).stripWhiteSpace();
QString value = categoryValue(category.category).trimmed();
if(category.category == Track)
value = fixupTrack(value, category.categoryNumber).stripWhiteSpace();
value = fixupTrack(value, category.categoryNumber).trimmed();
if(value.isEmpty() && emptyAction(category) == TagRenamerOptions::UseReplacementValue)
value = emptyText(category);
......
......@@ -280,9 +280,9 @@ void CollectionList::contentsDropEvent(QDropEvent *e)
void CollectionList::contentsDragMoveEvent(QDragMoveEvent *e)
{
if(canDecode(e) && e->source() != this)
e->accept(true);
e->setAccepted(true);
else
e->accept(false);
e->setAccepted(false);
}
QString CollectionList::addStringToDict(const QString &value, int column)
......@@ -367,7 +367,7 @@ void CollectionListItem::refresh()
if(id != TrackNumberColumn && id != LengthColumn) {
// All columns other than track num and length need local-encoded data for sorting
QByteArray toLower = text(i).toLower().local8Bit();
QByteArray toLower = text(i).toLower().toLocal8Bit();
// For some columns, we may be able to share some strings
......
......@@ -143,7 +143,7 @@ void CoverDialog::slotContextRequested(Q3IconViewItem *item, const QPoint &pt)
if(!menu) {
menu = new KMenu(this);
menu->insertItem(i18n("Remove Cover"), this, SLOT(removeSelectedCover()));
menu->addAction(i18n("Remove Cover"), this, SLOT(removeSelectedCover()));
}
menu->popup(pt);
......
......@@ -133,7 +133,7 @@ public:
void CoverManagerPrivate::createDataDir() const
{
QDir dir;
QString dirPath(QDir::cleanDirPath(coverLocation() + "/.."));
QString dirPath(QDir::cleanPath(coverLocation() + "/.."));
if(!dir.exists(dirPath))
KStandardDirs::makeDir(dirPath);
}
......@@ -162,7 +162,7 @@ void CoverManagerPrivate::saveCovers() const
// Write out the data
for(CoverDataMap::ConstIterator it = covers.begin(); it != covers.end(); ++it) {
out << Q_UINT32(it.key());
out << *it.data();
out << *it.value();
}
// Now write out the track mapping.
......@@ -325,7 +325,7 @@ coverKey CoverManager::idFromMetadata(const QString &artist, const QString &albu
CoverDataMap::ConstIterator endIt = end();
for(; it != endIt; ++it) {
if(it.data()->album == album.toLower() && it.data()->artist == artist.toLower())
if(it.value()->album == album.toLower() && it.value()->artist == artist.toLower())
return it.key();
}
......
......@@ -83,7 +83,7 @@ DirectoryList::Result DirectoryList::exec()
void DirectoryList::slotAddDirectory()
{
QString dir = KFileDialog::getExistingDirectory();
if(!dir.isEmpty() && m_dirList.find(dir) == m_dirList.end()) {
if(!dir.isEmpty() && !m_dirList.contains(dir)) {
m_dirList.append(dir);
new K3ListViewItem(m_base->directoryListView, dir);
m_result.addedDirs.append(dir);
......@@ -96,7 +96,7 @@ void DirectoryList::slotRemoveDirectory()
return;
QString dir = m_base->directoryListView->selectedItem()->text(0);
m_dirList.remove(dir);
m_dirList.removeAll(dir);
m_result.removedDirs.append(dir);
delete m_base->directoryListView->selectedItem();
}
......
......@@ -37,13 +37,13 @@ AddNumberProperty(Seconds, tag()->seconds())
AddNumberProperty(Bitrate, tag()->bitrate())
AddProperty(Path, absFilePath())
AddNumberProperty(Size, fileInfo().size())
AddProperty(Extension, fileInfo().extension(false))
AddProperty(Extension, fileInfo().suffix())
static QString resolveSymLinks(const QFileInfo &file) // static
{
char real[PATH_MAX];
if(file.exists() && realpath(QFile::encodeName(file.absFilePath()).data(), real))
if(file.exists() && realpath(QFile::encodeName(file.absoluteFilePath()).data(), real))
return QFile::decodeName(real);
else
return file.filePath();
......@@ -170,7 +170,7 @@ CoverInfo *FileHandle::coverInfo() const
QString FileHandle::absFilePath() const
{
if(d->absFilePath.isNull())
d->absFilePath = resolveSymLinks(d->fileInfo.absFilePath());
d->absFilePath = resolveSymLinks(d->fileInfo.absoluteFilePath());
return d->absFilePath;
}
......@@ -262,7 +262,7 @@ void FileHandle::setup(const QFileInfo &info, const QString &path)
if(d && !isNull())
return;
QString fileName = path.isNull() ? info.absFilePath() : path;
QString fileName = path.isNull() ? info.absoluteFilePath() : path;
FileHandle cached = Cache::instance()->value(resolveSymLinks(fileName));
......
......@@ -47,6 +47,7 @@
#include <QLayout>
#include <qsignalmapper.h>
#include <q3header.h>
#include <qpalette.h>
#include <QPixmap>
#include <Q3Frame>
......@@ -92,8 +93,8 @@ public:
QMap<QString, QString>::ConstIterator it = files.begin();
for(; it != files.end(); ++it) {
K3ListViewItem *i = it.key() != it.data()
? new K3ListViewItem(lv, it.key(), it.data())
K3ListViewItem *i = it.key() != it.value()
? new K3ListViewItem(lv, it.key(), it.value())
: new K3ListViewItem(lv, it.key(), i18n("No Change"));
lvHeight += i->height();
}
......@@ -240,7 +241,9 @@ FileRenamerWidget::FileRenamerWidget(QWidget *parent) :
m_exampleFromFile(false)
{
QLabel *temp = new QLabel(0);
m_exampleText->setPaletteBackgroundColor(temp->paletteBackgroundColor());
QPalette palette;
palette.setColor(m_exampleText->backgroundRole(), temp->palette().color(backgroundRole()));
m_exampleText->setPalette(palette);
delete temp;
#warning Repair this.
......@@ -291,7 +294,7 @@ void FileRenamerWidget::loadConfig()
QString path = config.readEntry("MusicFolder", "${HOME}/music");
m_musicFolder->setPath(path);
m_separator->setCurrentText(config.readEntry("Separator", " - "));
m_separator->setItemText(m_separator->currentIndex(), config.readEntry("Separator", " - "));
}
void FileRenamerWidget::saveConfig()
......@@ -324,8 +327,8 @@ FileRenamerWidget::~FileRenamerWidget()
int FileRenamerWidget::addRowCategory(TagType category)
{
static QPixmap up = SmallIcon("up");
static QPixmap down = SmallIcon("down");
static QIcon up = SmallIcon("up");
static QIcon down = SmallIcon("down");
// Find number of categories already of this type.
int categoryCount = 0;
......@@ -340,7 +343,9 @@ int FileRenamerWidget::addRowCategory(TagType category)
int id = row.position;
Q3HBox *frame = new Q3HBox(m_mainFrame);
frame->setPaletteBackgroundColor(frame->paletteBackgroundColor().dark(110));
QPalette palette;
palette.setColor(frame->backgroundRole(), frame->palette().color(backgroundRole()).dark(110));
frame->setPalette(palette);
row.widget = frame;
frame->setFrameShape(Q3Frame::Box);
......@@ -356,8 +361,8 @@ int FileRenamerWidget::addRowCategory(TagType category)
row.upButton = new KPushButton(buttons);
row.downButton = new KPushButton(buttons);
row.upButton->setPixmap(up);
row.downButton->setPixmap(down);
row.upButton->setIcon(up);
row.downButton->setIcon(down);
row.upButton->setFlat(true);
row.downButton->setFlat(true);
......@@ -494,10 +499,14 @@ void FileRenamerWidget::createTagRows()
m_rows.reserve(categoryOrder.count());
m_folderSwitches.reserve(categoryOrder.count() - 1);
mapper = new QSignalMapper(this, "signal mapper");
toggleMapper = new QSignalMapper(this, "toggle mapper");
upMapper = new QSignalMapper(this, "up button mapper");
downMapper = new QSignalMapper(this, "down button mapper");
mapper = new QSignalMapper(this);
mapper->setObjectName("signal mapper");
toggleMapper = new QSignalMapper(this);
toggleMapper->setObjectName("toggle mapper");
upMapper = new QSignalMapper(this);
upMapper->setObjectName("up button mapper");
downMapper = new QSignalMapper(this);
downMapper->setObjectName("down button mapper");
connect(mapper, SIGNAL(mapped(int)), SLOT(showCategoryOption(int)));
connect(toggleMapper, SIGNAL(mapped(int)), SLOT(slotRemoveRow(int)));
......@@ -693,13 +702,13 @@ void FileRenamerWidget::moveItem(int id, MovementDirection direction)
return;
#warning double check if that still works with Qt4s layout
layout->remove(l);
layout->removeWidget(l);
layout->insertWidget(2 * newPos, l);
// Move the top item two spaces in the opposite direction, for a similar
// reason.
layout->remove(w);
layout->removeWidget(w);
layout->insertWidget(2 * pos, w);
layout->invalidate();
......@@ -868,7 +877,7 @@ void FileRenamer::rename(const PlaylistItemList &items)
for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it) {
reader.setPlaylistItem(*it);
QString oldFile = (*it)->file().absFilePath();
QString extension = (*it)->file().fileInfo().extension(false);
QString extension = (*it)->file().fileInfo().suffix();
QString newFile = fileName(reader) + '.' + extension;
if(oldFile != newFile) {
......@@ -884,14 +893,14 @@ void FileRenamer::rename(const PlaylistItemList &items)
for(QMap<QString, QString>::ConstIterator it = map.begin();
it != map.end(); ++it)
{
if(moveFile(it.key(), it.data())) {
itemMap[it.key()]->setFile(it.data());
if(moveFile(it.key(), it.value())) {
itemMap[it.key()]->setFile(it.value());
itemMap[it.key()]->refresh();
setFolderIcon(it.data(), itemMap[it.key()]);
setFolderIcon(it.value(), itemMap[it.key()]);
}
else
errorFiles << i18n("%1 to %2", it.key(), it.data());
errorFiles << i18n("%1 to %2", it.key(), it.value());
processEvents();
}
......@@ -909,8 +918,8 @@ bool FileRenamer::moveFile(const QString &src, const QString &dest)
return false;
// Escape URL.
KUrl srcURL = KUrl::fromPathOrUrl(src);
KUrl dstURL = KUrl::fromPathOrUrl(dest);
KUrl srcURL = KUrl(src);
KUrl dstURL = KUrl(dest);
// Clean it.
srcURL.cleanPath();
......@@ -948,7 +957,7 @@ void FileRenamer::setFolderIcon(const KUrl &dst, const PlaylistItem *item)
// Split path, and go through each path element. If a path element has
// the album information, set its folder icon.
QStringList elements = QStringList::split("/", dstURL.directory());
QStringList elements = dstURL.directory().split("/", QString::SkipEmptyParts);
QString path;
for(QStringList::ConstIterator it = elements.begin(); it != elements.end(); ++it) {
......
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>FileRenamerTagOptionsBase</class>
<widget class="QWidget" name="FileRenamerTagOptionsBase" >
<property name="geometry" >
......@@ -17,22 +14,19 @@
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>11</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="Q3GroupBox" name="m_tagFormatGroup" >
<widget class="QGroupBox" name="m_tagFormatGroup" >
<property name="title" >
<string>%1 Format</string>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>11</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
......@@ -138,16 +132,13 @@
</widget>
</item>
<item>
<widget class="Q3ButtonGroup" name="m_emptyTagGroup" >
<widget class="QGroupBox" name="m_emptyTagGroup" >
<property name="title" >
<string>When the Track's %1 is Empty</string>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>11</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
......@@ -200,16 +191,13 @@
</widget>
</item>
<item>
<widget class="Q3GroupBox" name="m_trackGroup" >
<widget class="QGroupBox" name="m_trackGroup" >
<property name="title" >
<string>Track Width Options</string>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<string>GroupBox</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>11</number>
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
......@@ -339,8 +327,8 @@
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>0</height>
<width>546</width>
<height>16</height>
</size>
</property>
</spacer>
......@@ -349,22 +337,6 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>Q3ButtonGroup</class>
<extends></extends>
<header>Qt3Support/Q3ButtonGroup</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
<customwidget>
<class>Q3GroupBox</class>
<extends></extends>
<header>Qt3Support/Q3GroupBox</header>
<container>1</container>
<pixmap></pixmap>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
......@@ -30,7 +30,7 @@
#include "googlefetcher.h"
#include "googlefetcherdialog.h"
#include "tag.h"
//Added by qt3to4:
#include <QPixmap>
GoogleImage::GoogleImage(QString thumbURL, QString size) :
......@@ -224,9 +224,9 @@ QPixmap GoogleFetcher::pixmap()
void GoogleFetcher::displayWaitMessage()
{
KStatusBar *statusBar = static_cast<KMainWindow *>(kapp->mainWidget())->statusBar();
statusBar->message(i18n("Searching for Images. Please Wait..."));
statusBar->showMessage(i18n("Searching for Images. Please Wait..."));
slotLoadImageURLs();
statusBar->clear();
statusBar->clearMessage();
}
bool GoogleFetcher::requestNewSearchTerms(bool noResults)
......
......@@ -73,7 +73,8 @@ void HistoryPlaylist::slotAddPlaying()
{
m_file = PlayerManager::instance()->playingFile();
m_timer->stop();
m_timer->start(delay(), true);
m_timer->setSingleShot(true);
m_timer->start(delay());
}
void HistoryPlaylist::slotCreateNewItem()
......
......@@ -26,7 +26,7 @@
#include <q3cstring.h>
#include <QMap>
//Added by qt3to4:
#include <Q3ValueList>
#include "k3bexporter.h"
......@@ -90,7 +90,7 @@ class PlaylistAction : public KAction
// Invoke the slot using some trickery.
// XXX: Use the QMetaObject to do this in Qt 4.
connect(this, SIGNAL(activated()), recipient, m_slot);
emit(activated());
emit(QAction::triggered());
disconnect(this, SIGNAL(activated()), recipient, m_slot);
}
......
......@@ -84,8 +84,6 @@ int main(int argc, char *argv[])
JuK *juk = new JuK;
//a.dcopClient()->resume();
a.setMainWidget(juk);
bool startDocked;
KConfigGroup config(KGlobal::config(), "Settings");
......
......@@ -156,7 +156,7 @@ QStringList MediaFiles::convertURLsToLocal(const QStringList &urlList, QWidget *
KUrl localUrl;
for(QStringList::ConstIterator it = urlList.constBegin(); it != urlList.constEnd(); ++it) {
localUrl = KIO::NetAccess::mostLocalUrl(KUrl::fromPathOrUrl(*it), w);
localUrl = KIO::NetAccess::mostLocalUrl(KUrl(*it), w);
if(!localUrl.isLocalFile())
kDebug(65432) << localUrl << " is not a local file, skipping.\n";
......
......@@ -15,6 +15,7 @@
#include "musicbrainzquery.h"
#ifdef HAVE_TUNEPIMP // Silence warning when HAVE_TUNEPIMP is not defined.
#if HAVE_TUNEPIMP
#include "trackpickerdialog.h"
......@@ -119,6 +120,7 @@ void MusicBrainzLookup::confirmation()
}
}
#endif
#endif
// vim: set et sw=4 tw=0 sta:
......@@ -115,9 +115,10 @@ void NowPlaying::slotUpdate()
////////////////////////////////////////////////////////////////////////////////
CoverItem::CoverItem(NowPlaying *parent) :
QLabel(parent, "CoverItem"),
QLabel(parent),
NowPlayingItem(parent)
{
setObjectName("CoverItem");
setFixedHeight(parent->height() - parent->layout()->margin() * 2);
setFrameStyle(Box | Plain);
setLineWidth(1);
......@@ -182,7 +183,7 @@ void CoverItem::mouseMoveEvent(QMouseEvent *e)
void CoverItem::dragEnterEvent(QDragEnterEvent *e)
{
e->accept(Q3ImageDrag::canDecode(e) || K3URLDrag::canDecode(e) || CoverDrag::canDecode(e));
e->setAccepted(Q3ImageDrag::canDecode(e) || K3URLDrag::canDecode(e) || CoverDrag::canDecode(e));
}
void CoverItem::dropEvent(QDropEvent *e)
......@@ -339,7 +340,8 @@ void HistoryItem::update(const FileHandle &file)
m_file = file;
m_timer->stop();
m_timer->start(HistoryPlaylist::delay(), true);
m_timer->setSingleShot(true);
m_timer->start(HistoryPlaylist::delay());
}
void HistoryItem::openLink(const QString &link)
......
......@@ -117,6 +117,7 @@ private:
* A link label that doesn't automatically open Konqueror.
*/
#warning port KActiveLabel to QLabel and see where LinkLabel is used in Juk.
class LinkLabel : public KActiveLabel
{
public:
......
......@@ -387,7 +387,7 @@ Playlist::Playlist(PlaylistCollection *collection, const QFileInfo &playlistFile
m_widthsDirty(true),
m_searchEnabled(true),
m_lastSelected(0),
m_fileName(playlistFile.absFilePath()),
m_fileName(playlistFile.absoluteFilePath()),
m_rmbMenu(0),
m_toolTip(0),
m_blockDataChanged(false)
......@@ -928,7 +928,7 @@ void Playlist::slotWeightDirty(int column)
return;
}
if(m_weightDirty.find(column) == m_weightDirty.end())
if(!m_weightDirty.contains(column))
m_weightDirty.append(column);
}
......@@ -1020,6 +1020,7 @@ void Playlist::removeFromDisk(const PlaylistItemList &items)
}
}
#warning Port Q3DragObject to QMimeData
Q3DragObject *Playlist::dragObject(QWidget *parent)
{
PlaylistItemList items = selectedItems();
......@@ -1124,7 +1125,7 @@ bool Playlist::eventFilter(QObject *watched, QEvent *e)
switch(e->type()) {
case QEvent::MouseMove:
{
if((static_cast<QMouseEvent *>(e)->state() & Qt::LeftButton) == Qt::LeftButton &&
if((static_cast<QMouseEvent *>(e)->modifiers() & Qt::LeftButton) == Qt::LeftButton &&
!action<KToggleAction>("resizeColumnsManually")->isChecked())
{
m_columnWidthModeChanged = true;
......@@ -1385,14 +1386,14 @@ void Playlist::addFiles(const QStringList &files, PlaylistItem *after)
void Playlist::refreshAlbums(const PlaylistItemList &items, coverKey id)
{
Q3ValueList< QPair<QString, QString> > albums;
QList< QPair<QString, QString> > albums;
bool setAlbumCovers = items.count() == 1;
for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it) {
QString artist = (*it)->file().tag()->artist();
QString album = (*it)->file().tag()->album();
if(albums.find(qMakePair(artist, album)) == albums.end())
if(!albums.contains(qMakePair(artist, album)))
albums.append(qMakePair(artist, album));
(*it)->file().coverInfo()->setCoverId(id);
......@@ -1400,7 +1401,7 @@ void Playlist::refreshAlbums(const PlaylistItemList &items, coverKey id)
(*it)->file().coverInfo()->applyCoverToWholeAlbum(true);
}
for(Q3ValueList< QPair<QString, QString> >::ConstIterator it = albums.begin();
for(QList< QPair<QString, QString> >::ConstIterator it = albums.begin();
it != albums.end(); ++it)
{
refreshAlbum((*it).first, (*it).second);
......@@ -1444,6 +1445,7 @@ void Playlist::refreshAlbum(const QString &artist, const QString &album)
void Playlist::hideColumn(int c, bool updateSearch)
{
#warning Port to QAction
m_headerMenu->setItemChecked(c, false);
if(!isColumnVisible(c))
......@@ -1631,7 +1633,7 @@ void Playlist::slotPopulateBackMenu() const
if(!playingItem())
return;
KMenu *menu = action<KToolBarPopupAction>("back")->popupMenu();
QMenu *menu = action<KToolBarPopupAction>("back")->menu();
menu->clear();
m_backMenuItems.clear();
......@@ -1686,20 +1688,20 @@ void Playlist::loadFile(const QString &fileName, const QFileInfo &fileInfo)
m_blockDataChanged = true;
while(!stream.atEnd()) {
QString itemName = stream.readLine().stripWhiteSpace();
QString itemName = stream.readLine().trimmed();
QFileInfo item(itemName);
if(item.isRelative())
item.setFile(QDir::cleanDirPath(fileInfo.dirPath(true) + '/' + itemName));
item.setFile(QDir::cleanPath(fileInfo.absolutePath() + '/' + itemName));
if(item.exists() && item.isFile() && item.isReadable() &&
MediaFiles::isMediaFile(item.fileName()))
{
if(after)
after = createItem(FileHandle(item, item.absFilePath()), after, false);
after = createItem(FileHandle(item, item.absoluteFilePath()), after, false);
else
after = createItem(FileHandle(item, item.absFilePath()), 0, false);
after = createItem(FileHandle(item, item.absoluteFilePath()), 0, false);
}
}
......@@ -1738,7 +1740,7 @@ void Playlist::setPlaying(PlaylistItem *item, bool addToHistory)
item->setPlaying(true);
bool enableBack = !m_history.isEmpty();
action<KToolBarPopupAction>("back")->popupMenu()->setEnabled(enableBack);
action<KToolBarPopupAction>("back")->menu()->setEnabled(enableBack);
}
bool Playlist::playing() const
......@@ -1822,20 +1824,20 @@ void Playlist::addFile(const QString &file, FileHandleList &files, bool importPl
}
const QFileInfo fileInfo = QDir::cleanDirPath(file);
const QFileInfo fileInfo = QDir::cleanPath(file);
if(!fileInfo.exists())
return;
if(fileInfo.isFile() && fileInfo.isReadable()) {