Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
xiota committed Nov 20, 2023
1 parent 1b0dd1f commit 978757d
Show file tree
Hide file tree
Showing 276 changed files with 24,313 additions and 26,749 deletions.
113 changes: 57 additions & 56 deletions src/AboutDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,77 +25,78 @@ respects for all of the code used other than "OpenSSL".
*/

#include "AboutDlg.h"
#include "config.h"
#include "fatrat.h"

#include <QFile>
#include <QHeaderView>

extern QMap<QString,PluginInfo> g_plugins;

AboutDlg::AboutDlg(QWidget* parent) : QDialog(parent)
{
setupUi(this);

QStringList items;
items << "FatRat" << tr("License") << tr("Translations") << tr("3rd parties")
<< tr("Features") << tr("Plugins");

QIcon icon(":/fatrat/miscellaneous.png");
for(int i=0;i<items.size();i++)
{
QListWidgetItem* item = new QListWidgetItem(icon,items[i],listMenu);
listMenu->addItem(item);
}

labelVersion->setText(tr("Version %1").arg(VERSION));

loadFile(textLicense, "LICENSE");
loadFile(textTranslators, "TRANSLATIONS");
loadFile(text3rdParties, "README");

#include "config.h"
#include "fatrat.h"

extern QMap<QString, PluginInfo> g_plugins;

AboutDlg::AboutDlg(QWidget* parent) : QDialog(parent) {
setupUi(this);

QStringList items;
items << "FatRat" << tr("License") << tr("Translations") << tr("3rd parties")
<< tr("Features") << tr("Plugins");

QIcon icon(":/fatrat/miscellaneous.png");
for (int i = 0; i < items.size(); i++) {
QListWidgetItem* item = new QListWidgetItem(icon, items[i], listMenu);
listMenu->addItem(item);
}

labelVersion->setText(tr("Version %1").arg(VERSION));

loadFile(textLicense, "LICENSE");
loadFile(textTranslators, "TRANSLATIONS");
loadFile(text3rdParties, "README");

#ifdef WITH_NLS
checkFeatureNLS->setChecked(true);
checkFeatureNLS->setChecked(true);
#endif
#ifdef WITH_BITTORRENT
checkFeatureBitTorrent->setChecked(true);
checkFeatureBitTorrent->setChecked(true);
#endif
#ifdef WITH_DOCUMENTATION
checkFeatureDocumentation->setChecked(true);
checkFeatureDocumentation->setChecked(true);
#endif
#ifdef WITH_WEBINTERFACE
checkFeatureWebInterface->setChecked(true);
checkFeatureWebInterface->setChecked(true);
#endif
#ifdef WITH_JPLUGINS
checkFeatureJavaExtensions->setChecked(true);
checkFeatureJavaExtensions->setChecked(true);
#endif
processPlugins();
listMenu->setCurrentRow(0);

processPlugins();
listMenu->setCurrentRow(0);
}

void AboutDlg::processPlugins()
{
QString text;
for(QMap<QString,PluginInfo>::const_iterator it = g_plugins.constBegin();
it != g_plugins.constEnd(); it++)
{
text += tr("<b>%1</b><br>File name: %2<br>Author: %3<br>Web site: <a href=\"%4\">%4</a>")
.arg(it->name).arg(it.key()).arg(it->author).arg(it->website);
text += "<p>";
}
textPlugins->setHtml(text);
void AboutDlg::processPlugins() {
QString text;
for (QMap<QString, PluginInfo>::const_iterator it = g_plugins.constBegin();
it != g_plugins.constEnd(); it++) {
text += tr("<b>%1</b><br>File name: %2<br>Author: %3<br>Web site: <a "
"href=\"%4\">%4</a>")
.arg(it->name)
.arg(it.key())
.arg(it->author)
.arg(it->website);
text += "<p>";
}
textPlugins->setHtml(text);
}

void AboutDlg::loadFile(QTextEdit* edit, QString filename)
{
QFile file;
QString name;

name = DATA_LOCATION "/";
name += filename;

file.setFileName(name);
file.open(QIODevice::ReadOnly);

edit->setPlainText(QString::fromUtf8(file.readAll()));
void AboutDlg::loadFile(QTextEdit* edit, QString filename) {
QFile file;
QString name;

name = DATA_LOCATION "/";
name += filename;

file.setFileName(name);
file.open(QIODevice::ReadOnly);

edit->setPlainText(QString::fromUtf8(file.readAll()));
}
14 changes: 7 additions & 7 deletions src/AboutDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ respects for all of the code used other than "OpenSSL".
#define ABOUTDLG_H

#include <QDialog>

#include "ui_AboutDlg.h"

class AboutDlg : public QDialog, Ui_AboutDlg
{
Q_OBJECT
public:
AboutDlg(QWidget* parent);
void processPlugins();
static void loadFile(QTextEdit* edit, QString filename);
class AboutDlg : public QDialog, Ui_AboutDlg {
Q_OBJECT
public:
AboutDlg(QWidget* parent);
void processPlugins();
static void loadFile(QTextEdit* edit, QString filename);
};

#endif
39 changes: 19 additions & 20 deletions src/AppTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,39 @@ executables. You must obey the GNU General Public License in all
respects for all of the code used other than "OpenSSL".
*/

#include "config.h"
#include <QWidget>
#include <QList>
#include "AppTools.h"

#include <QList>
#include <QWidget>

#include "config.h"

#ifdef WITH_BITTORRENT
# ifdef HAVE_WEBENGINE
# include "tools/TorrentSearch.h"
# endif
# include "tools/CreateTorrentDlg.h"
#ifdef HAVE_WEBENGINE
#include "tools/TorrentSearch.h"
#endif
#include "tools/CreateTorrentDlg.h"
#endif
#ifdef WITH_JPLUGINS
# include "tools/FileSharingSearch.h"
#include "tools/FileSharingSearch.h"
#endif

#include "tools/HashDlg.h"

QList<AppTool> g_tools;

void initAppTools()
{
void initAppTools() {
#ifdef WITH_BITTORRENT
# ifdef HAVE_WEBENGINE
g_tools << AppTool(QObject::tr("Torrent search"), TorrentSearch::create);
# endif
g_tools << AppTool(QObject::tr("Create a torrent"), CreateTorrentDlg::create);
#ifdef HAVE_WEBENGINE
g_tools << AppTool(QObject::tr("Torrent search"), TorrentSearch::create);
#endif
g_tools << AppTool(QObject::tr("File hasher"), HashDlg::create);
g_tools << AppTool(QObject::tr("Create a torrent"), CreateTorrentDlg::create);
#endif
g_tools << AppTool(QObject::tr("File hasher"), HashDlg::create);
#ifdef WITH_JPLUGINS
g_tools << AppTool(QObject::tr("File sharing server search"), FileSharingSearch::create);
g_tools << AppTool(QObject::tr("File sharing server search"),
FileSharingSearch::create);
#endif
}

void addAppTool(const AppTool& tool)
{
g_tools << tool;
}
void addAppTool(const AppTool& tool) { g_tools << tool; }
14 changes: 6 additions & 8 deletions src/AppTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ respects for all of the code used other than "OpenSSL".

#ifndef APPTOOLS_H
#define APPTOOLS_H
#include <QWidget>
#include <QString>
#include <QWidget>

struct AppTool
{
AppTool() {}
AppTool(QString n, QWidget* (*pfn)()) : strName(n), pfnCreate(pfn)
{}
QString strName;
QWidget* (*pfnCreate)();
struct AppTool {
AppTool() {}
AppTool(QString n, QWidget* (*pfn)()) : strName(n), pfnCreate(pfn) {}
QString strName;
QWidget* (*pfnCreate)();
};

void initAppTools();
Expand Down
57 changes: 27 additions & 30 deletions src/Auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,37 @@ respects for all of the code used other than "OpenSSL".
*/

#include "Auth.h"

#include <QSettings>

extern QSettings* g_settings;

QList<Auth> Auth::loadAuths()
{
QList<Auth> r;

int count = g_settings->beginReadArray("httpftp/auths");
for(int i=0;i<count;i++)
{
Auth auth;
g_settings->setArrayIndex(i);

auth.strRegExp = g_settings->value("regexp").toString();
auth.strUser = g_settings->value("user").toString();
auth.strPassword = g_settings->value("password").toString();

r << auth;
}
g_settings->endArray();

return r;
QList<Auth> Auth::loadAuths() {
QList<Auth> r;

int count = g_settings->beginReadArray("httpftp/auths");
for (int i = 0; i < count; i++) {
Auth auth;
g_settings->setArrayIndex(i);

auth.strRegExp = g_settings->value("regexp").toString();
auth.strUser = g_settings->value("user").toString();
auth.strPassword = g_settings->value("password").toString();

r << auth;
}
g_settings->endArray();

return r;
}

void Auth::saveAuths(const QList<Auth>& auths)
{
g_settings->beginWriteArray("httpftp/auths");
for(int i=0;i<auths.size();i++)
{
g_settings->setArrayIndex(i);
g_settings->setValue("regexp", auths[i].strRegExp);
g_settings->setValue("user", auths[i].strUser);
g_settings->setValue("password", auths[i].strPassword);
}
g_settings->endArray();
void Auth::saveAuths(const QList<Auth>& auths) {
g_settings->beginWriteArray("httpftp/auths");
for (int i = 0; i < auths.size(); i++) {
g_settings->setArrayIndex(i);
g_settings->setValue("regexp", auths[i].strRegExp);
g_settings->setValue("user", auths[i].strUser);
g_settings->setValue("password", auths[i].strPassword);
}
g_settings->endArray();
}
11 changes: 5 additions & 6 deletions src/Auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ respects for all of the code used other than "OpenSSL".

#ifndef AUTH_H
#define AUTH_H
#include <QString>
#include <QList>
#include <QString>

struct Auth
{
QString strRegExp, strUser, strPassword;
static QList<Auth> loadAuths();
static void saveAuths(const QList<Auth>& auths);
struct Auth {
QString strRegExp, strUser, strPassword;
static QList<Auth> loadAuths();
static void saveAuths(const QList<Auth>& auths);
};

#endif
36 changes: 16 additions & 20 deletions src/AutoActionForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,22 @@ respects for all of the code used other than "OpenSSL".

#include "ui_AutoActionForm.h"

class AutoActionForm : public WidgetHostChild, Ui_AutoActionForm
{
public:
AutoActionForm(QWidget* me, Transfer* t)
: m_transfer(t)
{
setupUi(me);
}

virtual void load()
{
lineCommandCompleted->setText(m_transfer->autoActionCommand(Transfer::Completed));
}

virtual void accepted()
{
m_transfer->setAutoActionCommand(Transfer::Completed, lineCommandCompleted->text());
}
private:
Transfer* m_transfer;
class AutoActionForm : public WidgetHostChild, Ui_AutoActionForm {
public:
AutoActionForm(QWidget* me, Transfer* t) : m_transfer(t) { setupUi(me); }

virtual void load() {
lineCommandCompleted->setText(
m_transfer->autoActionCommand(Transfer::Completed));
}

virtual void accepted() {
m_transfer->setAutoActionCommand(Transfer::Completed,
lineCommandCompleted->text());
}

private:
Transfer* m_transfer;
};

#endif
Loading

0 comments on commit 978757d

Please sign in to comment.