Apply clang-format

This commit is contained in:
Martchus 2019-07-20 20:20:58 +02:00
parent 675a5d5d92
commit 4896084e20
62 changed files with 78 additions and 76 deletions

View File

@ -70,4 +70,4 @@ QJsonObject loadJsonObjectFromResource(const QString &resource, QString *error)
return QJsonObject();
}
}
} // namespace Application

View File

@ -8,6 +8,6 @@ namespace Application {
int substring(const QString &source, QString &target, int startIndex, const QString &startStr, const QString &endStr);
void replaceHtmlEntities(QString &text);
QJsonObject loadJsonObjectFromResource(const QString &resource, QString *error = nullptr);
}
} // namespace Application
#endif // STATIC_H

View File

@ -82,4 +82,4 @@ void CliDownloadInteraction::downloadHasSslErrors(Download *download, size_t opt
// TODO
}
}
}
} // namespace Cli

View File

@ -32,6 +32,6 @@ private slots:
void downloadRequiresAuthentication(Network::Download *download, size_t optionIndex, const QString &realm);
void downloadHasSslErrors(Network::Download *download, size_t optionIndex, const QList<QSslError> &sslErrors);
};
}
} // namespace Cli
#endif // CLI_DOWNLOADINTERACTION_H

View File

@ -35,7 +35,7 @@ void download(int argc, char *argv[], const ArgumentOccurrence &, const Argument
size_t specifiedDownloads = 0;
for (const auto &val : urlsArg.values()) {
// check whether value denotes target directory or download type
auto parts = splitString<vector<string> >(val, "=", EmptyPartsTreat::Keep, 2);
auto parts = splitString<vector<string>>(val, "=", EmptyPartsTreat::Keep, 2);
if (parts.size() >= 2) {
if (parts.front() == "type") {
// value denotes download type
@ -116,4 +116,4 @@ void download(int argc, char *argv[], const ArgumentOccurrence &, const Argument
cout << "TODO" << endl;
}
}
}
} // namespace Cli

View File

@ -6,7 +6,7 @@
namespace CppUtilities {
class Argument;
class ArgumentOccurrence;
}
} // namespace CppUtilities
namespace Cli {

View File

@ -236,4 +236,4 @@ void AddDownloadDialog::setLastUrl()
settings.setValue("lasturl", m_lastUrl);
settings.endGroup();
}
}
} // namespace QtGui

View File

@ -47,6 +47,6 @@ private:
QInputDialog *m_selectDownloadTypeInputDialog;
QString m_lastUrl;
};
}
} // namespace QtGui
#endif // ADDDOWNLOADDIALOG_H

View File

@ -402,4 +402,4 @@ QList<Download *> AddMultipleDownloadsWizard::results() const
{
return qobject_cast<AddMultipleDownloadsResultsPage *>(page(AddMultipleDownloadsResultsPageId))->results();
}
}
} // namespace QtGui

View File

@ -16,7 +16,7 @@ class ClearLineEdit;
namespace Network {
class Download;
class DownloadFinder;
}
} // namespace Network
namespace QtGui {
@ -111,6 +111,6 @@ public:
DownloadSource source() const;
QList<Network::Download *> results() const;
};
}
} // namespace QtGui
#endif // ADDMULTIPLEDOWNLOADSWIZARD_H

View File

@ -164,7 +164,8 @@ void DownloadInteraction::downloadRequiresRedirectionPermission(Download *downlo
const QUrl &newUrl = download->downloadUrl(optionIndex);
QString message = tr(
"<p>Do you want to redirect form <i>%1</i> to <i>%2</i>?</p><p>The redirection URL will be added to the options so you can it select "
"later, too.</p>").arg(originalUrl.toString(), newUrl.toString());
"later, too.</p>")
.arg(originalUrl.toString(), newUrl.toString());
QMessageBox *dlg = new QMessageBox(m_parentWidget);
dlg->setModal(false);
dlg->setTextFormat(Qt::RichText);
@ -246,4 +247,4 @@ void DownloadInteraction::downloadHasSslErrors(Download *download, size_t option
connect(download, &Download::destroyed, dlg, &QMessageBox::deleteLater);
dlg->show();
}
}
} // namespace QtGui

View File

@ -35,6 +35,6 @@ private slots:
private:
QWidget *m_parentWidget;
};
}
} // namespace QtGui
#endif // DOWNLOADINTERACTION_H

View File

@ -5,8 +5,8 @@
#include <QMessageBox>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QStylePainter>
#include <QStyleOption>
#include <QStylePainter>
namespace QtGui {
@ -29,4 +29,4 @@ void DownloadWidget::paintEvent(QPaintEvent *)
option.backgroundColor = palette().color(QPalette::Highlight);
painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
}
}
} // namespace QtGui

View File

@ -23,6 +23,6 @@ private:
std::unique_ptr<Ui::DownloadWidget> m_ui;
};
}
} // namespace QtGui
#endif // DOWNLOADWIDGET_H

View File

@ -43,4 +43,4 @@ int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs)
return 0;
#endif
}
}
} // namespace QtGui

View File

@ -295,8 +295,9 @@ void MainWindow::settingsAccepted()
void MainWindow::showTrayIconMessage()
{
m_trayIcon->showMessage(windowTitle(), tr("The downloader will keep running in the system tray. To terminate the program, "
"choose \"Quit\" in the context menu of the system tray entry."));
m_trayIcon->showMessage(windowTitle(),
tr("The downloader will keep running in the system tray. To terminate the program, "
"choose \"Quit\" in the context menu of the system tray entry."));
}
void MainWindow::checkForDownloadsToStartAutomatically()
@ -921,4 +922,4 @@ void MainWindow::setupTrayIcon()
#endif
#endif
}
}
} // namespace QtGui

View File

@ -119,6 +119,6 @@ private:
SettingsDialog *m_settingsDlg;
QtUtilities::AboutDialog *m_aboutDlg;
};
}
} // namespace QtGui
#endif // MAINWINDOW_H

View File

@ -46,4 +46,4 @@ void SetRangeDialog::confirm()
QMessageBox::warning(this, this->windowTitle(), tr("Values are invalid."));
}
}
}
} // namespace QtGui

View File

@ -29,6 +29,6 @@ private:
std::unique_ptr<Ui::SetRangeDialog> m_ui;
Network::DownloadRange &m_range;
};
}
} // namespace QtGui
#endif // SETRANGEDIALOG_H

View File

@ -481,9 +481,9 @@ void restoreSettings()
UiPage::multiSelection() = settings.value("multiselection").toBool();
// load grooveshark authentication file
const auto errorMsg = QApplication::translate(
"QtGui::Settings", "Unable to read Grooveshark authentication information file.\n\nReason: %1\n\nThe values stored in this file are required "
"when connection to Grooveshark. Built-in will values be used instead, but these might be deprecated.");
const auto errorMsg = QApplication::translate("QtGui::Settings",
"Unable to read Grooveshark authentication information file.\n\nReason: %1\n\nThe values stored in this file are required "
"when connection to Grooveshark. Built-in will values be used instead, but these might be deprecated.");
const auto groovesharkAuthenticationFile
= ConfigFile::locateConfigFile(QStringLiteral(PROJECT_NAME), QStringLiteral("json/groovesharkauthenticationinfo.json"), &settings);
QString reason;
@ -536,7 +536,7 @@ void applySettingsToDownload(Download *download)
download->setCustomUserAgent(UserAgentPage::useCustomUserAgent() ? UserAgentPage::customUserAgent() : QString());
download->setProxy(ProxyPage::proxy());
}
}
} // namespace QtGui
INSTANTIATE_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, TargetPage)
INSTANTIATE_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, ProxyPage)

View File

@ -86,7 +86,7 @@ QtUtilities::QtSettings &qtSettings();
void restoreSettings();
void saveSettings();
void applySettingsToDownload(Network::Download *download);
}
} // namespace QtGui
DECLARE_EXTERN_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, TargetPage)
DECLARE_EXTERN_UI_FILE_BASED_OPTION_PAGE_NS(QtGui, ProxyPage)

View File

@ -72,4 +72,4 @@ void ComboBoxItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
{
QStyledItemDelegate::paint(painter, option, index);
}
}
} // namespace QtGui

View File

@ -30,4 +30,4 @@ void ProgressBarItemDelegate::paint(QPainter *painter, const QStyleOptionViewIte
// draw the progress bar onto the view.
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
}
}
} // namespace QtGui

View File

@ -183,4 +183,4 @@ void DownloadFinderResultsModel::downloadChangedStatus(Download *download)
}
}
}
}
} // namespace QtGui

View File

@ -10,7 +10,7 @@ class TimeSpan;
namespace Network {
class Download;
class DownloadFinder;
}
} // namespace Network
namespace QtGui {
@ -82,6 +82,6 @@ constexpr int DownloadFinderResultsModel::lastColumn()
{
return idColumn();
}
}
} // namespace QtGui
#endif // DOWNLOADFINDERRESULTSMODEL_H

View File

@ -332,4 +332,4 @@ QString DownloadModel::progressString(Download *download)
}
return QString();
}
}
} // namespace QtGui

View File

@ -100,6 +100,6 @@ constexpr int DownloadModel::lastColumn()
{
return progressColumn();
}
}
} // namespace QtGui
#endif // DOWNLOADMODEL_H

View File

@ -19,7 +19,7 @@ public:
const QString &userName() const;
const QString &password() const;
const QList<QMap<QString, QVariant> > options() const;
const QList<QMap<QString, QVariant>> options() const;
bool isIncomplete() const;
void clear();
@ -27,7 +27,7 @@ private:
bool m_requested;
QString m_userName;
QString m_password;
QList<QMap<QString, QVariant> > m_options;
QList<QMap<QString, QVariant>> m_options;
};
inline AuthenticationCredentials::AuthenticationCredentials()
@ -52,7 +52,7 @@ inline const QString &AuthenticationCredentials::password() const
return m_password;
}
inline const QList<QMap<QString, QVariant> > AuthenticationCredentials::options() const
inline const QList<QMap<QString, QVariant>> AuthenticationCredentials::options() const
{
return m_options;
}
@ -68,6 +68,6 @@ inline void AuthenticationCredentials::clear()
m_password.clear();
m_options.clear();
}
}
} // namespace Network
#endif // AUTHENTICATIONCREDENTIALS

View File

@ -50,4 +50,4 @@ void BitshareDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer
reportInitiated(false, tr("The stream url couldn't be found."));
}
}
}
} // namespace Network

View File

@ -20,6 +20,6 @@ protected:
private:
QByteArray m_postData;
};
}
} // namespace Network
#endif // BITSHAREDOWNLOAD_H

View File

@ -1247,4 +1247,4 @@ void Download::setIgnoreSslErrorsPermission(size_t optionIndex, PermissionStatus
*
* To be implemented when subclassing.
*/
}
} // namespace Network

View File

@ -992,6 +992,6 @@ inline AuthenticationCredentials &Download::initialAuthenticationCredentials()
{
return m_initAuthData;
}
}
} // namespace Network
#endif // DOWNLOAD_H

View File

@ -83,4 +83,4 @@ bool DownloadRange::setEndOffset(qint64 value)
}
return true;
}
}
} // namespace Network

View File

@ -92,6 +92,6 @@ inline void DownloadRange::setUsedForWritingOutput(bool value)
{
m_useForWritingOutput = value;
}
}
} // namespace Network
#endif // DOWNLOADRANGE_H

View File

@ -110,4 +110,4 @@ QString FileNukeDownload::typeName() const
{
return tr("FileNuke");
}
}
} // namespace Network

View File

@ -22,6 +22,6 @@ private:
QByteArray m_postData;
QUrl m_playlistUrl;
};
}
} // namespace Network
#endif // FILENUKE_H

View File

@ -239,4 +239,4 @@ void DownloadFinder::emitNewResultsSignal()
*
* Needs to be implemented when subclassing.
*/
}
} // namespace Network

View File

@ -180,6 +180,6 @@ inline void DownloadFinder::emitFinishedSignal(bool success, const QString &reas
m_finished = true;
emit finished(success, reason);
}
}
} // namespace Network
#endif // VIDEOFINDER_H

View File

@ -219,4 +219,4 @@ DownloadFinder::ParsingResult GroovesharkSearcher::parseResults(const QByteArray
return ParsingResult::Error;
}
}
}
} // namespace Network

View File

@ -64,6 +64,6 @@ inline bool GroovesharkSearcher::verified() const
{
return m_verified;
}
}
} // namespace Network
#endif // GROOVESHARKALBUM_H

View File

@ -94,4 +94,4 @@ DownloadFinder::ParsingResult LinkFinder::parseResults(const QByteArray &data, Q
}
return DownloadFinder::ParsingResult::Success;
}
}
} // namespace Network

View File

@ -21,6 +21,6 @@ protected slots:
private:
QUrl m_url;
};
}
} // namespace Network
#endif // LINKFINDER_H

View File

@ -113,4 +113,4 @@ YoutubePlaylist::ParsingResult YoutubePlaylist::parseResults(const QByteArray &d
return ParsingResult::Error;
}
}
}
} // namespace Network

View File

@ -20,6 +20,6 @@ protected slots:
private:
QString m_playlistId;
};
}
} // namespace Network
#endif // YOUTUBEPLAYLIST_H

View File

@ -483,4 +483,4 @@ QString GroovesharkDownload::typeName() const
{
return tr("Grooveshark");
}
}
} // namespace Network

View File

@ -77,7 +77,7 @@ private:
GroovesharkRequestType m_requestType;
QVariant m_requestData;
};
}
} // namespace Network
Q_DECLARE_METATYPE(Network::GroovesharkGetSongsRequestData)

View File

@ -290,4 +290,4 @@ void HttpDownload::slotDownloadProgress(qint64 bytesReceived, qint64 bytesToRece
reportDownloadProgressUpdate(optionIndex, bytesReceived, bytesToReceive);
}
}
}
} // namespace Network

View File

@ -158,7 +158,7 @@ inline QString HttpDownload::rawCookies() const
*/
inline QList<QNetworkCookie> HttpDownload::cookies() const
{
return m_setCookie.isValid() ? qvariant_cast<QList<QNetworkCookie> >(m_setCookie) : QList<QNetworkCookie>();
return m_setCookie.isValid() ? qvariant_cast<QList<QNetworkCookie>>(m_setCookie) : QList<QNetworkCookie>();
}
/*!
@ -225,6 +225,6 @@ inline QString HttpDownload::typeName() const
{
return initialUrl().scheme();
}
}
} // namespace Network
#endif // HTTPDOWNLOAD_H

View File

@ -92,4 +92,4 @@ void HttpDownloadWithInfoRequst::infoRequestChangedStatus(Download *download)
default:;
}
}
}
} // namespace Network

View File

@ -32,6 +32,6 @@ private:
std::unique_ptr<Download> m_infoDownload;
std::unique_ptr<QBuffer> m_infoBuffer;
};
}
} // namespace Network
#endif // HTTPDOWNLOADWITHINFOREQUST_H

View File

@ -129,4 +129,4 @@ const QMap<QString, QString> &ContentDispositionParser::data()
{
return m_data;
}
}
} // namespace Network

View File

@ -30,6 +30,6 @@ private:
bool m_attachment;
QMap<QString, QString> m_data;
};
}
} // namespace Network
#endif // CONTENTDISPOSITIONPHARSER_H

View File

@ -28,6 +28,6 @@ inline void usePermission(PermissionStatus &permission)
default:;
}
}
}
} // namespace Network
#endif // PERMISSIONSTATUS

View File

@ -135,4 +135,4 @@ void SockshareDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffe
reportInitiated(false, tr("Internal error."));
}
}
}
} // namespace Network

View File

@ -22,6 +22,6 @@ private:
QByteArray m_postData;
QUrl m_playlistUrl;
};
}
} // namespace Network
#endif // SOCKSHAREDOWNLOAD_H

View File

@ -150,4 +150,4 @@ void SpotifyDownload::evalVideoInformation(Download *, QBuffer *videoInfoBuffer)
}
}
}
}
} // namespace Network

View File

@ -35,6 +35,6 @@ private:
SpotifyRequestType m_currentRequest;
int m_triesToGetAuthenticationData;
};
}
} // namespace Network
#endif // SPOTIFYDOWNLOAD_H

View File

@ -69,4 +69,4 @@ void TestDownload::tick()
reportDownloadComplete(0);
}
}
}
} // namespace Network

View File

@ -27,6 +27,6 @@ private slots:
private:
QTimer m_timer;
};
}
} // namespace Network
#endif // TESTDOWNLOAD_H

View File

@ -51,7 +51,7 @@ Download *VimeoDownload::infoRequestDownload(bool &success, QString &reasonForFa
#if QT_VERSION >= 0x050400
.toString()
#endif
);
);
success = true;
return new HttpDownload(QUrl(QStringLiteral("https://player.vimeo.com/video/%1/config").arg(this->id())));
}

View File

@ -221,4 +221,4 @@ QString YoutubeDownload::typeName() const
{
return tr("YouTube");
}
}
} // namespace Network

View File

@ -29,6 +29,6 @@ private:
QStringList m_itags;
static QJsonObject m_itagInfo;
};
}
} // namespace Network
#endif // YOUTUBEDOWNLOAD_H