summary refs log tree commit diff
path: root/src/dialogs
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-12-28 22:30:12 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-12-28 22:30:12 +0100
commitbb290f9fecc48d407c2bc75a64b0e8a94bc3aeba (patch)
tree4a663d6987c615c9c2b01bec903bfe125ee58cf3 /src/dialogs
parentRemove unused button class (diff)
downloadnheko-bb290f9fecc48d407c2bc75a64b0e8a94bc3aeba.tar.xz
Fix more warnings and remove dead code
Diffstat (limited to 'src/dialogs')
-rw-r--r--src/dialogs/CreateRoom.cpp4
-rw-r--r--src/dialogs/FallbackAuth.cpp4
-rw-r--r--src/dialogs/Logout.cpp56
-rw-r--r--src/dialogs/Logout.h27
-rw-r--r--src/dialogs/PreviewUploadOverlay.cpp6
-rw-r--r--src/dialogs/ReCaptcha.cpp1
6 files changed, 9 insertions, 89 deletions
diff --git a/src/dialogs/CreateRoom.cpp b/src/dialogs/CreateRoom.cpp
index 153d36c0..0600bd13 100644
--- a/src/dialogs/CreateRoom.cpp
+++ b/src/dialogs/CreateRoom.cpp
@@ -85,7 +85,7 @@ CreateRoom::CreateRoom(QWidget *parent)
 
     auto directLabel_ = new QLabel(tr("Direct Chat"), this);
     directToggle_     = new Toggle(this);
-    directToggle_->setActiveColor(QColor("#38A3D8"));
+    directToggle_->setActiveColor(QColor(0x38, 0xA3, 0xD8));
     directToggle_->setInactiveColor(QColor("gray"));
     directToggle_->setState(false);
 
@@ -120,6 +120,7 @@ CreateRoom::CreateRoom(QWidget *parent)
 
     connect(visibilityCombo_,
             static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
+            this,
             [this](const QString &text) {
                 if (text == "Private") {
                     request_.visibility = mtx::common::RoomVisibility::Private;
@@ -130,6 +131,7 @@ CreateRoom::CreateRoom(QWidget *parent)
 
     connect(presetCombo_,
             static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
+            this,
             [this](const QString &text) {
                 if (text == "Private Chat") {
                     request_.preset = mtx::requests::Preset::PrivateChat;
diff --git a/src/dialogs/FallbackAuth.cpp b/src/dialogs/FallbackAuth.cpp
index 0d8be237..ac3b7c26 100644
--- a/src/dialogs/FallbackAuth.cpp
+++ b/src/dialogs/FallbackAuth.cpp
@@ -32,6 +32,7 @@ FallbackAuth::FallbackAuth(const QString &authType, const QString &session, QWid
 
     auto buttonLayout = new QHBoxLayout();
     buttonLayout->setSpacing(8);
+    buttonLayout->setContentsMargins(0, 0, 0, 0);
 
     openBtn_    = new QPushButton(tr("Open Fallback in Browser"), this);
     cancelBtn_  = new QPushButton(tr("Cancel"), this);
@@ -58,8 +59,7 @@ FallbackAuth::FallbackAuth(const QString &authType, const QString &session, QWid
                                  "fallback/web?session=%3")
                            .arg(QString::fromStdString(http::client()->server()))
                            .arg(http::client()->port())
-                           .arg(session)
-                           .arg(authType);
+                           .arg(session, authType);
 
         QDesktopServices::openUrl(url);
     });
diff --git a/src/dialogs/Logout.cpp b/src/dialogs/Logout.cpp
deleted file mode 100644
index 45cef6a5..00000000
--- a/src/dialogs/Logout.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
-// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-#include <QLabel>
-#include <QPushButton>
-#include <QVBoxLayout>
-
-#include "Config.h"
-#include "dialogs/Logout.h"
-
-using namespace dialogs;
-
-Logout::Logout(QWidget *parent)
-  : QFrame(parent)
-{
-    setAutoFillBackground(true);
-    setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
-    setWindowModality(Qt::WindowModal);
-    setAttribute(Qt::WA_DeleteOnClose, true);
-
-    setMinimumWidth(conf::modals::MIN_WIDGET_WIDTH);
-    setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
-
-    auto layout = new QVBoxLayout(this);
-    layout->setSpacing(conf::modals::WIDGET_SPACING);
-    layout->setContentsMargins(conf::modals::WIDGET_MARGIN,
-                               conf::modals::WIDGET_MARGIN,
-                               conf::modals::WIDGET_MARGIN,
-                               conf::modals::WIDGET_MARGIN);
-
-    auto buttonLayout = new QHBoxLayout();
-    buttonLayout->setSpacing(0);
-
-    confirmBtn_ = new QPushButton("Logout", this);
-    cancelBtn_  = new QPushButton(tr("Cancel"), this);
-    cancelBtn_->setDefault(true);
-
-    buttonLayout->addStretch(1);
-    buttonLayout->setSpacing(15);
-    buttonLayout->addWidget(cancelBtn_);
-    buttonLayout->addWidget(confirmBtn_);
-
-    auto label = new QLabel(tr("Logout. Are you sure?"), this);
-
-    layout->addWidget(label);
-    layout->addLayout(buttonLayout);
-    layout->addStretch(1);
-
-    connect(confirmBtn_, &QPushButton::clicked, this, [this]() {
-        emit loggingOut();
-        emit close();
-    });
-    connect(cancelBtn_, &QPushButton::clicked, this, &Logout::close);
-}
diff --git a/src/dialogs/Logout.h b/src/dialogs/Logout.h
deleted file mode 100644
index 7783c68f..00000000
--- a/src/dialogs/Logout.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
-// SPDX-FileCopyrightText: 2021 Nheko Contributors
-//
-// SPDX-License-Identifier: GPL-3.0-or-later
-
-#pragma once
-
-#include <QFrame>
-
-class QPushButton;
-
-namespace dialogs {
-
-class Logout : public QFrame
-{
-    Q_OBJECT
-public:
-    explicit Logout(QWidget *parent = nullptr);
-
-signals:
-    void loggingOut();
-
-private:
-    QPushButton *confirmBtn_;
-    QPushButton *cancelBtn_;
-};
-} // dialogs
diff --git a/src/dialogs/PreviewUploadOverlay.cpp b/src/dialogs/PreviewUploadOverlay.cpp
index 338f0635..00abde91 100644
--- a/src/dialogs/PreviewUploadOverlay.cpp
+++ b/src/dialogs/PreviewUploadOverlay.cpp
@@ -30,6 +30,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
   , cancel_{tr("Cancel"), this}
 {
     auto hlayout = new QHBoxLayout;
+    hlayout->setContentsMargins(0, 0, 0, 0);
     hlayout->addStretch(1);
     hlayout->addWidget(&cancel_);
     hlayout->addWidget(&upload_);
@@ -46,7 +47,7 @@ PreviewUploadOverlay::PreviewUploadOverlay(QWidget *parent)
                                 conf::modals::WIDGET_MARGIN);
 
     upload_.setDefault(true);
-    connect(&upload_, &QPushButton::clicked, [this]() {
+    connect(&upload_, &QPushButton::clicked, this, [this]() {
         emit confirmUpload(data_, mediaType_, fileName_.text());
         close();
     });
@@ -124,8 +125,7 @@ PreviewUploadOverlay::setLabels(const QString &type, const QString &mime, uint64
     } else {
         auto const info = QString{tr("Media type: %1\n"
                                      "Media size: %2\n")}
-                            .arg(mime)
-                            .arg(utils::humanReadableFileSize(upload_size));
+                            .arg(mime, utils::humanReadableFileSize(upload_size));
 
         titleLabel_.setText(QString{tr(DEFAULT)}.arg("file"));
         infoLabel_.setText(info);
diff --git a/src/dialogs/ReCaptcha.cpp b/src/dialogs/ReCaptcha.cpp
index 982c17b6..a4ada889 100644
--- a/src/dialogs/ReCaptcha.cpp
+++ b/src/dialogs/ReCaptcha.cpp
@@ -31,6 +31,7 @@ ReCaptcha::ReCaptcha(const QString &session, QWidget *parent)
                                conf::modals::WIDGET_MARGIN);
 
     auto buttonLayout = new QHBoxLayout();
+    buttonLayout->setContentsMargins(0, 0, 0, 0);
     buttonLayout->setSpacing(8);
 
     openCaptchaBtn_ = new QPushButton("Open reCAPTCHA", this);