Clang-format (#3028)

* 1/3 Add .clang-format file and travis compilation check

* 2/3 Run clang-format

* 3/3 Fix compilation problems due to include reordering

* 3bis/3 AfterControlStatement: false
This commit is contained in:
ctrlaltca 2018-01-27 10:41:32 +01:00 committed by GitHub
parent 8dbdd24c8e
commit b29bd9e070
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
272 changed files with 13378 additions and 9535 deletions

View file

@ -1,20 +1,20 @@
#include <QHBoxLayout>
#include <QPushButton>
#include <QGroupBox>
#include <QMessageBox>
#include <QDialogButtonBox>
#include <QSpinBox>
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QRadioButton>
#include <QTabWidget>
#include "tab_logs.h"
#include "abstractclient.h"
#include "window_sets.h"
#include "pending_command.h"
#include "pb/moderator_commands.pb.h"
#include "pb/response_viewlog_history.pb.h"
#include "pending_command.h"
#include "window_sets.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPushButton>
#include <QRadioButton>
#include <QSpinBox>
#include <QTabWidget>
#include <QtGui>
#include <QtWidgets>
@ -25,17 +25,20 @@ TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *
roomTable = new QTableWidget();
roomTable->setColumnCount(6);
roomTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
roomTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
roomTable->setHorizontalHeaderLabels(
QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
gameTable = new QTableWidget();
gameTable->setColumnCount(6);
gameTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
gameTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
gameTable->setHorizontalHeaderLabels(
QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
chatTable = new QTableWidget();
chatTable->setColumnCount(6);
chatTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
chatTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
chatTable->setHorizontalHeaderLabels(
QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
QTabWidget *tabManager = new QTabWidget();
tabManager->addTab(roomTable, tr("Room Logs"));
@ -51,22 +54,21 @@ TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *
TabLog::~TabLog()
{
}
void TabLog::retranslateUi()
{
}
void TabLog::getClicked()
{
if (findUsername->text().isEmpty() && findIPAddress->text().isEmpty() && findGameName->text().isEmpty() && findGameID->text().isEmpty() && findMessage->text().isEmpty()) {
if (findUsername->text().isEmpty() && findIPAddress->text().isEmpty() && findGameName->text().isEmpty() &&
findGameID->text().isEmpty() && findMessage->text().isEmpty()) {
QMessageBox::critical(this, tr("Error"), tr("You must select at least one filter."));
return;
}
if (!lastHour->isChecked() && !today->isChecked() && !pastDays->isChecked()){
if (!lastHour->isChecked() && !today->isChecked() && !pastDays->isChecked()) {
pastDays->setChecked(true);
pastXDays->setValue(20);
}
@ -101,13 +103,20 @@ void TabLog::getClicked()
cmd.set_game_name(findGameName->text().toStdString());
cmd.set_game_id(findGameID->text().toStdString());
cmd.set_message(findMessage->text().toStdString());
if (mainRoom->isChecked()) { cmd.add_log_location("room"); };
if (gameRoom->isChecked()) { cmd.add_log_location("game"); };
if (privateChat->isChecked()) { cmd.add_log_location("chat"); };
if (mainRoom->isChecked()) {
cmd.add_log_location("room");
};
if (gameRoom->isChecked()) {
cmd.add_log_location("game");
};
if (privateChat->isChecked()) {
cmd.add_log_location("chat");
};
cmd.set_date_range(dateRange);
cmd.set_maximum_results(maximumResults->value());
PendingCommand *pend = client->prepareModeratorCommand(cmd);
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(viewLogHistory_processResponse(Response)));
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this,
SLOT(viewLogHistory_processResponse(Response)));
client->sendCommand(pend);
}
@ -163,12 +172,12 @@ void TabLog::createDock()
pastXDays = new QSpinBox;
pastXDays->setMaximum(20);
labelMaximum = new QLabel(tr("Maximum Results: "));
maximumResults = new QSpinBox;
maximumResults->setMaximum(1000);
labelDescription = new QLabel(tr("At least one filter is required.\nThe more information you put in, the more specific your results will be."));
labelDescription = new QLabel(tr(
"At least one filter is required.\nThe more information you put in, the more specific your results will be."));
getButton = new QPushButton(tr("Get User Logs"));
getButton->setAutoDefault(true);
@ -192,7 +201,7 @@ void TabLog::createDock()
criteriaGroupBox = new QGroupBox(tr("Filters"));
criteriaGroupBox->setLayout(criteriaGrid);
criteriaGroupBox->setFixedSize(500,300);
criteriaGroupBox->setFixedSize(500, 300);
locationGrid = new QGridLayout;
locationGrid->addWidget(mainRoom, 0, 0);
@ -244,7 +253,7 @@ void TabLog::createDock()
searchDockContents->setLayout(mainLayout);
searchDock = new QDockWidget(this);
searchDock->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
searchDock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);
searchDock->setWidget(searchDockContents);
}
@ -252,12 +261,14 @@ void TabLog::viewLogHistory_processResponse(const Response &resp)
{
const Response_ViewLogHistory &response = resp.GetExtension(Response_ViewLogHistory::ext);
if (resp.response_code() != Response::RespOk) {
QMessageBox::critical(static_cast<QWidget *>(parent()), tr("Message History"), tr("Failed to collect message history information."));
QMessageBox::critical(static_cast<QWidget *>(parent()), tr("Message History"),
tr("Failed to collect message history information."));
return;
}
if (response.log_message_size() == 0) {
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Message History"), tr("There are no messages for the selected filters."));
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Message History"),
tr("There are no messages for the selected filters."));
return;
}
@ -266,8 +277,7 @@ void TabLog::viewLogHistory_processResponse(const Response &resp)
gameTable->setRowCount(gameCounter);
chatTable->setRowCount(chatCounter);
for (int i = 0; i < response.log_message_size(); ++i)
{
for (int i = 0; i < response.log_message_size(); ++i) {
ServerInfo_ChatMessage message = response.log_message(i);
if (QString::fromStdString(message.target_type()) == "room") {
roomTable->insertRow(roomCounter);