diff --git a/src/widget/about/aboutuser.cpp b/src/widget/about/aboutuser.cpp index 8a2856dbf..da51ed64b 100644 --- a/src/widget/about/aboutuser.cpp +++ b/src/widget/about/aboutuser.cpp @@ -89,9 +89,8 @@ void AboutUser::onSelectDirClicked() } /** - * @brief AboutUser::onAcceptedClicked When users clicks the bottom OK button, - * save all settings - */ +@brief Called when user clicks the bottom OK button, save all settings +*/ void AboutUser::onAcceptedClicked() { ToxId toxId = ToxId(ui->publicKey->text()); diff --git a/src/widget/form/addfriendform.cpp b/src/widget/form/addfriendform.cpp index 4c21e09be..9d2e47c13 100644 --- a/src/widget/form/addfriendform.cpp +++ b/src/widget/form/addfriendform.cpp @@ -41,6 +41,11 @@ #include #include +/** +@var QString AddFriendForm::lastUsername +@brief Cached username so we can retranslate the invite message +*/ + AddFriendForm::AddFriendForm() { tabWidget = new QTabWidget(); diff --git a/src/widget/form/addfriendform.h b/src/widget/form/addfriendform.h index c92fdc4c5..dadffe748 100644 --- a/src/widget/form/addfriendform.h +++ b/src/widget/form/addfriendform.h @@ -85,7 +85,7 @@ private: QTextEdit message; QVBoxLayout layout, headLayout; QWidget *head, *main; - QString lastUsername; // Cached username so we can retranslate the invite message + QString lastUsername; QTabWidget* tabWidget; QVBoxLayout* requestsLayout; QList acceptButtons; diff --git a/src/widget/form/genericchatform.h b/src/widget/form/genericchatform.h index 985c0a21e..749e51607 100644 --- a/src/widget/form/genericchatform.h +++ b/src/widget/form/genericchatform.h @@ -26,10 +26,13 @@ #include #include "src/core/corestructs.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 QVBoxLayout; diff --git a/src/widget/form/groupchatform.cpp b/src/widget/form/groupchatform.cpp index f12a4194e..81003fb78 100644 --- a/src/widget/form/groupchatform.cpp +++ b/src/widget/form/groupchatform.cpp @@ -37,6 +37,14 @@ #include #include +/** +@var QList GroupChatForm::peerLabels +@brief Maps peernumbers to the QLabels in namesListLayout. + +@var QMap GroupChatForm::peerAudioTimers +@brief Timeout = peer stopped sending audio. +*/ + GroupChatForm::GroupChatForm(Group* chatGroup) : group(chatGroup), inCall{false} { diff --git a/src/widget/form/groupchatform.h b/src/widget/form/groupchatform.h index b25ccb38d..3703971d4 100644 --- a/src/widget/form/groupchatform.h +++ b/src/widget/form/groupchatform.h @@ -61,8 +61,8 @@ private: private: Group* group; - QList peerLabels; // maps peernumbers to the QLabels in namesListLayout - QMap peerAudioTimers; // timeout = peer stopped sending audio + QList peerLabels; + QMap peerAudioTimers; FlowLayout* namesListLayout; QLabel *nusersLabel; TabCompleter* tabber; diff --git a/src/widget/form/tabcompleter.cpp b/src/widget/form/tabcompleter.cpp index 38f5a13a2..a660cf078 100644 --- a/src/widget/form/tabcompleter.cpp +++ b/src/widget/form/tabcompleter.cpp @@ -20,15 +20,21 @@ along with qTox. If not, see . */ -/* 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 +#include + #include "src/core/core.h" #include "src/group.h" #include "src/widget/tool/chattextedit.h" -#include -#include const QString TabCompleter::nickSuffix = QString(": "); diff --git a/src/widget/form/tabcompleter.h b/src/widget/form/tabcompleter.h index fe447853d..70047458f 100644 --- a/src/widget/form/tabcompleter.h +++ b/src/widget/form/tabcompleter.h @@ -20,18 +20,13 @@ along with qTox. If not, see . */ -/* This file was taken from the Quassel IRC client source (src/uisupport), and - was greatly simplified for use in qTox. */ - #ifndef TABCOMPLETER_H #define TABCOMPLETER_H #include #include -#include // I'm really confused why I need this - -class ChatTextEdit; -class Group; +#include "src/group.h" +#include "src/widget/tool/chattextedit.h" class TabCompleter : public QObject { diff --git a/src/widget/gui.cpp b/src/widget/gui.cpp index 35eb6921a..4fa6de5e1 100644 --- a/src/widget/gui.cpp +++ b/src/widget/gui.cpp @@ -31,6 +31,17 @@ #include #include +/** +@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) : QObject(parent) { @@ -39,6 +50,9 @@ GUI::GUI(QObject *parent) : connect(Nexus::getDesktopGUI(), &Widget::resized, this, &GUI::resized); } +/** +@brief Returns the singleton instance. +*/ GUI& GUI::getInstance() { static GUI gui; @@ -47,6 +61,9 @@ GUI& GUI::getInstance() // Implementation of the public clean interface +/** +@brief Clear the GUI's contact list. +*/ void GUI::clearContacts() { if (QThread::currentThread() == qApp->thread()) @@ -55,6 +72,11 @@ void GUI::clearContacts() 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) { 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) { 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() { 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() { 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) { 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) { 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) { 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 defaultAns, bool warning, 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, const QString& button1, const QString& button2, 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, const QString & label, const QStringList & items, 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) { if (QThread::currentThread() == qApp->thread()) @@ -369,6 +460,10 @@ QString GUI::_passwordDialog(const QString& cancel, const QString& body) // Other +/** +@brief Get the main widget. +@return The main QWidget* of the application +*/ QWidget* GUI::getMainWidget() { QWidget* maingui{nullptr}; diff --git a/src/widget/gui.h b/src/widget/gui.h index bdbd96ba9..749adc018 100644 --- a/src/widget/gui.h +++ b/src/widget/gui.h @@ -25,69 +25,44 @@ 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 { Q_OBJECT public: static GUI& getInstance(); - /// Returns the main QWidget* of the application static QWidget* getMainWidget(); - /// Clear the GUI's contact list 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); - /// Change the title of the main window - /// This is usually always visible to the user static void setWindowTitle(const QString& title); - /// Reloads the application theme and redraw the window static void reloadTheme(); - /// Optionally switches to a view of the qTox update being downloaded static void showUpdateDownloadProgress(); - /// Show some text to the user, for example in a message box 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); - /// Show an error to the user, for example in a message box 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, bool defaultAns = false, bool warning = 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, const QString& button1, const QString& button2, 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, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0, Qt::WindowFlags flags = 0, 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); signals: - /// Emitted when the GUI is resized on supported platforms - /// Guaranteed to work on desktop platforms void resized(); private: explicit GUI(QObject *parent = 0); - // Private implementation, those must be called from the GUI thread private slots: + // Private implementation, those must be called from the GUI thread void _clearContacts(); void _setEnabled(bool state); void _setWindowTitle(const QString& title); diff --git a/src/widget/loginscreen.cpp b/src/widget/loginscreen.cpp index 65d97e54b..4a92fd01f 100644 --- a/src/widget/loginscreen.cpp +++ b/src/widget/loginscreen.cpp @@ -71,6 +71,9 @@ LoginScreen::~LoginScreen() delete ui; } +/** +@brief Resets the UI, clears all fields. +*/ void LoginScreen::reset() { ui->newUsername->clear(); diff --git a/src/widget/loginscreen.h b/src/widget/loginscreen.h index 7978f03bd..2bfe220a9 100644 --- a/src/widget/loginscreen.h +++ b/src/widget/loginscreen.h @@ -36,7 +36,7 @@ class LoginScreen : public QWidget public: explicit LoginScreen(QWidget *parent = 0); ~LoginScreen(); - void reset(); ///< Resets the UI, clears all fields + void reset(); bool event(QEvent* event) final override; diff --git a/src/widget/maskablepixmapwidget.cpp b/src/widget/maskablepixmapwidget.cpp index 3791c8a5d..8409108a7 100644 --- a/src/widget/maskablepixmapwidget.cpp +++ b/src/widget/maskablepixmapwidget.cpp @@ -20,8 +20,14 @@ #include "maskablepixmapwidget.h" #include +/** +@var QPixmap* MaskablePixmapWidget::renderTarget +@brief pointer to dynamically call the constructor. +*/ + MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString maskName) : QWidget(parent) + , renderTarget(nullptr) , maskName(maskName) , clickable(false) { diff --git a/src/widget/maskablepixmapwidget.h b/src/widget/maskablepixmapwidget.h index f709b6c5b..3edf848ac 100644 --- a/src/widget/maskablepixmapwidget.h +++ b/src/widget/maskablepixmapwidget.h @@ -42,8 +42,8 @@ protected: virtual void mousePressEvent(QMouseEvent *) final override; private: - QPixmap pixmap, mask, unscaled; // a lot of memory... - QPixmap* renderTarget = nullptr; // pointer to dynamically call the constructor + QPixmap pixmap, mask, unscaled; + QPixmap* renderTarget; QSize size; QString maskName; bool clickable; diff --git a/src/widget/notificationscrollarea.cpp b/src/widget/notificationscrollarea.cpp index 5a37e95a9..0956f8884 100644 --- a/src/widget/notificationscrollarea.cpp +++ b/src/widget/notificationscrollarea.cpp @@ -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() { updateTracking(nullptr); } /** - * @brief Delete notification bar from visible elements and widget on scroll area - * @param widget Chatroom widget to remove from tracked widgets - */ +@brief Delete notification bar from visible elements and widget on scroll area +@param widget Chatroom widget to remove from tracked widgets +*/ void NotificationScrollArea::updateTracking(GenericChatroomWidget *widget) { QHash::iterator i = trackedWidgets.begin(); diff --git a/src/widget/qrwidget.cpp b/src/widget/qrwidget.cpp index 093a52604..1e1c91dbd 100644 --- a/src/widget/qrwidget.cpp +++ b/src/widget/qrwidget.cpp @@ -31,6 +31,11 @@ #include #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") //Note: The encoding fails with empty string so I just default to something else. //Use the setQRData() call to change this. @@ -58,10 +63,10 @@ QImage* QRWidget::getImage() } /** - * @brief QRWidget::saveImage - * @param path Full path to the file with extension. - * @return indicate if saving was successful. - */ +@brief QRWidget::saveImage +@param path Full path to the file with extension. +@return indicate if saving was successful. +*/ 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 diff --git a/src/widget/qrwidget.h b/src/widget/qrwidget.h index c1455bf7f..890a80b68 100644 --- a/src/widget/qrwidget.h +++ b/src/widget/qrwidget.h @@ -21,8 +21,6 @@ #ifndef QRWIDGET_H #define QRWIDGET_H -// https://stackoverflow.com/questions/21400254/how-to-draw-a-qr-code-with-qt-in-native-c-c - #include class QRWidget : public QWidget diff --git a/src/widget/style.cpp b/src/widget/style.cpp index 369790c11..d63ac6795 100644 --- a/src/widget/style.cpp +++ b/src/widget/style.cpp @@ -31,6 +31,31 @@ #include #include +/** +@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 QFont appFont(int pixelSize, int weight) { @@ -181,6 +206,12 @@ void Style::setThemeColor(int 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) { if (!color.isValid()) @@ -205,6 +236,9 @@ void Style::setThemeColor(const QColor &color) dict["@themeLight"] = getColor(ThemeLight).name(); } +/** +@brief Reloads some CCS +*/ void Style::applyTheme() { GUI::reloadTheme(); diff --git a/src/widget/style.h b/src/widget/style.h index f34fcb88f..cb7389200 100644 --- a/src/widget/style.h +++ b/src/widget/style.h @@ -49,13 +49,13 @@ public: enum Font { - ExtraBig, // [SystemDefault + 2]px, bold - Big, // [SystemDefault ]px - BigBold, // [SystemDefault ]px, bold - Medium, // [SystemDefault - 1]px - MediumBold, // [SystemDefault - 1]px, bold - Small, // [SystemDefault - 2]px - SmallLight // [SystemDefault - 2]px, light + ExtraBig, + Big, + BigBold, + Medium, + MediumBold, + Small, + SmallLight }; static QStringList getThemeColorNames(); @@ -65,8 +65,8 @@ public: static QString resolve(QString qss, const QFont& baseFont = QFont()); static void repolish(QWidget* w); static void setThemeColor(int color); - static void setThemeColor(const QColor &color); ///< Pass an invalid QColor to reset to defaults - static void applyTheme(); ///< Reloads some CCS + static void setThemeColor(const QColor &color); + static void applyTheme(); static QPixmap scaleSvgImage(const QString& path, uint32_t width, uint32_t height); static QList themeColorColors; diff --git a/src/widget/tool/callconfirmwidget.cpp b/src/widget/tool/callconfirmwidget.cpp index e61a495c2..234bb6a3f 100644 --- a/src/widget/tool/callconfirmwidget.cpp +++ b/src/widget/tool/callconfirmwidget.cpp @@ -31,6 +31,26 @@ #include #include +/** +@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) : QWidget(), anchor(Anchor), f(f), rectW{120}, rectH{85}, @@ -75,6 +95,9 @@ CallConfirmWidget::CallConfirmWidget(const QWidget *Anchor, const Friend& f) : reposition(); } +/** +@brief Recalculate our positions to track the anchor +*/ void CallConfirmWidget::reposition() { if (parentWidget()) diff --git a/src/widget/tool/callconfirmwidget.h b/src/widget/tool/callconfirmwidget.h index 3c50fec9a..c7eb446bc 100644 --- a/src/widget/tool/callconfirmwidget.h +++ b/src/widget/tool/callconfirmwidget.h @@ -30,9 +30,6 @@ class QPaintEvent; class QShowEvent; 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 { Q_OBJECT @@ -44,7 +41,7 @@ signals: void rejected(); public slots: - void reposition(); ///< Recalculate our positions to track the anchor + void reposition(); protected: virtual void paintEvent(QPaintEvent* event) final override; @@ -53,8 +50,8 @@ protected: virtual bool eventFilter(QObject *, QEvent* event) final override; private: - const QWidget* anchor; ///< The widget we're going to be tracking - const Friend& f; ///< The friend on whose chat form we should appear + const QWidget* anchor; + const Friend& f; QRect mainRect; QPolygon spikePoly; @@ -62,8 +59,8 @@ private: const int rectW, rectH; const int spikeW, spikeH; - const int roundedFactor; ///< By how much are the corners of the main rect rounded - const qreal rectRatio; ///< Used to correct the rounding factors on non-square rects + const int roundedFactor; + const qreal rectRatio; }; #endif // CALLCONFIRMWIDGET_H diff --git a/src/widget/tool/croppinglabel.cpp b/src/widget/tool/croppinglabel.cpp index 95c957441..c3d8f44df 100644 --- a/src/widget/tool/croppinglabel.cpp +++ b/src/widget/tool/croppinglabel.cpp @@ -151,6 +151,10 @@ void CroppingLabel::showTextEdit() textEdit->setFocusPolicy(Qt::ClickFocus); } +/** +@brief Get original full text. +@return The un-cropped text. +*/ QString CroppingLabel::fullText() { return origText; diff --git a/src/widget/tool/croppinglabel.h b/src/widget/tool/croppinglabel.h index 83d86322b..03617353e 100644 --- a/src/widget/tool/croppinglabel.h +++ b/src/widget/tool/croppinglabel.h @@ -35,7 +35,7 @@ public: void setEdlideMode(Qt::TextElideMode elide); void setText(const QString& text); - QString fullText(); ///< Returns the un-cropped text + QString fullText(); public slots: diff --git a/src/widget/tool/screenshotgrabber.cpp b/src/widget/tool/screenshotgrabber.cpp index 2a1246daf..f57b8d022 100644 --- a/src/widget/tool/screenshotgrabber.cpp +++ b/src/widget/tool/screenshotgrabber.cpp @@ -192,10 +192,9 @@ void ScreenshotGrabber::chooseHelperTooltipText(QRect rect) } /** - * @internal - * - * Align the tooltip centred at top of screen with the mouse cursor. - */ +@internal +@brief Align the tooltip centered at top of screen with the mouse cursor. +*/ void ScreenshotGrabber::adjustTooltipPosition() { QRect recGL = QGuiApplication::primaryScreen()->virtualGeometry(); diff --git a/src/widget/translator.cpp b/src/widget/translator.cpp index 83125b674..d1d0c7378 100644 --- a/src/widget/translator.cpp +++ b/src/widget/translator.cpp @@ -33,6 +33,9 @@ QTranslator* Translator::translator{nullptr}; QVector Translator::callbacks; QMutex Translator::lock; +/** +@brief Loads the translations according to the settings or locale. +*/ void Translator::translate() { QMutexLocker locker{&lock}; @@ -76,12 +79,21 @@ void Translator::translate() 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 f, void *owner) { QMutexLocker locker{&lock}; callbacks.push_back({owner, f}); } +/** +@brief Unregisters all handlers of an owner. +@param owner Owner to unregister. +*/ void Translator::unregister(void *owner) { QMutexLocker locker{&lock}; diff --git a/src/widget/translator.h b/src/widget/translator.h index 17898bbad..73138cb42 100644 --- a/src/widget/translator.h +++ b/src/widget/translator.h @@ -31,11 +31,8 @@ class QTranslator; class Translator { public: - /// Loads the translations according to the settings or locale static void translate(); - /// Register a function to be called when the UI needs to be retranslated static void registerHandler(std::function, void* owner); - /// Unregisters all handlers of an owner static void unregister(void* owner); private: diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 78864a569..9d97a6f8b 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -537,6 +537,9 @@ Widget::~Widget() instance = nullptr; } +/** +@brief Returns the singleton instance. +*/ Widget* Widget::getInstance() { if (!instance) @@ -545,6 +548,9 @@ Widget* Widget::getInstance() return instance; } +/** +@brief Switches to the About settings page. +*/ void Widget::showUpdateDownloadProgress() { settingsWidget->showAbout(); @@ -1704,6 +1710,9 @@ void Widget::onEmptyGroupCreated(int groupId) group->getGroupWidget()->editName(); } +/** +@brief Used to reset the blinking icon. +*/ void Widget::resetIcon() { eventIcon = false; eventFlag = false; diff --git a/src/widget/widget.h b/src/widget/widget.h index 39180b401..269d051bc 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -67,7 +67,7 @@ public: QString getUsername(); Camera* getCamera(); static Widget* getInstance(); - void showUpdateDownloadProgress(); ///< Switches to the About settings page + void showUpdateDownloadProgress(); void addFriendDialog(Friend* frnd, ContentDialog* dialog); void addGroupDialog(Group* group, ContentDialog* dialog); bool newFriendMessageAlert(int friendId, bool sound=true); @@ -106,7 +106,6 @@ public: void searchItem(GenericChatItemWidget* chatItem, GenericChatItemWidget::ItemType type); bool groupsVisible() const; - // Used to reset the blinking icon void resetIcon(); public slots: