From a6254d88b34ad943e822ad00093cdf601196def1 Mon Sep 17 00:00:00 2001 From: vae Date: Wed, 12 May 2021 10:05:17 +0300 Subject: [PATCH] feat: OMEMO devices ui mock --- ui/CMakeLists.txt | 1 + ui/omemo/CMakeLists.txt | 5 + ui/omemo/omemodevices.cpp | 13 + ui/{widgets => omemo}/omemodevices.h | 5 +- ui/omemo/omemodevices.ui | 508 +++++++++++++++++++++++++++ ui/squawk.cpp | 11 +- ui/squawk.h | 1 + ui/widgets/CMakeLists.txt | 3 - ui/widgets/omemodevices.cpp | 6 - ui/widgets/omemodevices.ui | 143 -------- 10 files changed, 542 insertions(+), 154 deletions(-) create mode 100644 ui/omemo/CMakeLists.txt create mode 100644 ui/omemo/omemodevices.cpp rename ui/{widgets => omemo}/omemodevices.h (74%) create mode 100644 ui/omemo/omemodevices.ui delete mode 100644 ui/widgets/omemodevices.cpp delete mode 100644 ui/widgets/omemodevices.ui diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 36207b6..222f8d7 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -3,3 +3,4 @@ target_sources(squawk PRIVATE squawk.cpp squawk.h squawk.ui) add_subdirectory(models) add_subdirectory(utils) add_subdirectory(widgets) +add_subdirectory(omemo) \ No newline at end of file diff --git a/ui/omemo/CMakeLists.txt b/ui/omemo/CMakeLists.txt new file mode 100644 index 0000000..41afa04 --- /dev/null +++ b/ui/omemo/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(squawk PRIVATE + omemodevices.cpp + omemodevices.h + omemodevices.ui + ) \ No newline at end of file diff --git a/ui/omemo/omemodevices.cpp b/ui/omemo/omemodevices.cpp new file mode 100644 index 0000000..e746f5b --- /dev/null +++ b/ui/omemo/omemodevices.cpp @@ -0,0 +1,13 @@ +/* + * Created by victoria on 2021-05-12. + */ + +#include "omemodevices.h" +#include "ui_omemodevices.h" + +OMEMODevices::OMEMODevices(QWidget *parent) + : QDialog(parent), m_ui(new Ui::OMEMODevices()) { + m_ui->setupUi(this); +} + +OMEMODevices::~OMEMODevices() {} diff --git a/ui/widgets/omemodevices.h b/ui/omemo/omemodevices.h similarity index 74% rename from ui/widgets/omemodevices.h rename to ui/omemo/omemodevices.h index 6dd34eb..b107baa 100644 --- a/ui/widgets/omemodevices.h +++ b/ui/omemo/omemodevices.h @@ -14,5 +14,8 @@ class OMEMODevices : public QDialog { Q_OBJECT public: explicit OMEMODevices(QWidget *parent = nullptr); - ~OMEMODevices() override = default; + ~OMEMODevices() override; + +private: + QScopedPointer m_ui; }; diff --git a/ui/omemo/omemodevices.ui b/ui/omemo/omemodevices.ui new file mode 100644 index 0000000..c15dc9d --- /dev/null +++ b/ui/omemo/omemodevices.ui @@ -0,0 +1,508 @@ + + + OMEMODevices + + + + 0 + 0 + 560 + 357 + + + + OMEMO Devices + + + + + + List of OMEMO fingerprints for fooooo@bar.com + + + + + + + true + + + + + 0 + 0 + 540 + 281 + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + background-color: rgb(6, 88, 6) + + + QFrame::Panel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + + 240 + 0 + + + + + Monospace + 8 + + + + 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd + + + Qt::PlainText + + + true + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + Squawk + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + + + + 0 + 0 + + + + QFrame::Panel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + + 240 + 0 + + + + + Monospace + 8 + + + + 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd + + + Qt::PlainText + + + true + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + Dino + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + + + + 0 + 0 + + + + false + + + background: rgb(111, 47, 47) + + + QFrame::Panel + + + QFrame::Raised + + + 1 + + + + + + + 0 + 0 + + + + + 240 + 0 + + + + + Monospace + 8 + + + + 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd + + + Qt::PlainText + + + true + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + Conversations + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + 0 + 0 + + + + + + + + .. + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + false + + + + + + + + + buttonBox + accepted() + OMEMODevices + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + OMEMODevices + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/ui/squawk.cpp b/ui/squawk.cpp index fb79592..13c452a 100644 --- a/ui/squawk.cpp +++ b/ui/squawk.cpp @@ -20,6 +20,7 @@ #include "ui_squawk.h" #include #include +#include Squawk::Squawk(QWidget *parent) : QMainWindow(parent), @@ -60,7 +61,8 @@ Squawk::Squawk(QWidget *parent) : connect(m_ui->roster, &QTreeView::collapsed, this, &Squawk::onItemCollepsed); connect(m_ui->roster->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &Squawk::onRosterSelectionChanged); connect(&rosterModel, &Models::Roster::unnoticedMessage, this, &Squawk::onUnnoticedMessage); - + connect(m_ui->actionDeviceList, &QAction::triggered, this, &Squawk::onOMEMODevices); + connect(rosterModel.accountsModel, &Models::Accounts::sizeChanged, this, &Squawk::onAccountsSizeChanged); connect(&rosterModel, &Models::Roster::requestArchive, this, &Squawk::onRequestArchive); connect(&rosterModel, &Models::Roster::fileDownloadRequest, this, &Squawk::fileDownloadRequest); @@ -134,6 +136,13 @@ void Squawk::onNewContact() nc->exec(); } +void Squawk::onOMEMODevices() { + auto od = new OMEMODevices(this); + + od->setAttribute(Qt::WA_DeleteOnClose); + od->show(); +} + void Squawk::onNewConference() { JoinConference* jc = new JoinConference(rosterModel.accountsModel, this); diff --git a/ui/squawk.h b/ui/squawk.h index 15d3f82..a4c130e 100644 --- a/ui/squawk.h +++ b/ui/squawk.h @@ -155,6 +155,7 @@ private slots: void onPasswordPromptRejected(); void onRosterSelectionChanged(const QModelIndex& current, const QModelIndex& previous); void onContextAboutToHide(); + void onOMEMODevices(); void onUnnoticedMessage(const QString& account, const Shared::Message& msg); diff --git a/ui/widgets/CMakeLists.txt b/ui/widgets/CMakeLists.txt index ac8bc32..0cacf6f 100644 --- a/ui/widgets/CMakeLists.txt +++ b/ui/widgets/CMakeLists.txt @@ -16,9 +16,6 @@ target_sources(squawk PRIVATE newcontact.cpp newcontact.h newcontact.ui - omemodevices.cpp - omemodevices.h - omemodevices.ui room.cpp room.h ) diff --git a/ui/widgets/omemodevices.cpp b/ui/widgets/omemodevices.cpp deleted file mode 100644 index 630b85a..0000000 --- a/ui/widgets/omemodevices.cpp +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Created by victoria on 2021-05-12. - */ -#include "omemodevices.h" - -OMEMODevices::OMEMODevices(QWidget *parent) {} diff --git a/ui/widgets/omemodevices.ui b/ui/widgets/omemodevices.ui deleted file mode 100644 index e407655..0000000 --- a/ui/widgets/omemodevices.ui +++ /dev/null @@ -1,143 +0,0 @@ - - - Dialog - - - - 0 - 0 - 617 - 281 - - - - Dialog - - - - - - - - - - Monospace - 8 - - - - 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd 1234abcd - - - Qt::PlainText - - - true - - - - - - - - 0 - 0 - - - - Phone - - - - - - - - 0 - 0 - - - - - - - - - - true - - - - - - - - 0 - 0 - - - - - - - - - - true - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -