[Fix-Warnings] Replace types with auto for interface/ files

This commit is contained in:
Brübach, Lukas 2025-11-28 22:36:40 +01:00
parent 17cc4ea532
commit 6105f5f2da
10 changed files with 33 additions and 34 deletions

View file

@ -24,7 +24,7 @@ class ArchidektJsonParser : public IJsonDeckParser
public:
DeckLoader *parse(const QJsonObject &obj) override
{
DeckLoader *loader = new DeckLoader(nullptr);
auto *loader = new DeckLoader(nullptr);
QString deckName = obj.value("name").toString();
QString deckDescription = obj.value("description").toString();
@ -59,7 +59,7 @@ class MoxfieldJsonParser : public IJsonDeckParser
public:
DeckLoader *parse(const QJsonObject &obj) override
{
DeckLoader *loader = new DeckLoader(nullptr);
auto *loader = new DeckLoader(nullptr);
QString deckName = obj.value("name").toString();
QString deckDescription = obj.value("description").toString();

View file

@ -32,7 +32,7 @@ CardPictureLoader::CardPictureLoader() : QObject(nullptr)
connect(worker, &CardPictureLoaderWorker::imageLoaded, this, &CardPictureLoader::imageLoaded);
statusBar = new CardPictureLoaderStatusBar(nullptr);
QMainWindow *mainWindow = qobject_cast<QMainWindow *>(QApplication::activeWindow());
auto *mainWindow = qobject_cast<QMainWindow *>(QApplication::activeWindow());
if (mainWindow) {
mainWindow->statusBar()->addPermanentWidget(statusBar);
}

View file

@ -219,7 +219,7 @@ QString CardPictureToLoad::transformUrl(const QString &urlTemplate) const
CardSetPtr set = getCurrentSet();
QMap<QString, QString> transformMap = QMap<QString, QString>();
auto transformMap = QMap<QString, QString>();
QString setName = getSetName();
// name

View file

@ -290,7 +290,7 @@ void FlowLayout::layoutSingleColumn(const QVector<QLayoutItem *> &colItems, cons
const QObjectList &children = widget->children();
qCDebug(FlowLayoutLog) << "Child widgets:";
for (QObject *child : children) {
if (QWidget *childWidget = qobject_cast<QWidget *>(child)) {
if (auto *childWidget = qobject_cast<QWidget *>(child)) {
qCDebug(FlowLayoutLog) << " - Child widget class:" << childWidget->metaObject()->className();
qCDebug(FlowLayoutLog) << " Size hint:" << childWidget->sizeHint();
qCDebug(FlowLayoutLog) << " Maximum size:" << childWidget->maximumSize();

View file

@ -15,10 +15,10 @@
#define PLAYERZONE_BG_NAME "playerzone"
#define STACKZONE_BG_NAME "stackzone"
#define TABLEZONE_BG_NAME "tablezone"
static const QColor HANDZONE_BG_DEFAULT = QColor(80, 100, 50);
static const QColor TABLEZONE_BG_DEFAULT = QColor(70, 50, 100);
static const QColor PLAYERZONE_BG_DEFAULT = QColor(200, 200, 200);
static const QColor STACKZONE_BG_DEFAULT = QColor(113, 43, 43);
static constexpr auto HANDZONE_BG_DEFAULT = QColor(80, 100, 50);
static constexpr auto TABLEZONE_BG_DEFAULT = QColor(70, 50, 100);
static constexpr auto PLAYERZONE_BG_DEFAULT = QColor(200, 200, 200);
static constexpr auto STACKZONE_BG_DEFAULT = QColor(113, 43, 43);
static const QStringList DEFAULT_RESOURCE_PATHS = {":/resources"};
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
@ -77,7 +77,7 @@ QStringMap &ThemeManager::getAvailableThemes()
QBrush ThemeManager::loadBrush(QString fileName, QColor fallbackColor)
{
QBrush brush;
QPixmap tmp = QPixmap("theme:zones/" + fileName);
auto tmp = QPixmap("theme:zones/" + fileName);
if (tmp.isNull()) {
brush.setColor(fallbackColor);
brush.setStyle(Qt::SolidPattern);
@ -91,7 +91,7 @@ QBrush ThemeManager::loadBrush(QString fileName, QColor fallbackColor)
QBrush ThemeManager::loadExtraBrush(QString fileName, QBrush &fallbackBrush)
{
QBrush brush;
QPixmap tmp = QPixmap("theme:zones/" + fileName);
auto tmp = QPixmap("theme:zones/" + fileName);
if (tmp.isNull()) {
brush = fallbackBrush;

View file

@ -39,7 +39,7 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QStrin
realnameLabel->setBuddy(realnameEdit);
realnameEdit->setText(realName);
QGridLayout *grid = new QGridLayout;
auto *grid = new QGridLayout;
grid->addWidget(emailLabel, 0, 0);
grid->addWidget(emailEdit, 0, 1);
grid->addWidget(countryLabel, 2, 0);
@ -47,11 +47,11 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, QString country, QStrin
grid->addWidget(realnameLabel, 3, 0);
grid->addWidget(realnameEdit, 3, 1);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgEditUser::actOk);
connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgEditUser::reject);
QVBoxLayout *mainLayout = new QVBoxLayout;
auto *mainLayout = new QVBoxLayout;
mainLayout->addLayout(grid);
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);

View file

@ -338,7 +338,7 @@ AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen(const
*/
QMessageBox *AbstractTabDeckEditor::createSaveConfirmationWindow()
{
QMessageBox *msgBox = new QMessageBox(this);
auto *msgBox = new QMessageBox(this);
msgBox->setIcon(QMessageBox::Warning);
msgBox->setWindowTitle(tr("Are you sure?"));
msgBox->setText(tr("The decklist has been modified.\nDo you want to save the changes?"));
@ -607,7 +607,7 @@ void AbstractTabDeckEditor::exportToDecklistWebsite(DeckLoader::DecklistWebsite
// Encode the string recieved from the model to make sure all characters are encoded.
// first we put it into a qurl object
QUrl decklistUrl = QUrl(decklistUrlString);
auto decklistUrl = QUrl(decklistUrlString);
// we get the correctly encoded url.
decklistUrlString = decklistUrl.toEncoded();
// We open the url in the user's default browser

View file

@ -53,7 +53,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
// Left side layout
/* put an invisible dummy QToolBar in the leftmost column so that the main toolbar is centered.
* Really ugly workaround, but I couldn't figure out the proper way to make it centered */
QToolBar *dummyToolBar = new QToolBar(this);
auto *dummyToolBar = new QToolBar(this);
QSizePolicy sizePolicy = dummyToolBar->sizePolicy();
sizePolicy.setRetainSizeWhenHidden(true);
dummyToolBar->setSizePolicy(sizePolicy);
@ -63,16 +63,16 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
leftToolBar->setOrientation(Qt::Horizontal);
leftToolBar->setIconSize(QSize(32, 32));
QToolBar *leftRightmostToolBar = new QToolBar(this);
auto *leftRightmostToolBar = new QToolBar(this);
leftRightmostToolBar->setOrientation(Qt::Horizontal);
leftRightmostToolBar->setIconSize(QSize(32, 32));
QGridLayout *leftToolBarLayout = new QGridLayout;
auto *leftToolBarLayout = new QGridLayout;
leftToolBarLayout->addWidget(dummyToolBar, 0, 0, Qt::AlignLeft);
leftToolBarLayout->addWidget(leftToolBar, 0, 1, Qt::AlignHCenter);
leftToolBarLayout->addWidget(leftRightmostToolBar, 0, 2, Qt::AlignRight);
QVBoxLayout *leftVbox = new QVBoxLayout;
auto *leftVbox = new QVBoxLayout;
leftVbox->addWidget(localDirView);
leftVbox->addLayout(leftToolBarLayout);
leftGroupBox = new QGroupBox;
@ -82,7 +82,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
rightToolBar = new QToolBar;
rightToolBar->setOrientation(Qt::Horizontal);
rightToolBar->setIconSize(QSize(32, 32));
QHBoxLayout *rightToolBarLayout = new QHBoxLayout;
auto *rightToolBarLayout = new QHBoxLayout;
rightToolBarLayout->addStretch();
rightToolBarLayout->addWidget(rightToolBar);
rightToolBarLayout->addStretch();
@ -91,14 +91,14 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
connect(serverDirView, &QTreeView::doubleClicked, this, &TabDeckStorage::actRemoteDoubleClick);
QVBoxLayout *rightVbox = new QVBoxLayout;
auto *rightVbox = new QVBoxLayout;
rightVbox->addWidget(serverDirView);
rightVbox->addLayout(rightToolBarLayout);
rightGroupBox = new QGroupBox;
rightGroupBox->setLayout(rightVbox);
// combine layouts
QHBoxLayout *hbox = new QHBoxLayout;
auto *hbox = new QHBoxLayout;
hbox->addWidget(leftGroupBox);
hbox->addWidget(rightGroupBox);
@ -153,7 +153,7 @@ TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor,
retranslateUi();
QWidget *mainWidget = new QWidget(this);
auto *mainWidget = new QWidget(this);
mainWidget->setLayout(hbox);
setCentralWidget(mainWidget);
@ -412,7 +412,7 @@ void TabDeckStorage::actRemoteDoubleClick(const QModelIndex &curRight)
void TabDeckStorage::actOpenRemoteDeck()
{
for (const auto &curRight : serverDirView->getCurrentSelection()) {
RemoteDeckList_TreeModel::FileNode *node = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(curRight);
auto *node = dynamic_cast<RemoteDeckList_TreeModel::FileNode *>(curRight);
if (!node)
continue;

View file

@ -34,10 +34,10 @@ RoomSelector::RoomSelector(AbstractClient *_client, QWidget *parent) : QGroupBox
joinButton = new QPushButton;
connect(joinButton, &QPushButton::clicked, this, &RoomSelector::joinClicked);
QHBoxLayout *buttonLayout = new QHBoxLayout;
auto *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch();
buttonLayout->addWidget(joinButton);
QVBoxLayout *vbox = new QVBoxLayout;
auto *vbox = new QVBoxLayout;
vbox->addWidget(roomList);
vbox->addLayout(buttonLayout);
@ -87,7 +87,7 @@ void RoomSelector::processListRoomsEvent(const Event_ListRooms &event)
return;
}
}
QTreeWidgetItem *twi = new QTreeWidgetItem;
auto *twi = new QTreeWidgetItem;
twi->setData(0, Qt::UserRole, room.room_id());
if (room.has_name())
twi->setData(0, Qt::DisplayRole, QString::fromStdString(room.name()));
@ -147,13 +147,13 @@ TabServer::TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client) : T
connect(client, &AbstractClient::serverMessageEventReceived, this, &TabServer::processServerMessageEvent);
QVBoxLayout *vbox = new QVBoxLayout;
auto *vbox = new QVBoxLayout;
vbox->addWidget(roomSelector);
vbox->addWidget(serverInfoBox);
retranslateUi();
QWidget *mainWidget = new QWidget(this);
auto *mainWidget = new QWidget(this);
mainWidget->setLayout(vbox);
setCentralWidget(mainWidget);
}

View file

@ -244,14 +244,13 @@ void MainWindow::startLocalGame(int numberPlayers)
localServer = new LocalServer(this);
LocalServerInterface *mainLsi = localServer->newConnection();
LocalClient *mainClient =
new LocalClient(mainLsi, tr("Player %1").arg(1), SettingsCache::instance().getClientID(), this);
auto *mainClient = new LocalClient(mainLsi, tr("Player %1").arg(1), SettingsCache::instance().getClientID(), this);
QList<AbstractClient *> localClients;
localClients.append(mainClient);
for (int i = 0; i < numberPlayers - 1; ++i) {
LocalServerInterface *slaveLsi = localServer->newConnection();
LocalClient *slaveClient =
auto *slaveClient =
new LocalClient(slaveLsi, tr("Player %1").arg(i + 2), SettingsCache::instance().getClientID(), this);
localClients.append(slaveClient);
}
@ -1222,7 +1221,7 @@ void MainWindow::createCardUpdateProcess(bool background)
// full "run the update" command; leave empty if not present
QString updaterCmd;
QString binaryName;
QDir dir = QDir(QApplication::applicationDirPath());
auto dir = QDir(QApplication::applicationDirPath());
#if defined(Q_OS_MAC)
/*