TitleWidget::TitleWidget(MainWindow *window) : TWidget(window) , wnd(window) , hideLevel(0) , hider(0) , _back(this, st::titleBackButton, lang(lng_menu_back)) , _cancel(this, lang(lng_cancel), st::titleTextButton) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) , _lock(this, window) , _update(this, window, lang(lng_menu_update)) , _minimize(this, window) , _maximize(this, window) , _restore(this, window) , _close(this, window) , _a_update(animation(this, &TitleWidget::step_update)) , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) { setGeometry(0, 0, wnd->width(), st::titleHeight); setAttribute(Qt::WA_OpaquePaintEvent); _lock.hide(); _update.hide(); _cancel.hide(); _back.hide(); if ( #ifndef TDESKTOP_DISABLE_AUTOUPDATE Sandbox::updatingState() == Application::UpdatingReady || #endif cHasPasscode() ) { showUpdateBtn(); } stateChanged(); connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings())); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked())); connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings())); connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts())); connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState))); #ifndef TDESKTOP_DISABLE_AUTOUPDATE Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn())); #endif if (cPlatform() != dbipWindows) { _minimize.hide(); _maximize.hide(); _restore.hide(); _close.hide(); } }
TitleWidget::TitleWidget(QWidget *parent) : TWidget(parent) , _cancel(this, lang(lng_cancel), st::titleTextButton) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) , _lock(this) , _update(this) , _minimize(this) , _maximize(this) , _restore(this) , _close(this) , _a_update(animation(this, &TitleWidget::step_update)) , lastMaximized(!(parent->windowState() & Qt::WindowMaximized)) { setGeometry(0, 0, parent->width(), st::titleHeight); setAttribute(Qt::WA_OpaquePaintEvent); onWindowStateChanged(); updateControlsVisibility(); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked())); connect(&_settings, SIGNAL(clicked()), parent, SLOT(showSettings())); connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts())); connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(parent->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState))); #ifndef TDESKTOP_DISABLE_AUTOUPDATE Sandbox::connect(SIGNAL(updateReady()), this, SLOT(updateControlsVisibility())); #endif // !TDESKTOP_DISABLE_AUTOUPDATE subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); }); if (Media::Player::exists()) { subscribe(Media::Player::instance()->usePanelPlayer(), [this](bool usePanel) { updatePlayerButton(usePanel); }); } if (cPlatform() != dbipWindows) { _minimize.hide(); _maximize.hide(); _restore.hide(); _close.hide(); } }
TitleWidget::TitleWidget(Window *window) : QWidget(window) , wnd(window) , hideLevel(0) , hider(0) , _back(this, st::titleBackButton, lang(lng_menu_back)) , _cancel(this, lang(lng_cancel), st::titleTextButton) , _settings(this, lang(lng_menu_settings), st::titleTextButton) , _contacts(this, lang(lng_menu_contacts), st::titleTextButton) , _about(this, lang(lng_menu_about), st::titleTextButton) , _update(this, window, lang(lng_menu_update)) , _minimize(this, window) , _maximize(this, window) , _restore(this, window) , _close(this, window) , lastMaximized(!(window->windowState() & Qt::WindowMaximized)) { setGeometry(0, 0, wnd->width(), st::titleHeight); _update.hide(); _cancel.hide(); _back.hide(); if (App::app()->updatingState() == Application::UpdatingReady) { showUpdateBtn(); } stateChanged(); connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings())); connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked())); connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings())); connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts())); connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout())); connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState))); connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn())); if (cPlatform() != dbipWindows) { _minimize.hide(); _maximize.hide(); _restore.hide(); _close.hide(); } }
void PsMainWindow::psFirstShow() { finished = false; psUpdateMargins(); bool showShadows = true; show(); _private.enableShadow(winId()); if (cWindowPos().maximized) { setWindowState(Qt::WindowMaximized); } if ((cFromAutoStart() && cStartMinimized()) || cStartInTray()) { setWindowState(Qt::WindowMinimized); if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) { hide(); } else { show(); } showShadows = false; } else { show(); } posInited = true; // init global menu QMenu *main = psMainMenu.addMenu(qsl("Telegram")); main->addAction(lng_mac_menu_about_telegram(lt_telegram, qsl("Telegram")), App::wnd()->getTitle(), SLOT(onAbout()))->setMenuRole(QAction::AboutQtRole); main->addSeparator(); QAction *prefs = main->addAction(lang(lng_mac_menu_preferences), App::wnd(), SLOT(showSettings()), QKeySequence(Qt::ControlModifier | Qt::Key_Comma)); prefs->setMenuRole(QAction::PreferencesRole); QMenu *file = psMainMenu.addMenu(lang(lng_mac_menu_file)); psLogout = file->addAction(lang(lng_mac_menu_logout), App::wnd(), SLOT(onLogout())); QMenu *edit = psMainMenu.addMenu(lang(lng_mac_menu_edit)); psUndo = edit->addAction(lang(lng_mac_menu_undo), this, SLOT(psMacUndo()), QKeySequence::Undo); psRedo = edit->addAction(lang(lng_mac_menu_redo), this, SLOT(psMacRedo()), QKeySequence::Redo); edit->addSeparator(); psCut = edit->addAction(lang(lng_mac_menu_cut), this, SLOT(psMacCut()), QKeySequence::Cut); psCopy = edit->addAction(lang(lng_mac_menu_copy), this, SLOT(psMacCopy()), QKeySequence::Copy); psPaste = edit->addAction(lang(lng_mac_menu_paste), this, SLOT(psMacPaste()), QKeySequence::Paste); psDelete = edit->addAction(lang(lng_mac_menu_delete), this, SLOT(psMacDelete()), QKeySequence(Qt::ControlModifier | Qt::Key_Backspace)); edit->addSeparator(); psSelectAll = edit->addAction(lang(lng_mac_menu_select_all), this, SLOT(psMacSelectAll()), QKeySequence::SelectAll); QMenu *window = psMainMenu.addMenu(lang(lng_mac_menu_window)); psContacts = window->addAction(lang(lng_mac_menu_contacts), App::wnd()->getTitle(), SLOT(onContacts())); psAddContact = window->addAction(lang(lng_mac_menu_add_contact), App::wnd(), SLOT(onShowAddContact())); window->addSeparator(); psNewGroup = window->addAction(lang(lng_mac_menu_new_group), App::wnd(), SLOT(onShowNewGroup())); psNewChannel = window->addAction(lang(lng_mac_menu_new_channel), App::wnd(), SLOT(onShowNewChannel())); window->addSeparator(); psShowTelegram = window->addAction(lang(lng_mac_menu_show), App::wnd(), SLOT(showFromTray())); psMacUpdateMenu(); }