Move all files under src/
This commit is contained in:
parent
96a2c614bf
commit
0e814da91c
145 changed files with 281 additions and 279 deletions
|
|
@ -3,14 +3,14 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "TextField.h"
|
||||
#include "Theme.h"
|
||||
#include "ToggleButton.h"
|
||||
|
||||
#include "dialogs/CreateRoom.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/TextField.h"
|
||||
#include "ui/Theme.h"
|
||||
#include "ui/ToggleButton.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
CreateRoom::CreateRoom(QWidget *parent)
|
||||
45
src/dialogs/CreateRoom.h
Normal file
45
src/dialogs/CreateRoom.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
#include <mtx.hpp>
|
||||
|
||||
class FlatButton;
|
||||
class TextField;
|
||||
class QComboBox;
|
||||
class Toggle;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class CreateRoom : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreateRoom(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void closing(bool isCreating, const mtx::requests::CreateRoom &request);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
private:
|
||||
void clearFields();
|
||||
|
||||
QComboBox *visibilityCombo_;
|
||||
QComboBox *presetCombo_;
|
||||
|
||||
Toggle *directToggle_;
|
||||
|
||||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
|
||||
TextField *nameInput_;
|
||||
TextField *topicInput_;
|
||||
TextField *aliasInput_;
|
||||
|
||||
mtx::requests::CreateRoom request_;
|
||||
};
|
||||
|
||||
} // dialogs
|
||||
|
|
@ -19,9 +19,10 @@
|
|||
#include <QDesktopWidget>
|
||||
#include <QPainter>
|
||||
|
||||
#include "Utils.h"
|
||||
#include "dialogs/ImageOverlay.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
ImageOverlay::ImageOverlay(QPixmap image, QWidget *parent)
|
||||
47
src/dialogs/ImageOverlay.h
Normal file
47
src/dialogs/ImageOverlay.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class ImageOverlay : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ImageOverlay(QPixmap image, QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void closing();
|
||||
|
||||
private:
|
||||
QPixmap originalImage_;
|
||||
QPixmap image_;
|
||||
|
||||
QRect content_;
|
||||
QRect close_button_;
|
||||
QRect screen_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -6,13 +6,13 @@
|
|||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "TextField.h"
|
||||
|
||||
#include "InviteeItem.h"
|
||||
#include "dialogs/InviteUsers.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "InviteeItem.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/TextField.h"
|
||||
|
||||
#include "mtx.hpp"
|
||||
|
||||
using namespace dialogs;
|
||||
42
src/dialogs/InviteUsers.h
Normal file
42
src/dialogs/InviteUsers.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QListWidgetItem>
|
||||
#include <QStringList>
|
||||
|
||||
class FlatButton;
|
||||
class TextField;
|
||||
class QListWidget;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class InviteUsers : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit InviteUsers(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
signals:
|
||||
void closing(bool isLeaving, QStringList invitees);
|
||||
|
||||
private slots:
|
||||
void removeInvitee(QListWidgetItem *item);
|
||||
|
||||
private:
|
||||
void addUser();
|
||||
QStringList invitedUsers() const;
|
||||
|
||||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
|
||||
TextField *inviteeInput_;
|
||||
QLabel *errorLabel_;
|
||||
|
||||
QListWidget *inviteeList_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "TextField.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#include "dialogs/JoinRoom.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/TextField.h"
|
||||
#include "ui/Theme.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
JoinRoom::JoinRoom(QWidget *parent)
|
||||
30
src/dialogs/JoinRoom.h
Normal file
30
src/dialogs/JoinRoom.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class FlatButton;
|
||||
class TextField;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class JoinRoom : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
JoinRoom(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void closing(bool isJoining, const QString &room);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
private:
|
||||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
|
||||
TextField *roomInput_;
|
||||
};
|
||||
|
||||
} // dialogs
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#include "dialogs/LeaveRoom.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/Theme.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
LeaveRoom::LeaveRoom(QWidget *parent)
|
||||
25
src/dialogs/LeaveRoom.h
Normal file
25
src/dialogs/LeaveRoom.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class FlatButton;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class LeaveRoom : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LeaveRoom(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void closing(bool isLeaving);
|
||||
|
||||
private:
|
||||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "Theme.h"
|
||||
|
||||
#include "dialogs/Logout.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/Theme.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
Logout::Logout(QWidget *parent)
|
||||
42
src/dialogs/Logout.h
Normal file
42
src/dialogs/Logout.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
class FlatButton;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class Logout : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Logout(QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void closing(bool isLoggingOut);
|
||||
|
||||
private:
|
||||
FlatButton *confirmBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -3,15 +3,15 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "dialogs/MemberList.h"
|
||||
|
||||
#include "AvatarProvider.h"
|
||||
#include "Cache.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include "Avatar.h"
|
||||
#include "Cache.h"
|
||||
#include "dialogs/MemberList.hpp"
|
||||
#include "ui/Avatar.h"
|
||||
#include "ui/FlatButton.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
|
|
|
|||
61
src/dialogs/MemberList.h
Normal file
61
src/dialogs/MemberList.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
#include <QListWidget>
|
||||
|
||||
class Avatar;
|
||||
class FlatButton;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QVBoxLayout;
|
||||
|
||||
struct RoomMember;
|
||||
|
||||
template<class T>
|
||||
class QSharedPointer;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class MemberItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MemberItem(const RoomMember &member, QWidget *parent);
|
||||
|
||||
private:
|
||||
QHBoxLayout *topLayout_;
|
||||
QVBoxLayout *textLayout_;
|
||||
|
||||
Avatar *avatar_;
|
||||
|
||||
QLabel *userName_;
|
||||
QLabel *userId_;
|
||||
};
|
||||
|
||||
class MemberList : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MemberList(const QString &room_id, QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void addUsers(const std::vector<RoomMember> &users);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void hideEvent(QHideEvent *event) override
|
||||
{
|
||||
list_->clear();
|
||||
QFrame::hideEvent(event);
|
||||
}
|
||||
|
||||
private:
|
||||
void moveButtonToBottom();
|
||||
|
||||
QString room_id_;
|
||||
QLabel *topLabel_;
|
||||
QListWidget *list_;
|
||||
FlatButton *moreBtn_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -23,13 +23,13 @@
|
|||
#include <QMimeDatabase>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "dialogs/PreviewUploadOverlay.h"
|
||||
|
||||
#include "Config.h"
|
||||
#include "Logging.hpp"
|
||||
#include "Logging.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include "dialogs/PreviewUploadOverlay.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
constexpr const char *DEFAULT = "Upload %1?";
|
||||
61
src/dialogs/PreviewUploadOverlay.h
Normal file
61
src/dialogs/PreviewUploadOverlay.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPixmap>
|
||||
#include <QWidget>
|
||||
|
||||
#include "ui/FlatButton.h"
|
||||
|
||||
class QMimeData;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class PreviewUploadOverlay : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreviewUploadOverlay(QWidget *parent = nullptr);
|
||||
|
||||
void setPreview(const QByteArray data, const QString &mime);
|
||||
void setPreview(const QString &path);
|
||||
|
||||
signals:
|
||||
void confirmUpload(const QByteArray data, const QString &media, const QString &filename);
|
||||
|
||||
private:
|
||||
void init();
|
||||
void setLabels(const QString &type, const QString &mime, uint64_t upload_size);
|
||||
|
||||
bool isImage_;
|
||||
QPixmap image_;
|
||||
|
||||
QByteArray data_;
|
||||
QString filePath_;
|
||||
QString mediaType_;
|
||||
|
||||
QLabel titleLabel_;
|
||||
QLabel infoLabel_;
|
||||
QLineEdit fileName_;
|
||||
|
||||
FlatButton upload_;
|
||||
FlatButton cancel_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -4,13 +4,13 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "RaisedButton.h"
|
||||
#include "Theme.h"
|
||||
#include "dialogs/ReCaptcha.h"
|
||||
|
||||
#include "dialogs/ReCaptcha.hpp"
|
||||
#include "Config.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/RaisedButton.h"
|
||||
#include "ui/Theme.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
|
|
|
|||
28
src/dialogs/ReCaptcha.h
Normal file
28
src/dialogs/ReCaptcha.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class FlatButton;
|
||||
class RaisedButton;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class ReCaptcha : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ReCaptcha(const QString &session, QWidget *parent = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void closing();
|
||||
|
||||
private:
|
||||
FlatButton *openCaptchaBtn_;
|
||||
RaisedButton *confirmBtn_;
|
||||
RaisedButton *cancelBtn_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -6,14 +6,14 @@
|
|||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "dialogs/ReadReceipts.h"
|
||||
|
||||
#include "AvatarProvider.h"
|
||||
#include "Cache.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Config.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include "Avatar.h"
|
||||
#include "AvatarProvider.h"
|
||||
#include "Cache.h"
|
||||
#include "dialogs/ReadReceipts.h"
|
||||
#include "ui/Avatar.h"
|
||||
|
||||
using namespace dialogs;
|
||||
|
||||
58
src/dialogs/ReadReceipts.h
Normal file
58
src/dialogs/ReadReceipts.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QListWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class Avatar;
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class ReceiptItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ReceiptItem(QWidget *parent,
|
||||
const QString &user_id,
|
||||
uint64_t timestamp,
|
||||
const QString &room_id);
|
||||
|
||||
private:
|
||||
QString dateFormat(const QDateTime &then) const;
|
||||
|
||||
QHBoxLayout *topLayout_;
|
||||
QVBoxLayout *textLayout_;
|
||||
|
||||
Avatar *avatar_;
|
||||
|
||||
QLabel *userName_;
|
||||
QLabel *timestamp_;
|
||||
};
|
||||
|
||||
class ReadReceipts : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ReadReceipts(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void addUsers(const std::multimap<uint64_t, std::string, std::greater<uint64_t>> &users);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void hideEvent(QHideEvent *event) override
|
||||
{
|
||||
userList_->clear();
|
||||
QFrame::hideEvent(event);
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel *topLabel_;
|
||||
|
||||
QListWidget *userList_;
|
||||
};
|
||||
} // dialogs
|
||||
|
|
@ -1,16 +1,3 @@
|
|||
#include "Avatar.h"
|
||||
#include "ChatPage.h"
|
||||
#include "Config.h"
|
||||
#include "FlatButton.h"
|
||||
#include "Logging.hpp"
|
||||
#include "MatrixClient.h"
|
||||
#include "Painter.h"
|
||||
#include "TextField.h"
|
||||
#include "Theme.h"
|
||||
#include "Utils.h"
|
||||
#include "dialogs/RoomSettings.hpp"
|
||||
#include "ui/ToggleButton.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
|
|
@ -22,6 +9,20 @@
|
|||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "dialogs/RoomSettings.h"
|
||||
|
||||
#include "ChatPage.h"
|
||||
#include "Config.h"
|
||||
#include "Logging.h"
|
||||
#include "MatrixClient.h"
|
||||
#include "Utils.h"
|
||||
#include "ui/Avatar.h"
|
||||
#include "ui/FlatButton.h"
|
||||
#include "ui/Painter.h"
|
||||
#include "ui/TextField.h"
|
||||
#include "ui/Theme.h"
|
||||
#include "ui/ToggleButton.h"
|
||||
|
||||
using namespace dialogs;
|
||||
using namespace mtx::events;
|
||||
|
||||
|
|
|
|||
126
src/dialogs/RoomSettings.h
Normal file
126
src/dialogs/RoomSettings.h
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
#pragma once
|
||||
|
||||
#include <QFrame>
|
||||
#include <QImage>
|
||||
|
||||
#include "Cache.h"
|
||||
|
||||
class Avatar;
|
||||
class FlatButton;
|
||||
class QComboBox;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QLabel;
|
||||
class QLayout;
|
||||
class QPixmap;
|
||||
class TextField;
|
||||
class TextField;
|
||||
class Toggle;
|
||||
|
||||
template<class T>
|
||||
class QSharedPointer;
|
||||
|
||||
class EditModal : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditModal(const QString &roomId, QWidget *parent = nullptr);
|
||||
|
||||
void setFields(const QString &roomName, const QString &roomTopic);
|
||||
|
||||
signals:
|
||||
void nameChanged(const QString &roomName);
|
||||
void nameEventSentCb(const QString &newName);
|
||||
void topicEventSentCb();
|
||||
void stateEventErrorCb(const QString &msg);
|
||||
|
||||
private:
|
||||
QString roomId_;
|
||||
QString initialName_;
|
||||
QString initialTopic_;
|
||||
|
||||
QLabel *errorField_;
|
||||
|
||||
TextField *nameInput_;
|
||||
TextField *topicInput_;
|
||||
|
||||
FlatButton *applyBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
};
|
||||
|
||||
class TopSection : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
|
||||
|
||||
public:
|
||||
TopSection(const RoomInfo &info, const QImage &img, QWidget *parent = nullptr);
|
||||
QSize sizeHint() const override;
|
||||
void setRoomName(const QString &name);
|
||||
|
||||
QColor textColor() const { return textColor_; }
|
||||
void setTextColor(QColor &color) { textColor_ = color; }
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
static constexpr int AvatarSize = 72;
|
||||
static constexpr int Padding = 5;
|
||||
|
||||
RoomInfo info_;
|
||||
QPixmap avatar_;
|
||||
QColor textColor_;
|
||||
};
|
||||
|
||||
namespace dialogs {
|
||||
|
||||
class RoomSettings : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RoomSettings(const QString &room_id, QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void closing();
|
||||
void enableEncryptionError(const QString &msg);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
static constexpr int AvatarSize = 64;
|
||||
|
||||
void setAvatar(const QImage &img) { avatarImg_ = img; }
|
||||
void setupEditButton();
|
||||
//! Retrieve the current room information from cache.
|
||||
void retrieveRoomInfo();
|
||||
void enableEncryption();
|
||||
|
||||
//! Whether the user would be able to change the name or the topic of the room.
|
||||
bool hasEditRights_ = true;
|
||||
bool usesEncryption_ = false;
|
||||
QHBoxLayout *editLayout_;
|
||||
|
||||
// Button section
|
||||
FlatButton *okBtn_;
|
||||
FlatButton *cancelBtn_;
|
||||
|
||||
FlatButton *editFieldsBtn_;
|
||||
|
||||
RoomInfo info_;
|
||||
QString room_id_;
|
||||
QImage avatarImg_;
|
||||
|
||||
TopSection *topSection_;
|
||||
|
||||
QComboBox *accessCombo;
|
||||
Toggle *encryptionToggle_;
|
||||
};
|
||||
|
||||
} // dialogs
|
||||
Loading…
Add table
Add a link
Reference in a new issue