mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
docs(widget): Change comment style
This commit is contained in:
parent
52ff1c2aa8
commit
1552bfb114
|
@ -89,9 +89,8 @@ void AboutUser::onSelectDirClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief AboutUser::onAcceptedClicked When users clicks the bottom OK button,
|
@brief Called when user clicks the bottom OK button, save all settings
|
||||||
* save all settings
|
*/
|
||||||
*/
|
|
||||||
void AboutUser::onAcceptedClicked()
|
void AboutUser::onAcceptedClicked()
|
||||||
{
|
{
|
||||||
ToxId toxId = ToxId(ui->publicKey->text());
|
ToxId toxId = ToxId(ui->publicKey->text());
|
||||||
|
|
|
@ -41,6 +41,11 @@
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@var QString AddFriendForm::lastUsername
|
||||||
|
@brief Cached username so we can retranslate the invite message
|
||||||
|
*/
|
||||||
|
|
||||||
AddFriendForm::AddFriendForm()
|
AddFriendForm::AddFriendForm()
|
||||||
{
|
{
|
||||||
tabWidget = new QTabWidget();
|
tabWidget = new QTabWidget();
|
||||||
|
|
|
@ -85,7 +85,7 @@ private:
|
||||||
QTextEdit message;
|
QTextEdit message;
|
||||||
QVBoxLayout layout, headLayout;
|
QVBoxLayout layout, headLayout;
|
||||||
QWidget *head, *main;
|
QWidget *head, *main;
|
||||||
QString lastUsername; // Cached username so we can retranslate the invite message
|
QString lastUsername;
|
||||||
QTabWidget* tabWidget;
|
QTabWidget* tabWidget;
|
||||||
QVBoxLayout* requestsLayout;
|
QVBoxLayout* requestsLayout;
|
||||||
QList<QPushButton*> acceptButtons;
|
QList<QPushButton*> acceptButtons;
|
||||||
|
|
|
@ -26,10 +26,13 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include "src/core/corestructs.h"
|
#include "src/core/corestructs.h"
|
||||||
#include "src/chatlog/chatmessage.h"
|
#include "src/chatlog/chatmessage.h"
|
||||||
#include "../../core/toxid.h"
|
#include "src/core/toxid.h"
|
||||||
|
|
||||||
// Spacing in px inserted when the author of the last message changes
|
/**
|
||||||
#define AUTHOR_CHANGE_SPACING 5 // why the hell is this a thing? surely the different font is enough?
|
Spacing in px inserted when the author of the last message changes
|
||||||
|
@note Why the hell is this a thing? surely the different font is enough?
|
||||||
|
*/
|
||||||
|
#define AUTHOR_CHANGE_SPACING 5
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
|
|
@ -37,6 +37,14 @@
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QtAlgorithms>
|
#include <QtAlgorithms>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@var QList<QLabel*> GroupChatForm::peerLabels
|
||||||
|
@brief Maps peernumbers to the QLabels in namesListLayout.
|
||||||
|
|
||||||
|
@var QMap<int, QTimer*> GroupChatForm::peerAudioTimers
|
||||||
|
@brief Timeout = peer stopped sending audio.
|
||||||
|
*/
|
||||||
|
|
||||||
GroupChatForm::GroupChatForm(Group* chatGroup)
|
GroupChatForm::GroupChatForm(Group* chatGroup)
|
||||||
: group(chatGroup), inCall{false}
|
: group(chatGroup), inCall{false}
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,8 +61,8 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Group* group;
|
Group* group;
|
||||||
QList<QLabel*> peerLabels; // maps peernumbers to the QLabels in namesListLayout
|
QList<QLabel*> peerLabels;
|
||||||
QMap<int, QTimer*> peerAudioTimers; // timeout = peer stopped sending audio
|
QMap<int, QTimer*> peerAudioTimers;
|
||||||
FlowLayout* namesListLayout;
|
FlowLayout* namesListLayout;
|
||||||
QLabel *nusersLabel;
|
QLabel *nusersLabel;
|
||||||
TabCompleter* tabber;
|
TabCompleter* tabber;
|
||||||
|
|
|
@ -20,15 +20,21 @@
|
||||||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This file was taken from the Quassel IRC client source (src/uisupport), and
|
/**
|
||||||
was greatly simplified for use in qTox. */
|
@file tabcompleter.h
|
||||||
|
@file tabcompleter.cpp
|
||||||
|
These files were taken from the Quassel IRC client source (src/uisupport), and
|
||||||
|
was greatly simplified for use in qTox.
|
||||||
|
*/
|
||||||
|
|
||||||
#include "tabcompleter.h"
|
#include "tabcompleter.h"
|
||||||
|
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include "src/core/core.h"
|
#include "src/core/core.h"
|
||||||
#include "src/group.h"
|
#include "src/group.h"
|
||||||
#include "src/widget/tool/chattextedit.h"
|
#include "src/widget/tool/chattextedit.h"
|
||||||
#include <QRegExp>
|
|
||||||
#include <QKeyEvent>
|
|
||||||
|
|
||||||
const QString TabCompleter::nickSuffix = QString(": ");
|
const QString TabCompleter::nickSuffix = QString(": ");
|
||||||
|
|
||||||
|
|
|
@ -20,18 +20,13 @@
|
||||||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This file was taken from the Quassel IRC client source (src/uisupport), and
|
|
||||||
was greatly simplified for use in qTox. */
|
|
||||||
|
|
||||||
#ifndef TABCOMPLETER_H
|
#ifndef TABCOMPLETER_H
|
||||||
#define TABCOMPLETER_H
|
#define TABCOMPLETER_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject> // I'm really confused why I need this
|
#include "src/group.h"
|
||||||
|
#include "src/widget/tool/chattextedit.h"
|
||||||
class ChatTextEdit;
|
|
||||||
class Group;
|
|
||||||
|
|
||||||
class TabCompleter : public QObject
|
class TabCompleter : public QObject
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,17 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class GUI
|
||||||
|
@brief Abstracts the GUI from the target backend (DesktopGUI, ...)
|
||||||
|
|
||||||
|
All the functions exposed here are thread-safe.
|
||||||
|
Prefer calling this class to calling a GUI backend directly.
|
||||||
|
|
||||||
|
@fn void GUI::resized()
|
||||||
|
@brief Emitted when the GUI is resized on supported platforms.
|
||||||
|
*/
|
||||||
|
|
||||||
GUI::GUI(QObject *parent) :
|
GUI::GUI(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +50,9 @@ GUI::GUI(QObject *parent) :
|
||||||
connect(Nexus::getDesktopGUI(), &Widget::resized, this, &GUI::resized);
|
connect(Nexus::getDesktopGUI(), &Widget::resized, this, &GUI::resized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Returns the singleton instance.
|
||||||
|
*/
|
||||||
GUI& GUI::getInstance()
|
GUI& GUI::getInstance()
|
||||||
{
|
{
|
||||||
static GUI gui;
|
static GUI gui;
|
||||||
|
@ -47,6 +61,9 @@ GUI& GUI::getInstance()
|
||||||
|
|
||||||
// Implementation of the public clean interface
|
// Implementation of the public clean interface
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Clear the GUI's contact list.
|
||||||
|
*/
|
||||||
void GUI::clearContacts()
|
void GUI::clearContacts()
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -55,6 +72,11 @@ void GUI::clearContacts()
|
||||||
QMetaObject::invokeMethod(&getInstance(), "_clearContacts", Qt::BlockingQueuedConnection);
|
QMetaObject::invokeMethod(&getInstance(), "_clearContacts", Qt::BlockingQueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Will enable or disable the GUI.
|
||||||
|
@note A disabled GUI can't be interacted with by the user.
|
||||||
|
@param state Enable/disable GUI.
|
||||||
|
*/
|
||||||
void GUI::setEnabled(bool state)
|
void GUI::setEnabled(bool state)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -68,6 +90,12 @@ void GUI::setEnabled(bool state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Change the title of the main window.
|
||||||
|
@param title Titile to set.
|
||||||
|
|
||||||
|
This is usually always visible to the user.
|
||||||
|
*/
|
||||||
void GUI::setWindowTitle(const QString& title)
|
void GUI::setWindowTitle(const QString& title)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -81,6 +109,9 @@ void GUI::setWindowTitle(const QString& title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Reloads the application theme and redraw the window.
|
||||||
|
*/
|
||||||
void GUI::reloadTheme()
|
void GUI::reloadTheme()
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -93,6 +124,9 @@ void GUI::reloadTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Optionally switches to a view of the qTox update being downloaded.
|
||||||
|
*/
|
||||||
void GUI::showUpdateDownloadProgress()
|
void GUI::showUpdateDownloadProgress()
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -105,6 +139,11 @@ void GUI::showUpdateDownloadProgress()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Show some text to the user.
|
||||||
|
@param title Title of information window.
|
||||||
|
@param msg Text in information window.
|
||||||
|
*/
|
||||||
void GUI::showInfo(const QString& title, const QString& msg)
|
void GUI::showInfo(const QString& title, const QString& msg)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -118,6 +157,11 @@ void GUI::showInfo(const QString& title, const QString& msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Show a warning to the user
|
||||||
|
@param title Title of warning window.
|
||||||
|
@param msg Text in warning window.
|
||||||
|
*/
|
||||||
void GUI::showWarning(const QString& title, const QString& msg)
|
void GUI::showWarning(const QString& title, const QString& msg)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -131,6 +175,11 @@ void GUI::showWarning(const QString& title, const QString& msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Show an error to the user.
|
||||||
|
@param title Title of error window.
|
||||||
|
@param msg Text in error window.
|
||||||
|
*/
|
||||||
void GUI::showError(const QString& title, const QString& msg)
|
void GUI::showError(const QString& title, const QString& msg)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -149,6 +198,15 @@ void GUI::showError(const QString& title, const QString& msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Asks the user a question with Ok/Cansel or Yes/No buttons.
|
||||||
|
@param title Title of question window.
|
||||||
|
@param msg Text in question window.
|
||||||
|
@param defaultAns If is true, default was positive answer. Negative otherwise.
|
||||||
|
@param warning If is true, we will use a special warning style.
|
||||||
|
@param yesno Show "Yes" and "No" buttons.
|
||||||
|
@return True if the answer is positive, false otherwise.
|
||||||
|
*/
|
||||||
bool GUI::askQuestion(const QString& title, const QString& msg,
|
bool GUI::askQuestion(const QString& title, const QString& msg,
|
||||||
bool defaultAns, bool warning,
|
bool defaultAns, bool warning,
|
||||||
bool yesno)
|
bool yesno)
|
||||||
|
@ -169,6 +227,18 @@ bool GUI::askQuestion(const QString& title, const QString& msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Asks the user a question.
|
||||||
|
|
||||||
|
The text for the displayed buttons can be specified.
|
||||||
|
@param title Title of question window.
|
||||||
|
@param msg Text in question window.
|
||||||
|
@param button1 Text of positive button.
|
||||||
|
@param button2 Text of negative button.
|
||||||
|
@param defaultAns If is true, default was positive answer. Negative otherwise.
|
||||||
|
@param warning If is true, we will use a special warning style.
|
||||||
|
@return True if the answer is positive, false otherwise.
|
||||||
|
*/
|
||||||
bool GUI::askQuestion(const QString& title, const QString& msg,
|
bool GUI::askQuestion(const QString& title, const QString& msg,
|
||||||
const QString& button1, const QString& button2,
|
const QString& button1, const QString& button2,
|
||||||
bool defaultAns, bool warning)
|
bool defaultAns, bool warning)
|
||||||
|
@ -188,6 +258,21 @@ bool GUI::askQuestion(const QString& title, const QString& msg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Asks the user to input text and returns the answer.
|
||||||
|
|
||||||
|
The interface is equivalent to QInputDialog::getItem()
|
||||||
|
@param parent Is the dialog's parent widget
|
||||||
|
@param title Is the text which is displayed in the title bar of the dialog.
|
||||||
|
@param label Is the text which is shown to the user (it should say what should be entered).
|
||||||
|
@param items Is the string list which is inserted into the combobox.
|
||||||
|
@param current Is the number of the item which should be the current item.
|
||||||
|
@param editable If is true the user can enter their own text, otherwise the user may only select one of the existing items.
|
||||||
|
@param ok If is nonnull will be set to true if the user pressed OK and to false if the user pressed Cancel.
|
||||||
|
@param flags The dialog will uses to widget flags.
|
||||||
|
@param hints Is the input method hints that will be used if the combobox is editable and an input method is active.
|
||||||
|
@return This function returns the text of the current item, or if editable is true, the current text of the combobox.
|
||||||
|
*/
|
||||||
QString GUI::itemInputDialog(QWidget * parent, const QString & title,
|
QString GUI::itemInputDialog(QWidget * parent, const QString & title,
|
||||||
const QString & label, const QStringList & items,
|
const QString & label, const QStringList & items,
|
||||||
int current, bool editable, bool * ok,
|
int current, bool editable, bool * ok,
|
||||||
|
@ -211,6 +296,12 @@ QString GUI::itemInputDialog(QWidget * parent, const QString & title,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Asks the user to answer a password.
|
||||||
|
@param cancel Is the text on the cancel button.
|
||||||
|
@param body Is descriptive text that will be shown to the user.
|
||||||
|
@return Entered password.
|
||||||
|
*/
|
||||||
QString GUI::passwordDialog(const QString& cancel, const QString& body)
|
QString GUI::passwordDialog(const QString& cancel, const QString& body)
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread())
|
if (QThread::currentThread() == qApp->thread())
|
||||||
|
@ -369,6 +460,10 @@ QString GUI::_passwordDialog(const QString& cancel, const QString& body)
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Get the main widget.
|
||||||
|
@return The main QWidget* of the application
|
||||||
|
*/
|
||||||
QWidget* GUI::getMainWidget()
|
QWidget* GUI::getMainWidget()
|
||||||
{
|
{
|
||||||
QWidget* maingui{nullptr};
|
QWidget* maingui{nullptr};
|
||||||
|
|
|
@ -25,69 +25,44 @@
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
/// Abstracts the GUI from the target backend (DesktopGUI, ...)
|
|
||||||
/// All the functions exposed here are thread-safe
|
|
||||||
/// Prefer calling this class to calling a GUI backend directly
|
|
||||||
class GUI : public QObject
|
class GUI : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static GUI& getInstance();
|
static GUI& getInstance();
|
||||||
/// Returns the main QWidget* of the application
|
|
||||||
static QWidget* getMainWidget();
|
static QWidget* getMainWidget();
|
||||||
/// Clear the GUI's contact list
|
|
||||||
static void clearContacts();
|
static void clearContacts();
|
||||||
/// Will enable or disable the GUI.
|
|
||||||
/// A disabled GUI can't be interacted with by the user
|
|
||||||
static void setEnabled(bool state);
|
static void setEnabled(bool state);
|
||||||
/// Change the title of the main window
|
|
||||||
/// This is usually always visible to the user
|
|
||||||
static void setWindowTitle(const QString& title);
|
static void setWindowTitle(const QString& title);
|
||||||
/// Reloads the application theme and redraw the window
|
|
||||||
static void reloadTheme();
|
static void reloadTheme();
|
||||||
/// Optionally switches to a view of the qTox update being downloaded
|
|
||||||
static void showUpdateDownloadProgress();
|
static void showUpdateDownloadProgress();
|
||||||
/// Show some text to the user, for example in a message box
|
|
||||||
static void showInfo(const QString& title, const QString& msg);
|
static void showInfo(const QString& title, const QString& msg);
|
||||||
/// Show a warning to the user, for example in a message box
|
|
||||||
static void showWarning(const QString& title, const QString& msg);
|
static void showWarning(const QString& title, const QString& msg);
|
||||||
/// Show an error to the user, for example in a message box
|
|
||||||
static void showError(const QString& title, const QString& msg);
|
static void showError(const QString& title, const QString& msg);
|
||||||
/// Asks the user a question, for example in a message box.
|
|
||||||
/// If warning is true, we will use a special warning style.
|
|
||||||
/// Returns the answer.
|
|
||||||
static bool askQuestion(const QString& title, const QString& msg,
|
static bool askQuestion(const QString& title, const QString& msg,
|
||||||
bool defaultAns = false, bool warning = true,
|
bool defaultAns = false, bool warning = true,
|
||||||
bool yesno = true);
|
bool yesno = true);
|
||||||
/// Asks the user a question, for example in a message box.
|
|
||||||
/// The text for the displayed buttons can be specified.
|
|
||||||
/// If warning is true, we will use a special warning style.
|
|
||||||
/// Returns the answer.
|
|
||||||
static bool askQuestion(const QString& title, const QString& msg,
|
static bool askQuestion(const QString& title, const QString& msg,
|
||||||
const QString& button1, const QString& button2,
|
const QString& button1, const QString& button2,
|
||||||
bool defaultAns = false, bool warning = true);
|
bool defaultAns = false, bool warning = true);
|
||||||
/// Asks the user to input text and returns the answer.
|
|
||||||
/// The interface is equivalent to QInputDialog::getItem()
|
|
||||||
static QString itemInputDialog(QWidget * parent, const QString & title,
|
static QString itemInputDialog(QWidget * parent, const QString & title,
|
||||||
const QString & label, const QStringList & items,
|
const QString & label, const QStringList & items,
|
||||||
int current = 0, bool editable = true, bool * ok = 0,
|
int current = 0, bool editable = true, bool * ok = 0,
|
||||||
Qt::WindowFlags flags = 0,
|
Qt::WindowFlags flags = 0,
|
||||||
Qt::InputMethodHints hints = Qt::ImhNone);
|
Qt::InputMethodHints hints = Qt::ImhNone);
|
||||||
/// Asks the user to answer a password
|
|
||||||
/// cancel is the text on the cancel button and body
|
|
||||||
/// is descriptive text that will be shown to the user
|
|
||||||
static QString passwordDialog(const QString& cancel, const QString& body);
|
static QString passwordDialog(const QString& cancel, const QString& body);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// Emitted when the GUI is resized on supported platforms
|
|
||||||
/// Guaranteed to work on desktop platforms
|
|
||||||
void resized();
|
void resized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit GUI(QObject *parent = 0);
|
explicit GUI(QObject *parent = 0);
|
||||||
|
|
||||||
// Private implementation, those must be called from the GUI thread
|
|
||||||
private slots:
|
private slots:
|
||||||
|
// Private implementation, those must be called from the GUI thread
|
||||||
void _clearContacts();
|
void _clearContacts();
|
||||||
void _setEnabled(bool state);
|
void _setEnabled(bool state);
|
||||||
void _setWindowTitle(const QString& title);
|
void _setWindowTitle(const QString& title);
|
||||||
|
|
|
@ -71,6 +71,9 @@ LoginScreen::~LoginScreen()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Resets the UI, clears all fields.
|
||||||
|
*/
|
||||||
void LoginScreen::reset()
|
void LoginScreen::reset()
|
||||||
{
|
{
|
||||||
ui->newUsername->clear();
|
ui->newUsername->clear();
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LoginScreen : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit LoginScreen(QWidget *parent = 0);
|
explicit LoginScreen(QWidget *parent = 0);
|
||||||
~LoginScreen();
|
~LoginScreen();
|
||||||
void reset(); ///< Resets the UI, clears all fields
|
void reset();
|
||||||
|
|
||||||
bool event(QEvent* event) final override;
|
bool event(QEvent* event) final override;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,14 @@
|
||||||
#include "maskablepixmapwidget.h"
|
#include "maskablepixmapwidget.h"
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@var QPixmap* MaskablePixmapWidget::renderTarget
|
||||||
|
@brief pointer to dynamically call the constructor.
|
||||||
|
*/
|
||||||
|
|
||||||
MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName)
|
MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
, renderTarget(nullptr)
|
||||||
, maskName(maskName)
|
, maskName(maskName)
|
||||||
, clickable(false)
|
, clickable(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,8 +42,8 @@ protected:
|
||||||
virtual void mousePressEvent(QMouseEvent *) final override;
|
virtual void mousePressEvent(QMouseEvent *) final override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap pixmap, mask, unscaled; // a lot of memory...
|
QPixmap pixmap, mask, unscaled;
|
||||||
QPixmap* renderTarget = nullptr; // pointer to dynamically call the constructor
|
QPixmap* renderTarget;
|
||||||
QSize size;
|
QSize size;
|
||||||
QString maskName;
|
QString maskName;
|
||||||
bool clickable;
|
bool clickable;
|
||||||
|
|
|
@ -67,16 +67,16 @@ void NotificationScrollArea::trackWidget(GenericChatroomWidget* widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete notification bar to visible elements on scroll area
|
@brief Delete notification bar from visible elements on scroll area
|
||||||
*/
|
*/
|
||||||
void NotificationScrollArea::updateVisualTracking() {
|
void NotificationScrollArea::updateVisualTracking() {
|
||||||
updateTracking(nullptr);
|
updateTracking(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete notification bar from visible elements and widget on scroll area
|
@brief Delete notification bar from visible elements and widget on scroll area
|
||||||
* @param widget Chatroom widget to remove from tracked widgets
|
@param widget Chatroom widget to remove from tracked widgets
|
||||||
*/
|
*/
|
||||||
void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget)
|
void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget)
|
||||||
{
|
{
|
||||||
QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
|
QHash<GenericChatroomWidget*, Visibility>::iterator i = trackedWidgets.begin();
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
@file qrwidget.cpp
|
||||||
|
@link https://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c
|
||||||
|
*/
|
||||||
|
|
||||||
QRWidget::QRWidget(QWidget *parent) : QWidget(parent), data("0")
|
QRWidget::QRWidget(QWidget *parent) : QWidget(parent), data("0")
|
||||||
//Note: The encoding fails with empty string so I just default to something else.
|
//Note: The encoding fails with empty string so I just default to something else.
|
||||||
//Use the setQRData() call to change this.
|
//Use the setQRData() call to change this.
|
||||||
|
@ -58,10 +63,10 @@ QImage* QRWidget::getImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QRWidget::saveImage
|
@brief QRWidget::saveImage
|
||||||
* @param path Full path to the file with extension.
|
@param path Full path to the file with extension.
|
||||||
* @return indicate if saving was successful.
|
@return indicate if saving was successful.
|
||||||
*/
|
*/
|
||||||
bool QRWidget::saveImage(QString path)
|
bool QRWidget::saveImage(QString path)
|
||||||
{
|
{
|
||||||
return image->save(path, 0, 75); //0 - image format same as file extension, 75-quality, png file is ~6.3kb
|
return image->save(path, 0, 75); //0 - image format same as file extension, 75-quality, png file is ~6.3kb
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#ifndef QRWIDGET_H
|
#ifndef QRWIDGET_H
|
||||||
#define QRWIDGET_H
|
#define QRWIDGET_H
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QRWidget : public QWidget
|
class QRWidget : public QWidget
|
||||||
|
|
|
@ -31,6 +31,31 @@
|
||||||
#include <QSvgRenderer>
|
#include <QSvgRenderer>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@enum Style::Font
|
||||||
|
|
||||||
|
@var ExtraBig
|
||||||
|
@brief [SystemDefault + 2]px, bold
|
||||||
|
|
||||||
|
@var Big
|
||||||
|
@brief [SystemDefault]px
|
||||||
|
|
||||||
|
@var BigBold
|
||||||
|
@brief [SystemDefault]px, bold
|
||||||
|
|
||||||
|
@var Medium
|
||||||
|
@brief [SystemDefault - 1]px
|
||||||
|
|
||||||
|
@var MediumBold
|
||||||
|
@brief [SystemDefault - 1]px, bold
|
||||||
|
|
||||||
|
@var Small
|
||||||
|
@brief [SystemDefault - 2]px
|
||||||
|
|
||||||
|
@var SmallLight
|
||||||
|
@brief [SystemDefault - 2]px, light
|
||||||
|
*/
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
QFont appFont(int pixelSize, int weight)
|
QFont appFont(int pixelSize, int weight)
|
||||||
{
|
{
|
||||||
|
@ -181,6 +206,12 @@ void Style::setThemeColor(int color)
|
||||||
setThemeColor(themeColorColors[color]);
|
setThemeColor(themeColorColors[color]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Set theme color.
|
||||||
|
@param color Color to set.
|
||||||
|
|
||||||
|
Pass an invalid QColor to reset to defaults.
|
||||||
|
*/
|
||||||
void Style::setThemeColor(const QColor &color)
|
void Style::setThemeColor(const QColor &color)
|
||||||
{
|
{
|
||||||
if (!color.isValid())
|
if (!color.isValid())
|
||||||
|
@ -205,6 +236,9 @@ void Style::setThemeColor(const QColor &color)
|
||||||
dict["@themeLight"] = getColor(ThemeLight).name();
|
dict["@themeLight"] = getColor(ThemeLight).name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Reloads some CCS
|
||||||
|
*/
|
||||||
void Style::applyTheme()
|
void Style::applyTheme()
|
||||||
{
|
{
|
||||||
GUI::reloadTheme();
|
GUI::reloadTheme();
|
||||||
|
|
|
@ -49,13 +49,13 @@ public:
|
||||||
|
|
||||||
enum Font
|
enum Font
|
||||||
{
|
{
|
||||||
ExtraBig, // [SystemDefault + 2]px, bold
|
ExtraBig,
|
||||||
Big, // [SystemDefault ]px
|
Big,
|
||||||
BigBold, // [SystemDefault ]px, bold
|
BigBold,
|
||||||
Medium, // [SystemDefault - 1]px
|
Medium,
|
||||||
MediumBold, // [SystemDefault - 1]px, bold
|
MediumBold,
|
||||||
Small, // [SystemDefault - 2]px
|
Small,
|
||||||
SmallLight // [SystemDefault - 2]px, light
|
SmallLight
|
||||||
};
|
};
|
||||||
|
|
||||||
static QStringList getThemeColorNames();
|
static QStringList getThemeColorNames();
|
||||||
|
@ -65,8 +65,8 @@ public:
|
||||||
static QString resolve(QString qss, const QFont& baseFont = QFont());
|
static QString resolve(QString qss, const QFont& baseFont = QFont());
|
||||||
static void repolish(QWidget* w);
|
static void repolish(QWidget* w);
|
||||||
static void setThemeColor(int color);
|
static void setThemeColor(int color);
|
||||||
static void setThemeColor(const QColor &color); ///< Pass an invalid QColor to reset to defaults
|
static void setThemeColor(const QColor &color);
|
||||||
static void applyTheme(); ///< Reloads some CCS
|
static void applyTheme();
|
||||||
static QPixmap scaleSvgImage(const QString& path, uint32_t width, uint32_t height);
|
static QPixmap scaleSvgImage(const QString& path, uint32_t width, uint32_t height);
|
||||||
|
|
||||||
static QList<QColor> themeColorColors;
|
static QList<QColor> themeColorColors;
|
||||||
|
|
|
@ -31,6 +31,26 @@
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
|
||||||
|
/**
|
||||||
|
@class CallConfirmWidget
|
||||||
|
@brief This is a widget with dialog buttons to accept/reject a call
|
||||||
|
|
||||||
|
It tracks the position of another widget called the anchor
|
||||||
|
and looks like a bubble at the bottom of that widget.
|
||||||
|
|
||||||
|
@var const QWidget* CallConfirmWidget::anchor
|
||||||
|
@brief The widget we're going to be tracking
|
||||||
|
|
||||||
|
@var const Friend& CallConfirmWidget::f
|
||||||
|
@brief The friend on whose chat form we should appear
|
||||||
|
|
||||||
|
@var const int CallConfirmWidget::roundedFactor
|
||||||
|
@brief By how much are the corners of the main rect rounded
|
||||||
|
|
||||||
|
@var const qreal CallConfirmWidget::rectRatio
|
||||||
|
@brief Used to correct the rounding factors on non-square rects
|
||||||
|
*/
|
||||||
|
|
||||||
CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor, const Friend& f) :
|
CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor, const Friend& f) :
|
||||||
QWidget(), anchor(Anchor), f(f),
|
QWidget(), anchor(Anchor), f(f),
|
||||||
rectW{120}, rectH{85},
|
rectW{120}, rectH{85},
|
||||||
|
@ -75,6 +95,9 @@ CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor, const Friend& f) :
|
||||||
reposition();
|
reposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Recalculate our positions to track the anchor
|
||||||
|
*/
|
||||||
void CallConfirmWidget::reposition()
|
void CallConfirmWidget::reposition()
|
||||||
{
|
{
|
||||||
if (parentWidget())
|
if (parentWidget())
|
||||||
|
|
|
@ -30,9 +30,6 @@ class QPaintEvent;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
class Friend;
|
class Friend;
|
||||||
|
|
||||||
/// This is a widget with dialog buttons to accept/reject a call
|
|
||||||
/// It tracks the position of another widget called the anchor
|
|
||||||
/// and looks like a bubble at the bottom of that widget.
|
|
||||||
class CallConfirmWidget final : public QWidget
|
class CallConfirmWidget final : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -44,7 +41,7 @@ signals:
|
||||||
void rejected();
|
void rejected();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reposition(); ///< Recalculate our positions to track the anchor
|
void reposition();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent* event) final override;
|
virtual void paintEvent(QPaintEvent* event) final override;
|
||||||
|
@ -53,8 +50,8 @@ protected:
|
||||||
virtual bool eventFilter(QObject *, QEvent* event) final override;
|
virtual bool eventFilter(QObject *, QEvent* event) final override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QWidget* anchor; ///< The widget we're going to be tracking
|
const QWidget* anchor;
|
||||||
const Friend& f; ///< The friend on whose chat form we should appear
|
const Friend& f;
|
||||||
|
|
||||||
QRect mainRect;
|
QRect mainRect;
|
||||||
QPolygon spikePoly;
|
QPolygon spikePoly;
|
||||||
|
@ -62,8 +59,8 @@ private:
|
||||||
|
|
||||||
const int rectW, rectH;
|
const int rectW, rectH;
|
||||||
const int spikeW, spikeH;
|
const int spikeW, spikeH;
|
||||||
const int roundedFactor; ///< By how much are the corners of the main rect rounded
|
const int roundedFactor;
|
||||||
const qreal rectRatio; ///< Used to correct the rounding factors on non-square rects
|
const qreal rectRatio;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CALLCONFIRMWIDGET_H
|
#endif // CALLCONFIRMWIDGET_H
|
||||||
|
|
|
@ -151,6 +151,10 @@ void CroppingLabel::showTextEdit()
|
||||||
textEdit->setFocusPolicy(Qt::ClickFocus);
|
textEdit->setFocusPolicy(Qt::ClickFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Get original full text.
|
||||||
|
@return The un-cropped text.
|
||||||
|
*/
|
||||||
QString CroppingLabel::fullText()
|
QString CroppingLabel::fullText()
|
||||||
{
|
{
|
||||||
return origText;
|
return origText;
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
void setEdlideMode(Qt::TextElideMode elide);
|
void setEdlideMode(Qt::TextElideMode elide);
|
||||||
|
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
QString fullText(); ///< Returns the un-cropped text
|
QString fullText();
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -192,10 +192,9 @@ void ScreenshotGrabber::chooseHelperTooltipText(QRect rect)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
@internal
|
||||||
*
|
@brief Align the tooltip centered at top of screen with the mouse cursor.
|
||||||
* Align the tooltip centred at top of screen with the mouse cursor.
|
*/
|
||||||
*/
|
|
||||||
void ScreenshotGrabber::adjustTooltipPosition()
|
void ScreenshotGrabber::adjustTooltipPosition()
|
||||||
{
|
{
|
||||||
QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry();
|
QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry();
|
||||||
|
|
|
@ -33,6 +33,9 @@ QTranslator* Translator::translator{nullptr};
|
||||||
QVector<Translator::Callback> Translator::callbacks;
|
QVector<Translator::Callback> Translator::callbacks;
|
||||||
QMutex Translator::lock;
|
QMutex Translator::lock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Loads the translations according to the settings or locale.
|
||||||
|
*/
|
||||||
void Translator::translate()
|
void Translator::translate()
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&lock};
|
QMutexLocker locker{&lock};
|
||||||
|
@ -76,12 +79,21 @@ void Translator::translate()
|
||||||
pair.second();
|
pair.second();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Register a function to be called when the UI needs to be retranslated.
|
||||||
|
@param f Function, wich will called.
|
||||||
|
@param owner Widget to retanslate.
|
||||||
|
*/
|
||||||
void Translator::registerHandler(std::function<void()> f, void *owner)
|
void Translator::registerHandler(std::function<void()> f, void *owner)
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&lock};
|
QMutexLocker locker{&lock};
|
||||||
callbacks.push_back({owner, f});
|
callbacks.push_back({owner, f});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Unregisters all handlers of an owner.
|
||||||
|
@param owner Owner to unregister.
|
||||||
|
*/
|
||||||
void Translator::unregister(void *owner)
|
void Translator::unregister(void *owner)
|
||||||
{
|
{
|
||||||
QMutexLocker locker{&lock};
|
QMutexLocker locker{&lock};
|
||||||
|
|
|
@ -31,11 +31,8 @@ class QTranslator;
|
||||||
class Translator
|
class Translator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Loads the translations according to the settings or locale
|
|
||||||
static void translate();
|
static void translate();
|
||||||
/// Register a function to be called when the UI needs to be retranslated
|
|
||||||
static void registerHandler(std::function<void()>, void* owner);
|
static void registerHandler(std::function<void()>, void* owner);
|
||||||
/// Unregisters all handlers of an owner
|
|
||||||
static void unregister(void* owner);
|
static void unregister(void* owner);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -537,6 +537,9 @@ Widget::~Widget()
|
||||||
instance = nullptr;
|
instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Returns the singleton instance.
|
||||||
|
*/
|
||||||
Widget* Widget::getInstance()
|
Widget* Widget::getInstance()
|
||||||
{
|
{
|
||||||
if (!instance)
|
if (!instance)
|
||||||
|
@ -545,6 +548,9 @@ Widget* Widget::getInstance()
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Switches to the About settings page.
|
||||||
|
*/
|
||||||
void Widget::showUpdateDownloadProgress()
|
void Widget::showUpdateDownloadProgress()
|
||||||
{
|
{
|
||||||
settingsWidget->showAbout();
|
settingsWidget->showAbout();
|
||||||
|
@ -1704,6 +1710,9 @@ void Widget::onEmptyGroupCreated(int groupId)
|
||||||
group->getGroupWidget()->editName();
|
group->getGroupWidget()->editName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief Used to reset the blinking icon.
|
||||||
|
*/
|
||||||
void Widget::resetIcon() {
|
void Widget::resetIcon() {
|
||||||
eventIcon = false;
|
eventIcon = false;
|
||||||
eventFlag = false;
|
eventFlag = false;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
QString getUsername();
|
QString getUsername();
|
||||||
Camera* getCamera();
|
Camera* getCamera();
|
||||||
static Widget* getInstance();
|
static Widget* getInstance();
|
||||||
void showUpdateDownloadProgress(); ///< Switches to the About settings page
|
void showUpdateDownloadProgress();
|
||||||
void addFriendDialog(Friend* frnd, ContentDialog* dialog);
|
void addFriendDialog(Friend* frnd, ContentDialog* dialog);
|
||||||
void addGroupDialog(Group* group, ContentDialog* dialog);
|
void addGroupDialog(Group* group, ContentDialog* dialog);
|
||||||
bool newFriendMessageAlert(int friendId, bool sound=true);
|
bool newFriendMessageAlert(int friendId, bool sound=true);
|
||||||
|
@ -106,7 +106,6 @@ public:
|
||||||
void searchItem(GenericChatItemWidget* chatItem, GenericChatItemWidget::ItemType type);
|
void searchItem(GenericChatItemWidget* chatItem, GenericChatItemWidget::ItemType type);
|
||||||
bool groupsVisible() const;
|
bool groupsVisible() const;
|
||||||
|
|
||||||
// Used to reset the blinking icon
|
|
||||||
void resetIcon();
|
void resetIcon();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user