"Fossies" - the Fresh Open Source Software Archive

Member "tdesktop-2.6.1/Telegram/SourceFiles/platform/mac/main_window_mac.h" (24 Feb 2021, 3121 Bytes) of package /linux/misc/tdesktop-2.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "main_window_mac.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2 This file is part of Telegram Desktop,
    3 the official desktop application for the Telegram messaging service.
    4 
    5 For license and copyright information please follow this link:
    6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
    7 */
    8 #pragma once
    9 
   10 #include "platform/platform_main_window.h"
   11 #include "platform/mac/specific_mac_p.h"
   12 #include "base/timer.h"
   13 
   14 #include <QtWidgets/QMenuBar>
   15 #include <QtCore/QTimer>
   16 
   17 namespace Platform {
   18 
   19 class MainWindow : public Window::MainWindow {
   20     // The Q_OBJECT meta info is used for qobject_cast!
   21     Q_OBJECT
   22 
   23 public:
   24     explicit MainWindow(not_null<Window::Controller*> controller);
   25 
   26     bool psFilterNativeEvent(void *event);
   27 
   28     virtual QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) = 0;
   29 
   30     int getCustomTitleHeight() const {
   31         return _customTitleHeight;
   32     }
   33 
   34     ~MainWindow();
   35 
   36     void updateWindowIcon() override;
   37 
   38     void psShowTrayMenu();
   39 
   40     class Private;
   41 
   42 public slots:
   43     void psMacUndo();
   44     void psMacRedo();
   45     void psMacCut();
   46     void psMacCopy();
   47     void psMacPaste();
   48     void psMacDelete();
   49     void psMacSelectAll();
   50     void psMacEmojiAndSymbols();
   51 
   52     void psMacBold();
   53     void psMacItalic();
   54     void psMacUnderline();
   55     void psMacStrikeOut();
   56     void psMacMonospace();
   57     void psMacClearFormat();
   58 
   59 protected:
   60     bool eventFilter(QObject *obj, QEvent *evt) override;
   61 
   62     void handleActiveChangedHook() override;
   63     void stateChangedHook(Qt::WindowState state) override;
   64     void initHook() override;
   65     void titleVisibilityChangedHook() override;
   66     void unreadCounterChangedHook() override;
   67 
   68     bool hasTrayIcon() const override {
   69         return trayIcon;
   70     }
   71 
   72     void updateGlobalMenuHook() override;
   73 
   74     void workmodeUpdated(DBIWorkMode mode) override;
   75 
   76     QSystemTrayIcon *trayIcon = nullptr;
   77     QMenu *trayIconMenu = nullptr;
   78 
   79     void psTrayMenuUpdated();
   80     void psSetupTrayIcon();
   81     virtual void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) = 0;
   82 
   83     QTimer psUpdatedPositionTimer;
   84 
   85     void initShadows() override;
   86     void closeWithoutDestroy() override;
   87     void createGlobalMenu() override;
   88 
   89 private:
   90     friend class Private;
   91 
   92     void hideAndDeactivate();
   93     void updateTitleCounter();
   94     void updateIconCounters();
   95     [[nodiscard]] QIcon generateIconForTray(int counter, bool muted) const;
   96 
   97     std::unique_ptr<Private> _private;
   98 
   99     mutable bool psIdle;
  100     mutable QTimer psIdleTimer;
  101 
  102     base::Timer _hideAfterFullScreenTimer;
  103 
  104     rpl::variable<bool> _canApplyMarkdown;
  105 
  106     QMenuBar psMainMenu;
  107     QAction *psLogout = nullptr;
  108     QAction *psUndo = nullptr;
  109     QAction *psRedo = nullptr;
  110     QAction *psCut = nullptr;
  111     QAction *psCopy = nullptr;
  112     QAction *psPaste = nullptr;
  113     QAction *psDelete = nullptr;
  114     QAction *psSelectAll = nullptr;
  115     QAction *psContacts = nullptr;
  116     QAction *psAddContact = nullptr;
  117     QAction *psNewGroup = nullptr;
  118     QAction *psNewChannel = nullptr;
  119     QAction *psShowTelegram = nullptr;
  120 
  121     QAction *psBold = nullptr;
  122     QAction *psItalic = nullptr;
  123     QAction *psUnderline = nullptr;
  124     QAction *psStrikeOut = nullptr;
  125     QAction *psMonospace = nullptr;
  126     QAction *psClearFormat = nullptr;
  127 
  128     int _customTitleHeight = 0;
  129 
  130 };
  131 
  132 } // namespace Platform