Exemplo n.º 1
0
LRESULT FramelessDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    //
    //
    //

    switch (uMsg) {
    case WM_NCHITTEST: {
        LRESULT hit = DefWindowProc(hwnd, uMsg, wParam, lParam);
        if (hit == HTCLIENT)
        {
            POINT p;
            if (GetCursorPos(&p))
            {
                if (ScreenToClient(hwnd, &p))
                {
                    if (p.y < DragAreaHeight * windowsDpiScale())
                    {
                        hit = HTCAPTION;
                    }

                    RECT rect;
                    GetWindowRect(hwnd, &rect);

                    if(p.x > ((rect.right - rect.left) - CloseButtonWidth*windowsDpiScale()))
                    {
                        for(auto keks : wndProcMap)
                        {
                            if(keks.first == hwnd)
                            {

                                return CallWindowProc(keks.second, hwnd, uMsg, wParam, lParam);
                            }
                        }
                    }
                }
            }
        }

        return hit;
                       }

    default:
        for(auto keks : wndProcMap)
        {
            if(keks.first == hwnd)
                return CallWindowProc(keks.second, hwnd, uMsg, wParam, lParam);
        }
    }

    return 0;
}
Exemplo n.º 2
0
FrmGetUserData::FrmGetUserData(InputType::UserInputType type, const QString &name, int id, QWidget * parent)
    : FramelessDialog(parent),
    ui(new Ui::FrmGetUserData),
    dataAvail(false),
    frmType (type),
    vpnId (id),
    force (false)
{
   
    // 0 - Username
    // 1 - Pwd
    // 2 - OTP
    // 3 - PKCS12
    // 4 - Private Key für Crypted User Data

    ui->setupUi((QDialog*)this->getWrapperWidget());  

    QMetaObject::connectSlotsByName(this);

    auto geom = this->getWrapperWidget()->geometry();
    auto size = geom.size() * windowsDpiScale();
    geom = geometry();
    geom.setSize(size);
    this->getWrapperWidget()->setGeometry(geom);

    this->setupFrameless();

    ui->cbSaveData->setChecked(false);

    ui->groupBox->setTitle(QApplication::translate("FrmGetUserData", "Connection to"));
    ui->groupBox->setTitle(ui->groupBox->title() +  QLatin1String(": ") + name);


}
Exemplo n.º 3
0
AdvPage::AdvPage(QWidget *parent) :
    QWizardPage(parent),
    m_ui(new Ui::AdvPage)
{
    m_ui->setupUi(this);

    auto geom = this->geometry();
    auto size = geom.size() * windowsDpiScale();
    geom.setSize(size);
    this->setGeometry(geom);

    m_ui->cmbRouteMethod->insertItem(0, QLatin1String("Not defined"));
    m_ui->cmbRouteMethod->insertItem(1, QLatin1String("EXE"));
    m_ui->cmbRouteMethod->insertItem(2, QLatin1String("IPAPI"));
    // register Fields
    registerField(QLatin1String("txtMssFix"), m_ui->cbMsfix);
    registerField(QLatin1String("txtRouteMethod"), m_ui->cmbRouteMethod);
    registerField(QLatin1String("txtMute"), m_ui->txtMute);
    registerField(QLatin1String("txtVerbose"), m_ui->txtVerbose);
    registerField(QLatin1String("txtRouteDelay"), m_ui->txtRouteDelay);
    registerField(QLatin1String("txtCompLzo"), m_ui->cbCompLzo);
    registerField(QLatin1String("txtFloat"), m_ui->cbFloat);
    registerField(QLatin1String("txtNobind"), m_ui->cbNobind);
    registerField(QLatin1String("txtUserPass"), m_ui->cbUserPass);

    // Windir
    // Fields
    registerField(QLatin1String("cbDefault"), m_ui->cbWinDirUseDefault);
    registerField(QLatin1String("cbOther"), m_ui->cbWinDirOther);
    registerField(QLatin1String("cbEnvironment"), m_ui->cbWinDirEnvironment);
    registerField(QLatin1String("cbPath"), m_ui->cbWinDirPath);

    registerField(QLatin1String("txtPath"), m_ui->txtPath);

    this->setTitle("\n\n" + this->title());
}
void ListViewSingleButtonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
     //
    // This method paints a new row into the listview
    //

    painter->save();

    // Set normal background color
    painter->setBrush((QColor("#ffffff")));

    // Alternating rows
    if (index.row() % 2) {
        // Set brush to aliceblue
        painter->setBrush((QColor("#f5f5f5")));
    }

    if(index.model()->data(index, Qt::UserRole + 4).toInt() == ConnectionState::Error)
    {
        painter->setBrush(QColor("#FFCCCC"));
    }

    QString textBottom (index.model()->data(index, Qt::UserRole + 101).toString());
    QString textName (index.data(Qt::DisplayRole).toString());

    // Hindergrund zeichnen
    painter->setPen(Qt::NoPen);

    if (textBottom == "__divider__") {
        painter->setBrush(QBrush(QColor("#f2f2f2"))); //0053a1
        painter->drawRect(option.rect);
        painter->setPen(Qt::lightGray);
        painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());
        if (index.row() == 0) {
            painter->drawLine(option.rect.topLeft(), option.rect.topRight());
        }

        painter->setPen(Qt::black);
        QStyleOptionViewItem nOptionD (option);
        QFont sdasda("Verdana", 10, QFont::Normal);
        //sdasda.setPixelSize(11);
        painter->setFont(sdasda);
        nOptionD.rect.adjust(3, 0, 0, 0);
        painter->drawText(nOptionD.rect, textName);
        rectForRow.insert(index.row(), QRect());
        rectForRow[index.row()] = option.rect;
         painter->restore();
        return;
    }

    painter->drawRect(option.rect);

    // Get text

    QString ip (index.data(Qt::UserRole + 1).toString());
    quint32 lastUsed(index.data(Qt::UserRole + 2).toUInt());
    quint32 lastConnected(index.data(Qt::UserRole + 3).toUInt());
    // Set and calc items width
    int buttonWidth (36* windowsDpiScale());
    int buttonHeight (36* windowsDpiScale());
    int marginRight (10* windowsDpiScale());
    int marginTop (5* windowsDpiScale());

    // Draw delete button
    QStyleOptionViewItem buttonOption (option);
    // -10 is the right margin, the margin is necessary to reset the state when mouse is leaving to the right side
    buttonOption.rect.setRight(buttonWidth + 2 * marginRight);
    buttonOption.rect.setHeight(buttonHeight);
    buttonOption.rect.adjust(10* windowsDpiScale(), option.rect.height() / 2 - buttonHeight / 2, -(marginRight), marginTop + 1);
    buttonOption.rect.setHeight(buttonHeight);
    // Draw delete button and return limits
    // This is to figure out which button is under the mouse position
    rectForRow.insert(index.row(), QRect());
    rectForRow[index.row()] = buttonOption.rect;

    auto drawButton = [](const QModelIndex &index, QPainter *painter, const QRect &rect, int role, ConnectionState conState)
    {
        // Draw delete button
        QStyleOptionButton buttonStyle;

        //
        // Set the button state to enabled
        buttonStyle.state |= QStyle::State_Enabled;
        // Set postion and size to the item
        buttonStyle.rect = rect;
        // Button is a flat button
        buttonStyle.features = QStyleOptionButton::Flat;
        // No text, only an icon
        // Icon default is 16x16
        buttonStyle.iconSize = QSize(16* windowsDpiScale(), 16* windowsDpiScale());
        //

        // Set the button states
        ButtonState state = (ButtonState) index.data(role).toInt();
        QPen pen;
        pen.setWidth(1);

        switch(conState)
        {
        case ConnectionState::Disconnected:
            {
                if(state == Hover) {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#F0D151"));
                } else if(state == Pressed) {

                } else {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#EEEEEC"));
                }
            }
            break;
        case ConnectionState::Connecting:
            {
                if(state == Hover) {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#EEEEEC"));
                } else if(state == Pressed) {
                } else {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#F1C40F"));
                }

            }
            break;
        case ConnectionState::Connected:
            {
                if(state == Hover) {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#EEEEEC"));
                } else if(state == Pressed) {
                } else {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#72C02C"));
                }
            }
            break;
        case ConnectionState::Error:
            {
                if(state == Hover) {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#F0D151"));
                } else if(state == Pressed) {
                } else {
                    pen.setColor("#808080");
                    painter->setBrush(QBrush("#FF0000"));
                }
            }
            break;
        default:
            {
                pen.setColor("#808080");
                painter->setBrush(QBrush("#EEEEEC"));
            }
        }

    // Set the pen and draw the border of the button
    painter->setPen(pen);
    painter->drawRect(buttonStyle.rect);
    painter->setBrush(Qt::NoBrush);

    QRect buttonOption(rect);



    // Draw button
    QApplication::style()->drawControl(QStyle::CE_PushButton, &buttonStyle, painter);
    };

    ConnectionState conState = (ConnectionState)index.data(Qt::UserRole + 4).toInt();

    drawButton(index, painter, buttonOption.rect, Qt::UserRole + 100, conState);

   // this->buttonLimits = this->drawButton(index, painter, buttonOption.rect, this->iconForType(this->buttonIconType, option), Qt::UserRole + 100);


    // Draw text
    QStyleOptionViewItem textOption (option);
    textOption.rect.adjust(buttonWidth + marginRight + 10 + 4, 4, buttonWidth + 2 * marginRight, 0);
    QPen pen;
    pen.setColor(QColor("#2c2c2c"));
    painter->setPen(pen);

    QFont font1("Verdana", 9, QFont::Normal);
    //font1.setPixelSize(11);
    
    QFont font2("Verdana", 7, QFont::Normal);
    //font2.setPixelSize(9);

    painter->setFont(font1);
    painter->drawText(textOption.rect, textName);
    textOption.rect.adjust(0, 13* windowsDpiScale(), 0, 0);
    painter->setFont(font2);
    //painter->drawText(textOption.rect, "Connected: ");
    //textOption.rect.adjust(0, 9, 0, 0);
    //painter->drawText(textOption.rect, "Last used: ");
    //textOption.rect.adjust(0, 9, 0, 0);

    typedef std::chrono::duration<int, std::ratio_multiply<std::chrono::hours::period, std::ratio<24>>::type> days;
    std::chrono::seconds sec((QDateTime::currentDateTime().toTime_t() - lastConnected));

    auto d = std::chrono::duration_cast<days>(sec);
    auto h = std::chrono::duration_cast<std::chrono::hours>(sec - d);
    auto m = std::chrono::duration_cast<std::chrono::minutes>((sec - d - h));
    auto s = std::chrono::duration_cast<std::chrono::seconds>((sec - d - h - m));


    QString day("%1%2 D ");
    day = day.arg(d.count() < 10 ? "0" : "")
        .arg(d.count());

    QString hour("%1%2 H ");
    hour = hour.arg(h.count() < 10 ? "0" : "")
        .arg(h.count());

    QString minute("%1%2 M ");
    minute = minute.arg(m.count() < 10 ? "0" : "")
        .arg(m.count());

    switch(conState)
    {
    case ConnectionState::Connected:
        painter->drawText(textOption.rect, QObject::tr("Connected: ") + (day) + (hour) + (d.count() > 0 ? "" : minute));
        break;
    case ConnectionState::Disconnected:
        painter->drawText(textOption.rect, QObject::tr("Last used: ") + (lastUsed == 0 ? QObject::tr("Never") : QDateTime::fromTime_t(lastUsed).toString("dd.MM.yy hh:mm")));
        break;
    default:
        painter->drawText(textOption.rect, QObject::tr("Last used: ") + (lastUsed == 0 ? QObject::tr("Never") : QDateTime::fromTime_t(lastUsed).toString("dd.MM.yy hh:mm")));
        break;
    };

    if(buttonOption.rect.size() != _lastImgSize)
    {     
        imgStart = imgStart_.scaled(buttonOption.rect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        imgOffline = imgOffline_.scaled(buttonOption.rect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        imgError = imgError_.scaled(buttonOption.rect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        imgOnline = imgOnline_.scaled(buttonOption.rect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        imgStop = imgStop_.scaled(buttonOption.rect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        imgConnecting = imgConnecting_.scaled(buttonOption.rect.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        auto s = buttonOption.rect.size();

        // I dont know why this thing has to be adjusted, but well, it works.
        s.setWidth(s.width() - 1);
        s.setHeight(s.height() - 1);
        movieKeks->setScaledSize(s);

        QSize size(16, 16);

        

        imgIconUsers = imgIconUsers_.scaled(size * windowsDpiScale(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
        imgIconAutostart = imgIconAutostart_.scaled(size * windowsDpiScale(), Qt::KeepAspectRatio, Qt::SmoothTransformation);

        _lastImgSize = buttonOption.rect.size();
    }   
    buttonOption.rect.adjust(((buttonWidth) - imgStart.width()) / 2 +1, ((buttonWidth) - imgStart.height()) / 2 + 1, 0, 0);

    ButtonState state = (ButtonState) index.data(Qt::UserRole + 100).toInt();

    switch(conState)
    {
    case ConnectionState::Disconnected:
        {
            if(state == Hover)
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgStart);
            else
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgOffline);
        }
        break;
    case ConnectionState::Connecting:
        {
            if(state == Hover)
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgStop);
            else
            {
                auto pixx = movieKeks->currentPixmap();
                //auto size = imgStart.size();
                ////size.setHeight(size.height() -10);
                //pixx = pixx.scaled(imgStart.size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), pixx.toImage());
            }
        }
        break;
    case ConnectionState::Connected:
        {
            if(state == Hover)
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgStop);
            else
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgOnline);
        }
        break;
    case ConnectionState::Error:
        {
            if(state == Hover)
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgStart);
            else
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgError);
        }
        break;
    default:
        {
            if(state == Hover)
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgStart);
            else
                painter->drawImage(buttonOption.rect.left(),  buttonOption.rect.top(), imgOffline);
        }
    }


    static const int iconPadding = 5;

    textOption.rect.setTop(buttonOption.rect.bottom());
    textOption.rect.adjust(0, -imgIconAutostart.height()+2, 0, 0);
    textOption.rect.setWidth(imgIconAutostart.width());

    if(index.data(Qt::UserRole + 5).toBool())
    {
        painter->drawImage(textOption.rect.left(),  textOption.rect.top(), imgIconAutostart);
        textOption.rect.adjust(imgIconAutostart.width() + iconPadding, 0, 0, 0);
    }

    if(index.data(Qt::UserRole + 6).toBool())
    {
        painter->drawImage(textOption.rect.left(),  textOption.rect.top(), imgIconUsers);
        textOption.rect.adjust(imgIconAutostart.width() + iconPadding, 0, 0, 0);
    }
    painter->setPen(Qt::lightGray);
    painter->drawLine(option.rect.bottomLeft(), option.rect.bottomRight());

    // Restore saved painter
    painter->restore();
}
Exemplo n.º 5
0
void FramelessDialog::setupFrameless()
{
    /* Make the line stuff border and line below title */
    
    if(!bIsFramelessSetup)
    {
        auto geo = wrapper->geometry();
        geo.adjust(0, DragAreaHeight*windowsDpiScale(), 0, DragAreaHeight*windowsDpiScale());
        wrapper->setGeometry(geo);

        this->setMaximumSize(wrapper->maximumSize().width(), wrapper->maximumSize().height() + DragAreaHeight*windowsDpiScale());
        this->setMinimumSize(wrapper->minimumSize().width(), wrapper->minimumSize().height() + DragAreaHeight*windowsDpiScale());

        auto geom = geometry();
        geom.setSize(QSize(geo.width(), geo.height() + DragAreaHeight*windowsDpiScale()));
        setGeometry(geom);

        wrapper->setMaximumSize(wrapper->maximumSize().width(), wrapper->maximumSize().height() + DragAreaHeight*windowsDpiScale());
        wrapper->setMinimumSize(wrapper->minimumSize().width(), wrapper->minimumSize().height() + DragAreaHeight*windowsDpiScale());

        this->setWindowFlags(Qt::FramelessWindowHint);
        auto size = this->size();


        auto windowTitleLabel_BG = new QLabel(this);
        windowTitleLabel_BG->setObjectName(QStringLiteral("windowTitleLabel"));
        QFont font;
        font.setFamily(QStringLiteral("Verdana"));
        font.setPointSize(8);
        windowTitleLabel_BG->setFont(font);
        windowTitleLabel_BG->setStyleSheet(QStringLiteral(""));

        windowTitleLabel_BG->setGeometry(QRect(0, 0, size.width() - CloseButtonWidth, DragAreaHeight*windowsDpiScale()));


        auto windowTitleIcon = new QLabel(this);
        windowTitleIcon->setObjectName(QStringLiteral("windowTitleIcon"));
        windowTitleIcon->setMaximumSize(QSize(130, DragAreaHeight*windowsDpiScale()));
        windowTitleIcon->setGeometry(QRect(4, 0, 130, DragAreaHeight*windowsDpiScale()));

        windowTitleIcon->setStyleSheet(QStringLiteral(""));
        windowTitleIcon->setPixmap(QPixmap(QString::fromUtf8(":/data/images/logo.png")));

        static QImage img;

        static std::once_flag flag;
        std::call_once(flag, [this]() {
            img.load(":/data/images/logo.png", "PNG");
            img = img.scaled(QSize(122*windowsDpiScale(), 9*windowsDpiScale()), Qt::KeepAspectRatio, Qt::SmoothTransformation);        
        });

        windowTitleIcon->setPixmap(QPixmap::fromImage(img));
        windowTitleIcon->setMaximumSize(130*windowsDpiScale(), DragAreaHeight*windowsDpiScale());
        windowTitleIcon->setMinimumSize(130*windowsDpiScale(), DragAreaHeight*windowsDpiScale());
        windowTitleIcon->setFixedSize(130*windowsDpiScale(), DragAreaHeight*windowsDpiScale());
        auto g = windowTitleIcon->geometry();
        g.setSize(QSize(130*windowsDpiScale(), DragAreaHeight*windowsDpiScale()));
        windowTitleIcon->setGeometry(g);
        

        auto windowTitleLabel = new QLabel(this);
        windowTitleLabel->setObjectName(QStringLiteral("windowTitleLabel"));
        font.setFamily(QStringLiteral("Verdana"));
        font.setPointSize(8);
        windowTitleLabel->setFont(font);
        windowTitleLabel->setStyleSheet(QStringLiteral(""));

        windowTitleLabel->setGeometry(QRect(windowTitleIcon->width() + 4, 0, size.width() - CloseButtonWidth, DragAreaHeight*windowsDpiScale()));

        windowTitleLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
        windowTitleLabel->setText("SSL VPN v2" /*this->windowTitle()*/);

        auto line = new QFrame(this);
        line->setObjectName(QStringLiteral("line"));
        line->setGeometry(QRect(0, DragAreaHeight*windowsDpiScale(), size.width(), 1));
        line->setAutoFillBackground(false);
        line->setStyleSheet(QStringLiteral(""));
        line->setFrameShadow(QFrame::Plain);
        line->setFrameShape(QFrame::HLine);

        auto line_2 = new QFrame(this);
        line_2->setObjectName(QStringLiteral("line_2"));
        line_2->setGeometry(QRect(0, 0, size.width() + 1, 1));
        line_2->setAutoFillBackground(false);
        line_2->setStyleSheet(QStringLiteral("color: gray;"));
        line_2->setFrameShadow(QFrame::Plain);
        line_2->setFrameShape(QFrame::HLine);

        auto line_3 = new QFrame(this);
        line_3->setObjectName(QStringLiteral("line_3"));
        line_3->setGeometry(QRect(0, size.height() - 1, size.width() + 1, 1));
        line_3->setAutoFillBackground(false);
        line_3->setStyleSheet(QStringLiteral("color: gray;"));
        line_3->setFrameShadow(QFrame::Plain);
        line_3->setFrameShape(QFrame::HLine);

        auto line_4 = new QFrame(this);
        line_4->setObjectName(QStringLiteral("line_4"));
        line_4->setGeometry(QRect(0, 0, 1, size.height() + 1));
        line_4->setStyleSheet(QStringLiteral("color: gray;"));
        line_4->setFrameShadow(QFrame::Plain);
        line_4->setFrameShape(QFrame::VLine);

        auto line_5 = new QFrame(this);
        line_5->setObjectName(QStringLiteral("line_5"));
        line_5->setGeometry(QRect(size.width() - 1, 0, 1, size.height() + 1));
        line_5->setStyleSheet(QStringLiteral("color: gray;"));
        line_5->setFrameShadow(QFrame::Plain);
        line_5->setFrameShape(QFrame::VLine);

       /* auto lbWindowTitle = new QLabel(this);
        lbWindowTitle->setObjectName(QStringLiteral("lbWindowTitle"));
        lbWindowTitle->setGeometry(QRect(4, 0, size.width() - CloseButtonWidth, DragAreaHeight));
        lbWindowTitle->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
        lbWindowTitle->setText(this->windowTitle());
*/
       

     /*  auto windowTitleIcon = new QLabel(this);
       auto windowTitleLabel = new QLabel(this);
       auto horizontalSpacer = new QSpacerItem(40, 20);
       
       windowTitleIcon->setPixmap(QPixmap(":/data/images/logo.png"));
       windowTitleLabel->setText("SSL VPN v2");
       hHeader->addWidget(windowTitleIcon);
       hHeader->addWidget(windowTitleLabel);*/

        auto cmdClose_2 = new QPushButton(this);
        cmdClose_2->setObjectName(QStringLiteral("close_dat_shit"));
        cmdClose_2->setGeometry(QRect(size.width() - DragAreaHeight*windowsDpiScale(), 2, 16*windowsDpiScale(), 16*windowsDpiScale()));

        connectionClose = QObject::connect(cmdClose_2, &QPushButton::clicked, [&]() {
            this->close();
        });

        {
            QImage img(":/data/images/close.png");
            img = img.scaled(QSize(16*windowsDpiScale(), 16*windowsDpiScale()), Qt::KeepAspectRatio, Qt::SmoothTransformation);

            QIcon icon1;
            icon1.addPixmap(QPixmap::fromImage(img));
        
            cmdClose_2->setIcon(icon1);
            cmdClose_2->setIconSize(QSize(16*windowsDpiScale(), 16*windowsDpiScale()));
            cmdClose_2->setFlat(true);
        }
        bIsFramelessSetup = true;
    }
}
Exemplo n.º 6
0
VpnWizard::VpnWizard(QWidget * parent)
    : FramelessWizard(parent)
{
    addPage(new CStartPage);
    addPage(new GeneralPage);
    addPage(new RemotePage);
    addPage(new CertPage);
    addPage(new AdvPage);
    addPage(new CEndPage);

    
    //this->button(QWizard::WizardButton::BackButton)->setIcon(QIcon(":/data/images/back_small.png"));
    //this->button(QWizard::WizardButton::NextButton)->setIcon(QIcon(":/data/images/next_small.png"));
    

    auto geom = this->geometry();
    geom.setHeight(460);
    geom.setWidth(501);

	QSize size = geom.size();
	//
	int h = size.height();
	int w = size.width();
	//

	size.setHeight(qFloor(h * windowsDpiScale()));
	size.setWidth(qFloor(w * windowsDpiScale()));

	setFixedWidth(size.width());
	setFixedHeight(size.height());

	//
    resize(size);
    
    QPixmap pixmap(":/data/images/banner_wiz.png");
    pixmap = pixmap.scaledToWidth(size.width(), Qt::TransformationMode::SmoothTransformation);
    setPixmap(QWizard::BannerPixmap, pixmap);
    //page(0)->setContentsMargins(0, 20, 0, 0);
    //page(1)->setContentsMargins(0, 20, 0, 0);
    //page(2)->setContentsMargins(0, 20, 0, 0);
    //page(3)->setContentsMargins(0, 20, 0, 0);
    //page(4)->setContentsMargins(0, 20, 0, 0);
    setWindowIcon(QIcon(":/data/images/logo.png"));
    setWindowTitle(QObject::tr("Create a new SSL VPN connection"));
    setWindowFlags(Qt::WindowCloseButtonHint);
    setModal(true);
    this->setWindowFlags(Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
    DWORD style = GetWindowLong((HWND)winId(), GWL_STYLE);
    SetWindowLong((HWND)winId(), GWL_STYLE, style);
    setWizardStyle(ModernStyle);
    


    //this->button(QWizard::WizardButton::NextButton)->setLayoutDirection(Qt::RightToLeft);
    this->setButtonText(QWizard::WizardButton::NextButton, QObject::tr("Next"));
    this->setButtonText(QWizard::WizardButton::BackButton, QObject::tr("Back"));
    this->setButtonText(QWizard::WizardButton::CancelButton, QObject::tr("Cancel"));
    this->setButtonText(QWizard::WizardButton::FinishButton, QObject::tr("Finish"));

    setStyleSheet("QPushButton:hover {background-color: rgb(195, 195, 195);}\nQPushButton {;text-align:center;	\npadding-left: 3px;\n	padding-top: 3px;   padding-right: 3px;\n	padding-bottom: 3px;}");

    this->setupFrameless();
}