Commit 39eb5d3d authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Fix issues reported by krazy2all.

parent 27e871d3
This diff is collapsed.
......@@ -137,7 +137,7 @@ bool Kid3CliCompleter::updateParameterList(const char* buffer)
if (valuesIdx != -1) {
QStringList values =
valuesStr.mid(valuesIdx + 4).split(QLatin1String(" | "));
foreach (QString value, values) {
foreach (const QString& value, values) {
if (value.startsWith(QLatin1Char('"')) &&
value.endsWith(QLatin1Char('"'))) {
m_parameters.append(
......@@ -471,7 +471,7 @@ QList<QPersistentModelIndex> Kid3Cli::getSelection() const
{
QList<QPersistentModelIndex> selection;
if (QItemSelectionModel* selModel = m_app->getFileSelectionModel()) {
foreach (QModelIndex index, selModel->selectedIndexes()) {
foreach (const QModelIndex& index, selModel->selectedIndexes()) {
selection.append(QPersistentModelIndex(index));
}
}
......@@ -671,7 +671,7 @@ void Kid3Cli::printFileProxyModel(const FileProxyModel* model,
indexesWithChildren.append(idx);
}
writeLine(propsStr + indentStr + nameStr);
foreach (QModelIndex idx, indexesWithChildren) {
foreach (const QModelIndex& idx, indexesWithChildren) {
printFileProxyModel(model, idx, indent + 2);
}
}
......@@ -771,7 +771,7 @@ bool Kid3Cli::parseOptions()
}
/**
* Select files passed as command line arguments after the intial directory has
* Select files passed as command line arguments after the initial directory has
* been opened. Start execution of commands if existing.
* @param dirIndex file proxy model index of opened directory
* @param fileIndexes file proxy model indexes of selected files
......
......@@ -153,7 +153,7 @@ protected:
private slots:
/**
* Select files passed as command line arguments after the intial directory has
* Select files passed as command line arguments after the initial directory has
* been opened. Start execution of commands if existing.
* @param dirIndex file proxy model index of opened directory
* @param fileIndexes file proxy model indexes of selected files
......
......@@ -82,7 +82,7 @@ void KdeMainWindow::initActions()
impl(), SLOT(slotFileOpen()), actionCollection());
m_fileOpenRecent = KStandardAction::openRecent(
this,
SLOT(slotFileOpenRecentUrl(const KUrl&)),
SLOT(slotFileOpenRecentUrl(KUrl)),
actionCollection());
KAction* fileRevert = KStandardAction::revert(
app(), SLOT(revertFileModifications()), actionCollection());
......
......@@ -118,7 +118,7 @@ ConfigDialog::ConfigDialog(QWidget* parent, QString& caption,
m_applicationStyleComboBox->addItem(tr("Unknown"));
m_applicationStyleComboBox->addItems(QStyleFactory::keys());
connect(m_applicationFontButton, SIGNAL(clicked()), this, SLOT(slotSelectFont()));
connect(m_applicationStyleComboBox, SIGNAL(activated(const QString&)), this, SLOT(slotSelectStyle(const QString&)));
connect(m_applicationStyleComboBox, SIGNAL(activated(QString)), this, SLOT(slotSelectStyle(QString)));
connect(m_useApplicationFontCheckBox, SIGNAL(toggled(bool)), m_applicationFontButton, SLOT(setEnabled(bool)));
connect(m_useApplicationStyleCheckBox, SIGNAL(toggled(bool)), m_applicationStyleComboBox, SLOT(setEnabled(bool)));
vlayout->addLayout(fontStyleLayout);
......
......@@ -114,8 +114,8 @@ void Kid3MainWindow::initActions()
toolBar->addAction(fileOpen);
m_fileOpenRecent = new RecentFilesMenu(fileMenu);
connect(m_fileOpenRecent, SIGNAL(loadFile(const QString&)),
this, SLOT(slotFileOpenRecentDirectory(const QString&)));
connect(m_fileOpenRecent, SIGNAL(loadFile(QString)),
this, SLOT(slotFileOpenRecentDirectory(QString)));
m_fileOpenRecent->setStatusTip(tr("Opens a recently used directory"));
m_fileOpenRecent->setTitle(tr("Open &Recent"));
m_fileOpenRecent->setIcon(QCM_QIcon_fromTheme("document-open-recent"));
......
......@@ -190,7 +190,7 @@ signals:
private:
class ShortcutItem {
public:
ShortcutItem(QAction* act);
explicit ShortcutItem(QAction* act);
QAction* action() { return m_action; }
const QAction* action() const { return m_action; }
......@@ -225,7 +225,7 @@ private:
class ShortcutGroup : public QList<ShortcutItem> {
public:
ShortcutGroup(const QString& ctx);
explicit ShortcutGroup(const QString& ctx);
QString context() const { return m_context; }
......
......@@ -88,7 +88,7 @@ void NetworkConfig::readFromConfig(ISettings* config)
#ifdef Q_OS_WIN32
m_browser = config->value(QLatin1String("Browser"), QString()).toString();
if (m_browser.isEmpty()) {
m_browser = QString::fromLocal8Bit(::getenv("ProgramFiles"));
m_browser = QString::fromLocal8Bit(qgetenv("ProgramFiles"));
m_browser += QLatin1String("\\Internet Explorer\\IEXPLORE.EXE");
}
#else
......
......@@ -94,7 +94,7 @@ void UserActionsConfig::readFromConfig(ISettings* config)
if (cmdNr == 1) {
#ifdef Q_OS_WIN32
QString prgDir = QString::fromLocal8Bit(::getenv("ProgramFiles"));
QString prgDir = QString::fromLocal8Bit(qgetenv("ProgramFiles"));
m_contextMenuCommands.push_back(
UserActionsConfig::MenuCommand(
QLatin1String("Windows Media Player"),
......
......@@ -49,8 +49,8 @@ public:
* @param confirm true if confirmation required
* @param showOutput true if output of command shall be shown
*/
explicit MenuCommand(const QString& name = QString::null,
const QString& cmd = QString::null,
explicit MenuCommand(const QString& name = QString(),
const QString& cmd = QString(),
bool confirm = false, bool showOutput = false);
/**
......
......@@ -40,8 +40,8 @@ ImportClient::ImportClient(QNetworkAccessManager* netMgr) :
HttpClient(netMgr), m_requestType(RT_None)
{
setObjectName(QLatin1String("ImportClient"));
connect(this, SIGNAL(bytesReceived(const QByteArray&)),
this, SLOT(requestFinished(const QByteArray&)));
connect(this, SIGNAL(bytesReceived(QByteArray)),
this, SLOT(requestFinished(QByteArray)));
}
/**
......
......@@ -59,7 +59,7 @@ AudioPlayer::AudioPlayer(QObject* parent) : QObject(parent)
connect(m_mediaObject, SIGNAL(aboutToFinish()),
this, SLOT(aboutToFinish()));
connect(m_mediaObject, SIGNAL(currentSourceChanged(const Phonon::MediaSource&)),
connect(m_mediaObject, SIGNAL(currentSourceChanged(Phonon::MediaSource)),
this, SLOT(currentSourceChanged()));
#else
m_mediaPlayer = new QMediaPlayer(this);
......
......@@ -39,7 +39,7 @@ public:
* Constructor.
* @param parent parent widget
*/
DirList(QWidget* parent = 0);
explicit DirList(QWidget* parent = 0);
/**
* Destructor.
......
......@@ -35,8 +35,8 @@
DownloadClient::DownloadClient(QNetworkAccessManager* netMgr) :
HttpClient(netMgr), m_canceled(false)
{
connect(this, SIGNAL(bytesReceived(const QByteArray&)),
this, SLOT(requestFinished(const QByteArray&)));
connect(this, SIGNAL(bytesReceived(QByteArray)),
this, SLOT(requestFinished(QByteArray)));
}
/**
......
......@@ -53,7 +53,7 @@ public:
*
* @param parent parent widget
*/
OutputViewer(QWidget* parent);
explicit OutputViewer(QWidget* parent);
/**
* Destructor.
......
......@@ -41,7 +41,7 @@ FileProxyModel::FileProxyModel(QObject* parent) : QSortFilterProxyModel(parent),
m_iconProvider(new TaggedFileIconProvider), m_fsModel(0)
{
setObjectName(QLatin1String("FileProxyModel"));
connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)),
connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(updateInsertedRows(QModelIndex,int,int)));
}
......@@ -278,7 +278,7 @@ void FileProxyModel::setNameFilters(const QStringList& filters)
{
QRegExp wildcardRe(QLatin1String("\\.\\w+"));
QSet<QString> exts;
foreach (QString filter, filters) {
foreach (const QString& filter, filters) {
int pos = 0;
while ((pos = wildcardRe.indexIn(filter, pos)) != -1) {
int len = wildcardRe.matchedLength();
......
......@@ -101,7 +101,7 @@ QString FrameList::getSelectedName() const
{
const Frame* currentFrame =
m_frameTableModel->getFrameOfIndex(m_selectionModel->currentIndex());
return currentFrame ? currentFrame->getName() : QString::null;
return currentFrame ? currentFrame->getName() : QString();
}
/**
......
......@@ -51,7 +51,7 @@ public:
/**
* Destructor.
*/
~FrameList();
virtual ~FrameList();
/**
* Set tagged file.
......
......@@ -546,8 +546,8 @@ FrameTableLineEdit::FrameTableLineEdit(QWidget* parent) :
QLineEdit(parent)
{
setObjectName(QLatin1String("FrameTableLineEdit"));
connect(this, SIGNAL(textChanged(const QString&)),
this, SLOT(formatTextIfEnabled(const QString&)));
connect(this, SIGNAL(textChanged(QString)),
this, SLOT(formatTextIfEnabled(QString)));
}
/**
......
......@@ -309,7 +309,7 @@ public:
* Constructor.
* @param parent parent widget
*/
FrameTableLineEdit(QWidget* parent);
explicit FrameTableLineEdit(QWidget* parent);
/**
* Destructor.
......@@ -332,7 +332,7 @@ public:
* Constructor.
* @param parent parent QTableView
*/
FrameItemDelegate(QObject* parent) : QItemDelegate(parent) {
explicit FrameItemDelegate(QObject* parent) : QItemDelegate(parent) {
setObjectName(QLatin1String("FrameItemDelegate"));
}
......
......@@ -48,7 +48,7 @@ public:
*
* @param type type
*/
AttributeData(Type type)
explicit AttributeData(Type type)
{
m_type = type;
}
......@@ -58,7 +58,7 @@ public:
*
* @param name owner of Windows media PRIV frame
*/
AttributeData(const QString& name);
explicit AttributeData(const QString& name);
/**
* Destructor.
......
......@@ -5,6 +5,23 @@
* \b Project: Kid3
* \author Urs Fleisch
* \date 06 Jul 2008
*
* Copyright (C) 2008-2013 Urs Fleisch
*
* This file is part of Kid3.
*
* Kid3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Kid3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FORMATREPLACER_H
......
......@@ -517,7 +517,7 @@ void FrameCollection::addMissingStandardFrames()
i <= Frame::FT_LastFrame;
++i, mask <<= 1) {
if (s_quickAccessFrames & mask) {
Frame frame(static_cast<Frame::Type>(i), QString::null, QString::null, -1);
Frame frame(static_cast<Frame::Type>(i), QString(), QString(), -1);
FrameCollection::const_iterator it = find(frame);
if (it == end()) {
insert(frame);
......@@ -708,7 +708,7 @@ QString FrameCollection::getValue(Frame::Type type) const
{
Frame frame(type, QLatin1String(""), QLatin1String(""), -1);
const_iterator it = find(frame);
return it != end() ? it->getValue() : QString::null;
return it != end() ? it->getValue() : QString();
}
/**
......@@ -723,7 +723,7 @@ QString FrameCollection::getValue(Frame::Type type) const
QString FrameCollection::getValue(const Frame::ExtendedType& type) const
{
const_iterator it = findByExtendedType(type);
return it != end() ? it->getValue() : QString::null;
return it != end() ? it->getValue() : QString();
}
/**
......
......@@ -361,7 +361,7 @@ public:
/**
* Set frame inactive.
*/
void setInactive() { m_value = QString::null; }
void setInactive() { m_value = QString(); }
/**
* Check if frame represents different frames in multiple files.
......
......@@ -82,7 +82,7 @@ public:
*
* @param frame general frame
*/
PictureFrame(const Frame& frame);
explicit PictureFrame(const Frame& frame);
/**
* Destructor.
......
......@@ -99,7 +99,7 @@ void TaggedFile::setActiveTaggedFileFeatures(int features)
*/
QString TaggedFile::getTitleV1()
{
return QString::null;
return QString();
}
/**
......@@ -111,7 +111,7 @@ QString TaggedFile::getTitleV1()
*/
QString TaggedFile::getArtistV1()
{
return QString::null;
return QString();
}
/**
......@@ -123,7 +123,7 @@ QString TaggedFile::getArtistV1()
*/
QString TaggedFile::getAlbumV1()
{
return QString::null;
return QString();
}
/**
......@@ -135,7 +135,7 @@ QString TaggedFile::getAlbumV1()
*/
QString TaggedFile::getCommentV1()
{
return QString::null;
return QString();
}
/**
......@@ -171,7 +171,7 @@ int TaggedFile::getTrackNumV1()
*/
QString TaggedFile::getGenreV1()
{
return QString::null;
return QString();
}
/**
......@@ -746,7 +746,7 @@ void TaggedFile::deleteFramesV2(const FrameFilter& flt)
*/
QString TaggedFile::getTagFormatV1() const
{
return QString::null;
return QString();
}
/**
......@@ -758,7 +758,7 @@ QString TaggedFile::getTagFormatV1() const
*/
QString TaggedFile::getTagFormatV2() const
{
return QString::null;
return QString();
}
/**
......@@ -780,7 +780,7 @@ QString TaggedFile::checkTruncation(
return s;
} else {
m_truncation &= ~flag;
return QString::null;
return QString();
}
}
......
......@@ -240,8 +240,8 @@ bool CorePlatformTools::moveToTrash(const QString& path) const
QString topDir;
QString trashDir;
if (pathStat.st_dev == trashStat.st_dev) {
char* xdhEnv = ::getenv("XDG_DATA_HOME");
topDir = xdhEnv ? QString::fromLatin1(xdhEnv) : QDir::homePath() + QLatin1String("/.local/share");
QByteArray xdhEnv = qgetenv("XDG_DATA_HOME");
topDir = !xdhEnv.isEmpty() ? QString::fromLatin1(xdhEnv) : QDir::homePath() + QLatin1String("/.local/share");
trashDir = topDir + QLatin1String("/Trash");
} else if (!(findMountPoint(pathStat.st_dev, topDir) &&
findExtVolumeTrash(topDir, trashDir))) {
......
......@@ -80,7 +80,7 @@ void DebugUtils::dumpModel(const QAbstractItemModel& model,
indexesWithChildren.append(idx);
}
qDebug("%s", qPrintable(rowStr));
foreach (QModelIndex idx, indexesWithChildren) {
foreach (const QModelIndex& idx, indexesWithChildren) {
dumpModel(model, idx, indent + 2);
}
}
......
......@@ -55,7 +55,7 @@ void Utils::loadTranslation(const QString& lang)
// translation file for Qt
QTranslator* qtTr = new QTranslator(qApp);
foreach (QString localeName, languages) {
foreach (const QString& localeName, languages) {
if (
localeName.startsWith(QLatin1String("en")) ||
#if defined Q_OS_WIN32 || defined Q_OS_MAC
......@@ -76,7 +76,7 @@ void Utils::loadTranslation(const QString& lang)
// translation file for application strings
QTranslator* kid3Tr = new QTranslator(qApp);
foreach (QString localeName, languages) {
foreach (const QString& localeName, languages) {
if (
localeName.startsWith(QLatin1String("en")) ||
#ifdef CFG_TRANSLATIONSDIR
......
......@@ -49,7 +49,7 @@ public:
*
* @param parent parent widget
*/
BrowseCoverArtDialog(QWidget* parent);
explicit BrowseCoverArtDialog(QWidget* parent);
/**
* Destructor.
......
......@@ -46,7 +46,7 @@ public:
*
* @param parent parent widget
*/
FilterDialog(QWidget* parent);
explicit FilterDialog(QWidget* parent);
/**
* Destructor.
......
......@@ -25,7 +25,6 @@
*/
#include "importdialog.h"
#include "config.h"
#include <QLayout>
#include <QPushButton>
#include <QToolButton>
......@@ -47,6 +46,7 @@
#include <QDir>
#include <QMenu>
#include <QCoreApplication>
#include "config.h"
#include "genres.h"
#include "serverimporter.h"
#include "servertrackimporter.h"
......@@ -61,7 +61,6 @@
#include "frametablemodel.h"
#include "trackdatamatcher.h"
#include "qtcompatmac.h"
#include "config.h"
#include "iplatformtools.h"
namespace {
......@@ -126,8 +125,8 @@ ImportDialog::ImportDialog(IPlatformTools* platformTools,
#endif
m_trackDataTable->horizontalHeader()->setContextMenuPolicy(
Qt::CustomContextMenu);
connect(m_trackDataTable->verticalHeader(), SIGNAL(sectionMoved(int, int, int)),
this, SLOT(moveTableRow(int, int, int)));
connect(m_trackDataTable->verticalHeader(), SIGNAL(sectionMoved(int,int,int)),
this, SLOT(moveTableRow(int,int,int)));
connect(m_trackDataTable->horizontalHeader(),
SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(showTableHeaderContextMenu(QPoint)));
......@@ -524,9 +523,9 @@ void ImportDialog::moveTableRow(int, int fromIndex, int toIndex) {
QHeaderView* vHeader = qobject_cast<QHeaderView*>(sender());
if (vHeader) {
// revert movement, but avoid recursion
disconnect(vHeader, SIGNAL(sectionMoved(int, int, int)), 0, 0);
disconnect(vHeader, SIGNAL(sectionMoved(int,int,int)), 0, 0);
vHeader->moveSection(toIndex, fromIndex);
connect(vHeader, SIGNAL(sectionMoved(int, int, int)), this, SLOT(moveTableRow(int, int, int)));
connect(vHeader, SIGNAL(sectionMoved(int,int,int)), this, SLOT(moveTableRow(int,int,int)));
}
ImportTrackDataVector trackDataVector(m_trackDataModel->getTrackData());
int numTracks = static_cast<int>(trackDataVector.size());
......
......@@ -45,7 +45,7 @@ public:
*
* @param parent parent widget
*/
NumberTracksDialog(QWidget* parent);
explicit NumberTracksDialog(QWidget* parent);
/**
* Destructor.
......
......@@ -46,7 +46,7 @@ public:
*
* @param parent parent widget
*/
PlaylistDialog(QWidget* parent);
explicit PlaylistDialog(QWidget* parent);
/**
* Destructor.
......
......@@ -127,7 +127,7 @@ void RenDirDialog::setupMainPage(QWidget* page, QVBoxLayout* vlayout)
formatLayout->addWidget(formatLabel);
formatLayout->addWidget(m_formatComboBox);
connect(m_formatComboBox, SIGNAL(activated(int)), this, SLOT(slotUpdateNewDirname()));
connect(m_formatComboBox, SIGNAL(editTextChanged(const QString&)), this, SLOT(slotUpdateNewDirname()));
connect(m_formatComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(slotUpdateNewDirname()));
vlayout->addLayout(formatLayout);
QGridLayout* fromToLayout = new QGridLayout;
......
......@@ -138,22 +138,22 @@ ServerImportDialog::~ServerImportDialog()
void ServerImportDialog::setImportSource(ServerImporter* source)
{
if (m_source) {
disconnect(m_source, SIGNAL(progress(const QString&, int, int)),
this, SLOT(showStatusMessage(const QString&)));
disconnect(m_source, SIGNAL(findFinished(const QByteArray&)),
this, SLOT(slotFindFinished(const QByteArray&)));
disconnect(m_source, SIGNAL(albumFinished(const QByteArray&)),
this, SLOT(slotAlbumFinished(const QByteArray&)));
disconnect(m_source, SIGNAL(progress(QString,int,int)),
this, SLOT(showStatusMessage(QString)));
disconnect(m_source, SIGNAL(findFinished(QByteArray)),
this, SLOT(slotFindFinished(QByteArray)));
disconnect(m_source, SIGNAL(albumFinished(QByteArray)),
this, SLOT(slotAlbumFinished(QByteArray)));
}
m_source = source;
if (m_source) {
connect(m_source, SIGNAL(progress(const QString&, int, int)),
this, SLOT(showStatusMessage(const QString&)));
connect(m_source, SIGNAL(findFinished(const QByteArray&)),
this, SLOT(slotFindFinished(const QByteArray&)));
connect(m_source, SIGNAL(albumFinished(const QByteArray&)),
this, SLOT(slotAlbumFinished(const QByteArray&)));
connect(m_source, SIGNAL(progress(QString,int,int)),
this, SLOT(showStatusMessage(QString)));
connect(m_source, SIGNAL(findFinished(QByteArray)),
this, SLOT(slotFindFinished(QByteArray)));
connect(m_source, SIGNAL(albumFinished(QByteArray)),
this, SLOT(slotAlbumFinished(QByteArray)));
setWindowTitle(QCoreApplication::translate("@default", m_source->name()));
if (m_source->defaultServer()) {
......@@ -229,7 +229,7 @@ QString ServerImportDialog::getServer() const
}
return server;
} else {
return QString::null;
return QString();
}