void MainWindow::resizeEvent(QResizeEvent* event) { if (isMaximized()) { get_gui_settings()->set_value(settings_window_maximized, true); } else { QRect rc = Ui::get_gui_settings()->get_value(settings_main_window_rect, QRect()); rc.setWidth(event->size().width()); rc.setHeight(event->size().height()); get_gui_settings()->set_value(settings_main_window_rect, rc); get_gui_settings()->set_value(settings_window_maximized, false); } // TODO : limit call this stats // GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::main_window_resize); #ifdef __APPLE__ mac_support_->updateMainMenu(); #endif }
void MainWindow::initSettings() { auto main_rect = Ui::get_gui_settings()->get_value<QRect>( settings_main_window_rect, QRect(0, 0, Utils::scale_value(1000), Utils::scale_value(600))); resize(main_rect.width(), main_rect.height()); setMinimumHeight(Utils::scale_value(550)); setMinimumWidth(Utils::scale_value(700)); if (main_rect.left() == 0 && main_rect.top() == 0) { QRect rc = main_rect; QRect desktopRect = QDesktopWidget().availableGeometry(this); QPoint center = desktopRect.center(); move(center.x() - width()*0.5, center.y()-height()*0.5); get_gui_settings()->set_value(settings_main_window_rect, geometry()); } else { move(main_rect.left(), main_rect.top()); } bool isMaximized = get_gui_settings()->get_value<bool>(settings_window_maximized, false); isMaximized ? showMaximized() : show(); maximize_button_->setProperty("MinimizeButton", isMaximized); maximize_button_->setProperty("MaximizeButton", !isMaximized); maximize_button_->setStyle(QApplication::style()); #ifdef _WIN32 if (isMaximized) SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); #endif //_WIN32 }
void MainWindow::minimize() { if (get_gui_settings()->get_value<bool>(settings_show_in_taskbar, true)) { showMinimized(); #ifdef _WIN32 SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); #endif //_WIN32 } else { hideWindow(); } }
void MainWindow::activate() { setVisible(true); tray_icon_->Hide(); activateWindow(); #ifdef _WIN32 ShowWindow((HWND)winId(), get_gui_settings()->get_value<bool>(settings_window_maximized, false) ? SW_MAXIMIZE : SW_RESTORE); SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); #endif //_WIN32 #ifdef __APPLE__ mac_support_->activateWindow(winId()); mac_support_->updateMainMenu(); #endif //__APPLE__ }
void LoginPage::codeEditChanged(QString code) { if (code.length() == 4) { setFocus(); code_edit_->setEnabled(false); get_gui_settings()->set_value(settings_keep_logged_in, true); gui_coll_helper collection(GetDispatcher()->create_collection(), true); collection.set_value_as_qstring("phone", phone_->text()); collection.set_value_as_qstring("sms_code", code); collection.set_value_as_bool("save_auth_data", true); GetDispatcher()->post_message_to_core("login_by_phone", collection.get()); } }
bool TrayIcon::canShowNotifications() const { // TODO: must be based on the type of notification - is it message, birthday-notify or contact-coming-notify. if (!get_gui_settings()->get_value<bool>(settings_notify_new_messages, true)) return false; #ifdef _WIN32 if (QSysInfo().windowsVersion() >= QSysInfo::WV_VISTA) { static QueryUserNotificationState query; if (!query) { HINSTANCE shell32 = LoadLibraryW(L"shell32.dll"); if (shell32) { query = (QueryUserNotificationState)GetProcAddress(shell32, "SHQueryUserNotificationState"); } } if (query) { QUERY_USER_NOTIFICATION_STATE state; if (query(&state) == S_OK && state != QUNS_ACCEPTS_NOTIFICATIONS) return false; } } else if (QSysInfo().windowsVersion() == QSysInfo::WV_XP) { static QuerySystemParametersInfo query; if (!query) { HINSTANCE user32 = LoadLibraryW(L"user32.dll"); if (user32) { query = (QuerySystemParametersInfo)GetProcAddress(user32, "SystemParametersInfoW"); } } if (query) { BOOL result = FALSE; if (query(SPI_GETSCREENSAVERRUNNING, 0, &result, 0) && result) return false; } } #endif //_WIN32 return Icon_->isSystemTrayAvailable() && Icon_->supportsMessages() && !MainWindow_->isActive(); }
void MainPage::myInfo() { if (login_new_user_ && MyInfo()->friendlyName().isEmpty() && !get_gui_settings()->get_value(get_account_setting_name(settings_skip_intro_yourself).c_str(), false)) { if (!recv_my_info_) { emit Utils::InterConnector::instance().showPlaceholder(Utils::PlaceholdersType::PlaceholdersType_SetExistanseOnIntroduceYourself); emit Utils::InterConnector::instance().showPlaceholder(Utils::PlaceholdersType::PlaceholdersType_IntroduceYourself); } } else { emit Utils::InterConnector::instance().showPlaceholder(Utils::PlaceholdersType::PlaceholdersType_SetExistanseOffIntroduceYourself); } recv_my_info_ = true; }
void MainWindow::changeEvent(QEvent* event) { if (event->type() == QEvent::WindowStateChange) { if (platform::is_apple() && !isMaximized()) { emit Utils::InterConnector::instance().closeAnyPopupWindow(); } maximize_button_->setProperty("MinimizeButton", isMaximized()); maximize_button_->setProperty("MaximizeButton", !isMaximized()); maximize_button_->setStyle(QApplication::style()); get_gui_settings()->set_value<bool>(settings_window_maximized, isMaximized()); } else if (event->type() == QEvent::ActivationChange) { if (isActiveWindow()) { tray_icon_->Hide(); if (!SkipRead_) Logic::GetRecentsModel()->sendLastRead(); SkipRead_ = false; } if (Shadow_) { Shadow_->setActive(isActiveWindow()); } } if (event->type() == QEvent::ApplicationStateChange) { if (Shadow_) { Shadow_->setActive(isActiveWindow()); } } QMainWindow::changeEvent(event); }
void MainWindow::showLoginPage() { #ifdef __APPLE__ mac_support_->createMenuBar(true); mac_support_->forceEnglishInputSource(); if (!get_gui_settings()->get_value<bool>(settings_mac_accounts_migrated, false)) { QString accountId = MacMigrationManager::canMigrateAccount(); if (accountId.length() > 0) { // Move it out of ifdef-block if it's needed for other platforms main_page_ = nullptr; MainPage::reset(); showMigrateAccountPage(accountId); return; } } #endif if (!login_page_) { login_page_ = new LoginPage(this, true /* is_login */); stacked_widget_->addWidget(login_page_); connect(login_page_, SIGNAL(loggedIn()), this, SLOT(showMainPage()), Qt::QueuedConnection); } stacked_widget_->setCurrentWidget(login_page_); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::reg_page_phone); login_page_->enableKeepLogedIn(); clear_global_objects(); }
bool MainWindow::nativeEventFilter(const QByteArray& data, void *message, long *result) { #ifdef _WIN32 MSG* msg = (MSG*)(message); if (msg->message == WM_NCHITTEST) { if (msg->hwnd != (HANDLE)winId()) { return false; } int boxWidth = Utils::scale_value(SIZE_BOX_WIDTH); if (isMaximized()) { *result = HTCLIENT; return true; } int x = GET_X_LPARAM(msg->lParam); int y = GET_Y_LPARAM(msg->lParam); QPoint topLeft = QWidget::mapToGlobal(rect().topLeft()); QPoint bottomRight = QWidget::mapToGlobal(rect().bottomRight()); if (x <= topLeft.x() + boxWidth) { if (y <= topLeft.y() + boxWidth) *result = HTTOPLEFT; else if (y >= bottomRight.y() - boxWidth) *result = HTBOTTOMLEFT; else *result = HTLEFT; } else if (x >= bottomRight.x() - boxWidth) { if (y <= topLeft.y() + boxWidth) *result = HTTOPRIGHT; else if (y >= bottomRight.y() - boxWidth) *result = HTBOTTOMRIGHT; else *result = HTRIGHT; } else { if (y <= topLeft.y() + boxWidth) *result = HTTOP; else if (y >= bottomRight.y() - boxWidth) *result = HTBOTTOM; else *result = HTCLIENT; } return true; } else if ((msg->message == WM_SYSCOMMAND && msg->wParam == SC_RESTORE && msg->hwnd == (HWND)winId()) || (msg->message == WM_SHOWWINDOW && msg->hwnd == (HWND)winId() && msg->wParam == TRUE)) { setVisible(true); SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); tray_icon_->Hide(); if (!SkipRead_) Logic::GetRecentsModel()->sendLastRead(); if (!TaskBarIconHidden_) SkipRead_ = false; TaskBarIconHidden_ = false; } else if (msg->message == WM_SYSCOMMAND && msg->wParam == SC_CLOSE) { hideWindow(); return true; } else if (msg->message == WM_SYSCOMMAND && msg->wParam == SC_MINIMIZE) { minimize(); return true; } else if (msg->message == WM_WINDOWPOSCHANGING || msg->message == WM_WINDOWPOSCHANGED) { if (msg->hwnd != (HANDLE)winId()) { return false; } WINDOWPOS* pos = (WINDOWPOS*)msg->lParam; if (pos->flags == 0x8170 || pos->flags == 0x8130) { SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); return false; } if (Shadow_) { if (!(pos->flags & SWP_NOSIZE) && !(pos->flags & SWP_NOMOVE) && !(pos->flags & SWP_DRAWFRAME)) { int shadowWidth = get_gui_settings()->get_shadow_width(); SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), pos->x - shadowWidth, pos->y - shadowWidth, pos->cx + shadowWidth * 2, pos->cy + shadowWidth * 2, SWP_NOACTIVATE | SWP_NOOWNERZORDER); } else if (!(pos->flags & SWP_NOZORDER)) { UINT flags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE; if (pos->flags & SWP_SHOWWINDOW) flags |= SWP_SHOWWINDOW; if (pos->flags & SWP_HIDEWINDOW) flags |= SWP_HIDEWINDOW; SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, flags); } } } else if (msg->message == WM_ACTIVATE) { if (!Shadow_) return false; if (msg->hwnd == (HWND)Shadow_->winId() && msg->wParam != WA_INACTIVE) { activate(); return false; } } else if (msg->message == WM_DEVICECHANGE) { GetSoundsManager()->reinit(); } #else #ifdef __APPLE__ return MacSupport::nativeEventFilter(data, message, result); #endif #endif //_WIN32 return false; }
MainWindow::MainWindow(QApplication* app) : main_page_(nullptr) , login_page_(nullptr) #ifdef __APPLE__ , accounts_page_(nullptr) #endif //_APPLE__ , app_(app) , event_filter_(new TitleWidgetEventFilter(this)) , tray_icon_(new TrayIcon(this)) , backgroundPixmap_(QPixmap()) , Shadow_(0) , SkipRead_(false) , TaskBarIconHidden_(false) , liveChats_(new LiveChats(this)) { Utils::InterConnector::instance().setMainWindow(this); #ifdef _WIN32 Utils::init_crash_handlers_in_core(); core::dump::crash_handler chandler; chandler.set_process_exception_handlers(); chandler.set_thread_exception_handlers(); #endif //_WIN32 setStyleSheet(Utils::LoadStyle(":/main_window/main_window.qss", Utils::get_scale_coefficient(), true)); #ifdef __APPLE__ mac_support_ = new MacSupport(this); mac_support_->enableMacCrashReport(); #endif app_->installNativeEventFilter(this); if (this->objectName().isEmpty()) this->setObjectName(QStringLiteral("main_window")); this->resize(329, 331); QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); this->setSizePolicy(sizePolicy); this->setLayoutDirection(Qt::LeftToRight); this->setAutoFillBackground(false); main_widget_ = new QWidget(this); main_widget_->setObjectName(QStringLiteral("main_widget")); sizePolicy.setHeightForWidth(main_widget_->sizePolicy().hasHeightForWidth()); main_widget_->setSizePolicy(sizePolicy); vertical_layout_ = new QVBoxLayout(main_widget_); vertical_layout_->setSpacing(0); vertical_layout_->setObjectName(QStringLiteral("verticalLayout_9")); vertical_layout_->setSizeConstraint(QLayout::SetDefaultConstraint); vertical_layout_->setContentsMargins(0, 0, 0, 0); title_widget_ = new QWidget(main_widget_); title_widget_->setObjectName(QStringLiteral("title_widget")); QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(title_widget_->sizePolicy().hasHeightForWidth()); title_widget_->setSizePolicy(sizePolicy1); title_widget_->setProperty("TitleWidget", QVariant(true)); horizontal_layout_ = new QHBoxLayout(title_widget_); horizontal_layout_->setSpacing(0); horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout")); horizontal_layout_->setContentsMargins(0, 0, 0, 0); logo_ = new QPushButton(title_widget_); logo_->setObjectName(QStringLiteral("logo")); QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(logo_->sizePolicy().hasHeightForWidth()); logo_->setSizePolicy(sizePolicy2); logo_->setProperty("WindowIcon", QVariant(true)); horizontal_layout_->addWidget(logo_); title_ = new QLabel(title_widget_); title_->setObjectName(QStringLiteral("title")); title_->setProperty("Title", QVariant(true)); horizontal_layout_->addWidget(title_); horizontal_spacer_ = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontal_layout_->addItem(horizontal_spacer_); hide_button_ = new QPushButton(title_widget_); hide_button_->setObjectName(QStringLiteral("hide_button")); hide_button_->setProperty("HideButton", QVariant(true)); horizontal_layout_->addWidget(hide_button_); maximize_button_ = new QPushButton(title_widget_); maximize_button_->setObjectName(QStringLiteral("maximize_button")); sizePolicy2.setHeightForWidth(maximize_button_->sizePolicy().hasHeightForWidth()); maximize_button_->setSizePolicy(sizePolicy2); maximize_button_->setProperty("MaximizeButton", QVariant(true)); horizontal_layout_->addWidget(maximize_button_); close_button_ = new QPushButton(title_widget_); close_button_->setObjectName(QStringLiteral("close_button")); sizePolicy2.setHeightForWidth(close_button_->sizePolicy().hasHeightForWidth()); close_button_->setSizePolicy(sizePolicy2); close_button_->setProperty("CloseButton", QVariant(true)); horizontal_layout_->addWidget(close_button_); vertical_layout_->addWidget(title_widget_); stacked_widget_ = new BackgroundWidget(main_widget_, ""); stacked_widget_->setObjectName(QStringLiteral("stacked_widget")); QPixmap p(":/resources/main_window/pat_100.png"); setBackgroundPixmap(p, true); //Utils::InterConnector::instance().setMainWindow(this); get_qt_theme_settings()->setOrLoadDefaultTheme(); vertical_layout_->addWidget(stacked_widget_); this->setCentralWidget(main_widget_); logo_->setText(QString()); hide_button_->setText(QString()); maximize_button_->setText(QString()); close_button_->setText(QString()); stacked_widget_->setCurrentIndex(-1); QMetaObject::connectSlotsByName(this); if (!get_gui_settings()->get_value(settings_keep_logged_in, true))// || !get_gui_settings()->contains_value(settings_keep_logged_in)) { showLoginPage(); } else { showMainPage(); } title_widget_->installEventFilter(event_filter_); title_->setText("ICQ"); title_->setAttribute(Qt::WA_TransparentForMouseEvents); logo_->setAttribute(Qt::WA_TransparentForMouseEvents); setWindowTitle("ICQ"); #ifdef _WIN32 setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::WindowMinimizeButtonHint); fake_parent_window_ = Utils::create_fake_parent_window(); #else title_widget_->hide(); #endif title_->setMouseTracking(true); connect(hide_button_, SIGNAL(clicked()), this, SLOT(minimize()), Qt::QueuedConnection); connect(maximize_button_, SIGNAL(clicked()), this, SLOT(maximize()), Qt::QueuedConnection); connect(close_button_, SIGNAL(clicked()), this, SLOT(hideWindow()), Qt::QueuedConnection); hide_button_->setCursor(Qt::PointingHandCursor); maximize_button_->setCursor(Qt::PointingHandCursor); close_button_->setCursor(Qt::PointingHandCursor); connect(event_filter_, SIGNAL(doubleClick()), this, SLOT(maximize()), Qt::QueuedConnection); connect(event_filter_, SIGNAL(moveRequest(QPoint)), this, SLOT(moveRequest(QPoint)), Qt::QueuedConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipResetComplete()), this, SLOT(onVoipResetComplete()), Qt::QueuedConnection); connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(showLoginPage()), Qt::DirectConnection); connect(&Utils::InterConnector::instance(), SIGNAL(showIconInTaskbar(bool)), this, SLOT(showIconInTaskbar(bool)), Qt::QueuedConnection); connect(this, SIGNAL(needActivate()), this, SLOT(activate()), Qt::QueuedConnection); connect(get_gui_settings(), SIGNAL(changed(QString)), this, SLOT(guiSettingsChanged(QString)), Qt::QueuedConnection); QFont f = QApplication::font(); f.setStyleStrategy(QFont::PreferAntialias); QApplication::setFont(f); if (platform::is_windows()) { int shadowWidth = get_gui_settings()->get_shadow_width(); QBrush b = stacked_widget_->palette().background(); QMatrix m; m.translate(shadowWidth, title_widget_->height() + shadowWidth); b.setMatrix(m); Shadow_ = new ShadowWindow(b, shadowWidth); QPoint pos = mapToGlobal(QPoint(rect().x(), rect().y())); Shadow_->move(pos.x(), pos.y()); Shadow_->resize(rect().width(), rect().height()); Shadow_->setActive(true); Shadow_->show(); } initSettings(); #ifdef _WIN32 DragAcceptFiles((HWND)winId(), TRUE); #endif //_WIN32 if (!get_gui_settings()->get_value<bool>(settings_show_in_taskbar, true)) hide_taskbar_icon(); #ifdef __APPLE__ mac_support_->enableMacUpdater(); mac_support_->enableMacPreview(this->winId()); #endif }
bool TitleWidgetEventFilter::eventFilter(QObject* obj, QEvent* event) { switch (event->type()) { case QEvent::MouseButtonDblClick: emit doubleClick(); break; case QEvent::MouseButtonPress: clickPos = static_cast<QMouseEvent*>(event)->pos(); event->accept(); break; case QEvent::MouseMove: emit moveRequest(static_cast<QMouseEvent*>(event)->globalPos() - clickPos - QPoint(get_gui_settings()->get_shadow_width(), get_gui_settings()->get_shadow_width())); break; default: break; } return QObject::eventFilter(obj, event); }
TrayIcon::~TrayIcon() { disconnect(get_gui_settings()); }
LoginPage::LoginPage(QWidget* parent) : QWidget(parent) , country_code_(new LineEditEx(this)) , phone_(new LineEditEx(this)) , combobox_(new CountrySearchCombobox(this)) , remaining_seconds_(0) , timer_(new QTimer(this)) { setStyleSheet(Utils::LoadStyle(":/main_window/login_page.qss", Utils::get_scale_coefficient(), true)); if (objectName().isEmpty()) setObjectName(QStringLiteral("login_page")); setProperty("LoginPageWidget", QVariant(true)); QVBoxLayout* verticalLayout = new QVBoxLayout(this); verticalLayout->setSpacing(0); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); verticalLayout->setContentsMargins(0, 0, 0, 0); auto back_button_widget = new QWidget(this); auto back_button_layout = new QHBoxLayout(back_button_widget); Utils::ApplyStyle(back_button_widget, "background-color: transparent;"); back_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); back_button_layout->setSpacing(0); back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0); back_button_layout->setAlignment(Qt::AlignLeft); { prev_page_link_ = new BackButton(back_button_widget); prev_page_link_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); prev_page_link_->setFlat(true); prev_page_link_->setFocusPolicy(Qt::NoFocus); prev_page_link_->setCursor(Qt::PointingHandCursor); { const QString s = "QPushButton { width: 20dip; height: 20dip; border: none; background-color: transparent; border-image: url(:/resources/contr_back_100.png); margin: 10dip; } QPushButton:hover { border-image: url(:/resources/contr_back_100_hover.png); } QPushButton#back_button:pressed { border-image: url(:/resources/contr_back_100_active.png); }"; Utils::ApplyStyle(prev_page_link_, s); } back_button_layout->addWidget(prev_page_link_); } verticalLayout->addWidget(back_button_widget); /* QWidget* back_button_widget = new QWidget(this); back_button_widget->setObjectName(QStringLiteral("back_button_widget")); back_button_widget->setProperty("BackButtonWidget", QVariant(true)); QHBoxLayout* back_button_layout = new QHBoxLayout(back_button_widget); back_button_layout->setSpacing(0); back_button_layout->setObjectName(QStringLiteral("back_button_layout")); back_button_layout->setContentsMargins(Utils::scale_value(14), Utils::scale_value(14), 0, 0); prev_page_link_ = new BackButton(back_button_widget); prev_page_link_->setObjectName(QStringLiteral("prev_page_link")); prev_page_link_->setCursor(QCursor(Qt::PointingHandCursor)); prev_page_link_->setProperty("LoginBackButton", QVariant(true)); back_button_layout->addWidget(prev_page_link_); QSpacerItem* horizontalSpacer_3 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); back_button_layout->addItem(horizontalSpacer_3); verticalLayout->addWidget(back_button_widget); */ QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout->addItem(verticalSpacer); QWidget* main_widget = new QWidget(this); main_widget->setObjectName(QStringLiteral("main_widget")); QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(main_widget->sizePolicy().hasHeightForWidth()); main_widget->setSizePolicy(sizePolicy); main_widget->setProperty("CenterControlWidgetBack", QVariant(true)); QHBoxLayout* main_layout = new QHBoxLayout(main_widget); main_layout->setSpacing(0); main_layout->setObjectName(QStringLiteral("main_layout")); main_layout->setContentsMargins(0, 0, 0, 0); QSpacerItem* horizontalSpacer_6 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); main_layout->addItem(horizontalSpacer_6); QWidget* controls_widget = new QWidget(main_widget); controls_widget->setObjectName(QStringLiteral("controls_widget")); QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(controls_widget->sizePolicy().hasHeightForWidth()); controls_widget->setSizePolicy(sizePolicy1); controls_widget->setProperty("CenterContolWidget", QVariant(true)); QVBoxLayout* controls_layout = new QVBoxLayout(controls_widget); controls_layout->setSpacing(0); controls_layout->setObjectName(QStringLiteral("controls_layout")); controls_layout->setContentsMargins(0, 0, 0, 0); PictureWidget* logo_widget = new PictureWidget(controls_widget, ":/resources/main_window/content_logo_100.png"); logo_widget->setFixedHeight(Utils::scale_value(80)); logo_widget->setFixedWidth(Utils::scale_value(80)); controls_layout->addWidget(logo_widget); controls_layout->setAlignment(logo_widget, Qt::AlignHCenter); QLabel* welcome_label = new QLabel(controls_widget); welcome_label->setObjectName(QStringLiteral("welcome_label")); welcome_label->setAlignment(Qt::AlignCenter); welcome_label->setProperty("WelcomeTitle", QVariant(true)); controls_layout->addWidget(welcome_label); hint_label_ = new QLabel(controls_widget); hint_label_->setObjectName(QStringLiteral("hint_label")); hint_label_->setAlignment(Qt::AlignCenter); hint_label_->setProperty("ActionHintLabel", QVariant(true)); controls_layout->addWidget(hint_label_); QWidget * center_widget = new QWidget(controls_widget); center_widget->setObjectName(QStringLiteral("center_widget")); QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(center_widget->sizePolicy().hasHeightForWidth()); center_widget->setSizePolicy(sizePolicy2); QHBoxLayout * horizontalLayout = new QHBoxLayout(center_widget); horizontalLayout->setSpacing(0); horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); horizontalLayout->setContentsMargins(0, 0, 0, 0); QSpacerItem* horizontalSpacer_9 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer_9); login_staked_widget_ = new QStackedWidget(center_widget); login_staked_widget_->setObjectName(QStringLiteral("login_staked_widget")); login_staked_widget_->setProperty("LoginStackedWidget", QVariant(true)); QSizePolicy sizePolicy3(QSizePolicy::Fixed, QSizePolicy::Preferred); sizePolicy3.setHorizontalStretch(0); sizePolicy3.setVerticalStretch(0); sizePolicy3.setHeightForWidth(login_staked_widget_->sizePolicy().hasHeightForWidth()); login_staked_widget_->setSizePolicy(sizePolicy3); QWidget* phone_login_widget = new QWidget(); phone_login_widget->setObjectName(QStringLiteral("phone_login_widget")); sizePolicy3.setHeightForWidth(phone_login_widget->sizePolicy().hasHeightForWidth()); phone_login_widget->setSizePolicy(sizePolicy3); QVBoxLayout* phone_login_layout = new QVBoxLayout(phone_login_widget); phone_login_layout->setSpacing(0); phone_login_layout->setObjectName(QStringLiteral("phone_login_layout")); phone_login_layout->setContentsMargins(0, 0, 0, 0); country_search_widget_ = new QWidget(phone_login_widget); country_search_widget_->setObjectName(QStringLiteral("country_search_widget")); country_search_widget_->setProperty("CountrySearchWidget", QVariant(true)); QVBoxLayout* country_search_layout = new QVBoxLayout(country_search_widget_); country_search_layout->setSpacing(0); country_search_layout->setObjectName(QStringLiteral("country_search_layout")); country_search_layout->setContentsMargins(0, 0, 0, 0); phone_login_layout->addWidget(country_search_widget_); phone_widget_ = new QFrame(phone_login_widget); phone_widget_->setObjectName(QStringLiteral("phone_widget")); phone_widget_->setFocusPolicy(Qt::ClickFocus); phone_widget_->setFrameShape(QFrame::NoFrame); phone_widget_->setFrameShadow(QFrame::Plain); phone_widget_->setLineWidth(0); phone_widget_->setProperty("EnterPhoneWidget", QVariant(true)); QHBoxLayout* phone_widget_layout = new QHBoxLayout(phone_widget_); phone_widget_layout->setSpacing(0); phone_widget_layout->setObjectName(QStringLiteral("phone_widget_layout")); phone_widget_layout->setContentsMargins(0, 0, 0, 0); phone_login_layout->addWidget(phone_widget_); QSpacerItem* verticalSpacer_3 = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); phone_login_layout->addItem(verticalSpacer_3); login_staked_widget_->addWidget(phone_login_widget); QWidget* phone_confirm_widget = new QWidget(); phone_confirm_widget->setObjectName(QStringLiteral("phone_confirm_widget")); sizePolicy3.setHeightForWidth(phone_confirm_widget->sizePolicy().hasHeightForWidth()); phone_confirm_widget->setSizePolicy(sizePolicy3); QVBoxLayout* phone_confirm_layout = new QVBoxLayout(phone_confirm_widget); phone_confirm_layout->setSpacing(0); phone_confirm_layout->setObjectName(QStringLiteral("phone_confirm_layout")); phone_confirm_layout->setContentsMargins(0, 0, 0, 0); QWidget* entered_phone_widget = new QWidget(phone_confirm_widget); entered_phone_widget->setObjectName(QStringLiteral("entered_phone_widget")); entered_phone_widget->setProperty("EnteredPhoneWidget", QVariant(true)); QHBoxLayout* horizontalLayout_6 = new QHBoxLayout(entered_phone_widget); horizontalLayout_6->setSpacing(0); horizontalLayout_6->setObjectName(QStringLiteral("horizontalLayout_6")); horizontalLayout_6->setContentsMargins(0, 0, 0, 0); QSpacerItem* horizontalSpacer_4 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_6->addItem(horizontalSpacer_4); entered_phone_ = new QLabel(entered_phone_widget); entered_phone_->setObjectName(QStringLiteral("entered_phone")); entered_phone_->setProperty("EnteredPhoneNumber", QVariant(true)); horizontalLayout_6->addWidget(entered_phone_); edit_phone_button_ = new QPushButton(entered_phone_widget); edit_phone_button_->setObjectName(QStringLiteral("edit_phone_button")); edit_phone_button_->setCursor(QCursor(Qt::PointingHandCursor)); edit_phone_button_->setProperty("EditPhoneButton", QVariant(true)); horizontalLayout_6->addWidget(edit_phone_button_); QSpacerItem* horizontalSpacer_5 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_6->addItem(horizontalSpacer_5); phone_confirm_layout->addWidget(entered_phone_widget); resend_button_ = new QPushButton(phone_confirm_widget); resend_button_->setObjectName(QStringLiteral("resendButton")); resend_button_->setCursor(QCursor(Qt::PointingHandCursor)); resend_button_->setFocusPolicy(Qt::StrongFocus); resend_button_->setProperty("ResendCodeButton", QVariant(true)); phone_confirm_layout->addWidget(resend_button_); code_edit_ = new QLineEdit(phone_confirm_widget); code_edit_->setObjectName(QStringLiteral("code_edit")); code_edit_->setAlignment(Qt::AlignCenter); code_edit_->setProperty("EnteredCode", QVariant(true)); code_edit_->setAttribute(Qt::WA_MacShowFocusRect, false); Testing::setAccessibleName(code_edit_, "StartWindowSMScodeField"); phone_confirm_layout->addWidget(code_edit_); QSpacerItem* verticalSpacer_4 = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); phone_confirm_layout->addItem(verticalSpacer_4); login_staked_widget_->addWidget(phone_confirm_widget); QWidget* uin_login_widget = new QWidget(); uin_login_widget->setObjectName(QStringLiteral("uin_login_widget")); sizePolicy3.setHeightForWidth(uin_login_widget->sizePolicy().hasHeightForWidth()); uin_login_widget->setSizePolicy(sizePolicy3); QVBoxLayout * uin_login_layout = new QVBoxLayout(uin_login_widget); uin_login_layout->setSpacing(0); uin_login_layout->setObjectName(QStringLiteral("uin_login_layout")); uin_login_layout->setContentsMargins(0, 0, 0, 0); uin_login_edit_ = new QLineEdit(uin_login_widget); uin_login_edit_->setObjectName(QStringLiteral("uin_login_edit")); uin_login_edit_->setAlignment(Qt::AlignLeft); uin_login_edit_->setProperty("Uin", QVariant(true)); Testing::setAccessibleName(uin_login_edit_, "StartWindowUinField"); uin_login_layout->addWidget(uin_login_edit_); uin_password_edit_ = new QLineEdit(uin_login_widget); uin_password_edit_->setObjectName(QStringLiteral("uin_password_edit")); uin_password_edit_->setEchoMode(QLineEdit::Password); uin_password_edit_->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); uin_password_edit_->setProperty("Password", QVariant(true)); Testing::setAccessibleName(uin_password_edit_, "StartWindowPasswordField"); uin_login_layout->addWidget(uin_password_edit_); keep_logged_ = new QCheckBox(uin_login_widget); keep_logged_->setObjectName(QStringLiteral("keep_logged")); uin_login_layout->addWidget(keep_logged_); login_staked_widget_->addWidget(uin_login_widget); horizontalLayout->addWidget(login_staked_widget_); QSpacerItem* horizontalSpacer_8 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer_8); controls_layout->addWidget(center_widget); QWidget* next_button_widget = new QWidget(controls_widget); next_button_widget->setObjectName(QStringLiteral("next_button_widget")); next_button_widget->setProperty("NextButtonWidget", QVariant(true)); QVBoxLayout* verticalLayout_8 = new QVBoxLayout(next_button_widget); verticalLayout_8->setSpacing(0); verticalLayout_8->setObjectName(QStringLiteral("verticalLayout_8")); verticalLayout_8->setContentsMargins(0, 0, 0, 0); next_page_link_ = new QPushButton(next_button_widget); next_page_link_->setObjectName(QStringLiteral("next_page_link")); next_page_link_->setCursor(QCursor(Qt::PointingHandCursor)); next_page_link_->setAutoDefault(true); next_page_link_->setDefault(false); Utils::ApplyStyle(next_page_link_, main_button_style); Testing::setAccessibleName(next_page_link_, "StartWindowLoginButton"); verticalLayout_8->addWidget(next_page_link_); controls_layout->addWidget(next_button_widget); controls_layout->setAlignment(next_button_widget, Qt::AlignHCenter); QWidget* widget = new QWidget(controls_widget); widget->setObjectName(QStringLiteral("widget")); widget->setProperty("ErrorWIdget", QVariant(true)); QVBoxLayout* verticalLayout_7 = new QVBoxLayout(widget); verticalLayout_7->setSpacing(0); verticalLayout_7->setObjectName(QStringLiteral("verticalLayout_7")); verticalLayout_7->setContentsMargins(0, 0, 0, 0); error_label_ = new QLabel(widget); error_label_->setObjectName(QStringLiteral("error_label")); error_label_->setAlignment(Qt::AlignCenter); error_label_->setProperty("ErrorLabel", QVariant(true)); verticalLayout_7->addWidget(error_label_); controls_layout->addWidget(widget); main_layout->addWidget(controls_widget); QSpacerItem* horizontalSpacer_7 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); main_layout->addItem(horizontalSpacer_7); verticalLayout->addWidget(main_widget); QSpacerItem* verticalSpacer_2 = new QSpacerItem(0, 3, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout->addItem(verticalSpacer_2); QWidget* switch_login_widget = new QWidget(this); switch_login_widget->setObjectName(QStringLiteral("switch_login_widget")); switch_login_widget->setProperty("LoginButtonWidget", QVariant(true)); QHBoxLayout* switch_login_layout = new QHBoxLayout(switch_login_widget); switch_login_layout->setSpacing(0); switch_login_layout->setObjectName(QStringLiteral("switch_login_layout")); switch_login_layout->setContentsMargins(0, 0, 0, 0); QSpacerItem* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); switch_login_layout->addItem(horizontalSpacer); switch_login_link_ = new QPushButton(switch_login_widget); switch_login_link_->setObjectName(QStringLiteral("switch_login_link")); sizePolicy1.setHeightForWidth(switch_login_link_->sizePolicy().hasHeightForWidth()); switch_login_link_->setSizePolicy(sizePolicy1); switch_login_link_->setCursor(QCursor(Qt::PointingHandCursor)); switch_login_link_->setProperty("SwitchLoginButton", QVariant(true)); Testing::setAccessibleName(switch_login_link_, "StartWindowChangeLoginType"); switch_login_layout->addWidget(switch_login_link_); QSpacerItem* horizontalSpacer_2 = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); switch_login_layout->addItem(horizontalSpacer_2); verticalLayout->addWidget(switch_login_widget); login_staked_widget_->setCurrentIndex(2); QMetaObject::connectSlotsByName(this); //prev_page_link_->setText(QString()); welcome_label->setText(QT_TRANSLATE_NOOP("login_page","Welcome to ICQ")); edit_phone_button_->setText(QT_TRANSLATE_NOOP("login_page","Edit")); code_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("login_page","Your code")); uin_login_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("login_page","UIN or Email")); uin_login_edit_->setAttribute(Qt::WA_MacShowFocusRect, false); uin_password_edit_->setPlaceholderText(QT_TRANSLATE_NOOP("login_page","Password")); uin_password_edit_->setAttribute(Qt::WA_MacShowFocusRect, false); keep_logged_->setText(QT_TRANSLATE_NOOP("login_page","Keep me signed in")); keep_logged_->setChecked(get_gui_settings()->get_value(settings_keep_logged_in, true)); connect(keep_logged_, &QCheckBox::toggled, [](bool v) { if (get_gui_settings()->get_value(settings_keep_logged_in, true) != v) get_gui_settings()->set_value(settings_keep_logged_in, v); }); next_page_link_->setText(QT_TRANSLATE_NOOP("login_page","Continue")); Q_UNUSED(this); login_staked_widget_->setCurrentIndex(2); next_page_link_->setDefault(false); QMetaObject::connectSlotsByName(this); init(); }