コード例 #1
0
ファイル: AttachUin.cpp プロジェクト: ICoderXI/icqdesktop
void GeneralSettingsWidget::Creator::initAttachUin(QWidget* parent, std::map<std::string, Synchronizator> &/*collector*/)
{
    auto scroll_area = new QScrollArea(parent);
    scroll_area->setWidgetResizable(true);
    Utils::grabTouchWidget(scroll_area->viewport(), true);

    auto scroll_area_content = new QWidget(scroll_area);
    scroll_area_content->setGeometry(QRect(0, 0, Utils::scale_value(800), Utils::scale_value(600)));
    Utils::grabTouchWidget(scroll_area_content);

    auto scroll_area_content_layout = new QVBoxLayout(scroll_area_content);
    scroll_area_content_layout->setSpacing(0);
    scroll_area_content_layout->setAlignment(Qt::AlignTop);
    scroll_area_content_layout->setContentsMargins(Utils::scale_value(16), 0, 0, Utils::scale_value(48));

    scroll_area->setWidget(scroll_area_content);

    auto layout = new QHBoxLayout(parent);
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);
    
    LoginPage* page = new LoginPage(scroll_area, false /* is_login */);
    page->switchLoginType();

    GeneralCreator::addBackButton(scroll_area, layout, [page]() 
    {
        page->prevPage();
        page->switchLoginType();
        emit Utils::InterConnector::instance().attachUinBack(); 
    });
    layout->addWidget(scroll_area);

    GeneralCreator::addHeader(scroll_area, scroll_area_content_layout, QT_TRANSLATE_NOOP("profile_page", "Connect to ICQ account"));

    scroll_area_content_layout->addWidget(page);

    connect(page, &LoginPage::attached, [page]() 
    {
        if (!page->isVisible())
            return;

        core::coll_helper helper(GetDispatcher()->create_collection(), true);
        GetDispatcher()->post_message_to_core("load_flags", helper.get());
        emit Utils::InterConnector::instance().attachUinBack();
        emit Utils::InterConnector::instance().profileSettingsUpdateInterface();
    });

    connect(&Utils::InterConnector::instance(), &Utils::InterConnector::updateFocus, page, &LoginPage::updateFocus);
}
コード例 #2
0
ファイル: AttachPhone.cpp プロジェクト: admhome/icqdesktop
void GeneralSettingsWidget::Creator::initAttachPhone(QWidget* parent, std::map<std::string, Synchronizator> &/*collector*/)
{
    auto scroll_area = new QScrollArea(parent);
    scroll_area->setWidgetResizable(true);
    Utils::grabTouchWidget(scroll_area->viewport(), true);

    auto scroll_area_content = new QWidget(scroll_area);
    scroll_area_content->setGeometry(QRect(0, 0, Utils::scale_value(800), Utils::scale_value(600)));
    Utils::grabTouchWidget(scroll_area_content);

    auto scroll_area_content_layout = new QVBoxLayout(scroll_area_content);
    scroll_area_content_layout->setSpacing(0);
    scroll_area_content_layout->setAlignment(Qt::AlignTop);
    scroll_area_content_layout->setContentsMargins(Utils::scale_value(16), 0, 0, Utils::scale_value(48));

    scroll_area->setWidget(scroll_area_content);

    auto layout = new QHBoxLayout(parent);
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);
    
    LoginPage* page = new LoginPage(nullptr, false /* is_login */);
    GeneralCreator::addBackButton(scroll_area, layout, [page]()
    {
        page->prevPage();
        emit Utils::InterConnector::instance().attachPhoneBack(); 
    });
    layout->addWidget(scroll_area);

    GeneralCreator::addHeader(scroll_area, scroll_area_content_layout, QT_TRANSLATE_NOOP("sidebar", "Attach phone"));
    scroll_area->setStyleSheet(Utils::LoadStyle(":/main_window/login_page.qss", Utils::get_scale_coefficient(), true));
    scroll_area_content_layout->addWidget(page);

    connect(page, &LoginPage::attached, [page]() 
    {
        if (!page->isVisible())
            return;
        emit Utils::InterConnector::instance().attachPhoneBack();
        emit Utils::InterConnector::instance().profileSettingsUpdateInterface();
    });
}