QTfrontend/ui/widget/feedbackdialog.cpp
changeset 11665 30bbbde590ce
parent 11625 9d3e32623567
child 11803 d85d273cb3aa
equal deleted inserted replaced
11651:e5c101a6fb8d 11665:30bbbde590ce
    59 {
    59 {
    60     setModal(true);
    60     setModal(true);
    61     setWindowFlags(Qt::Sheet);
    61     setWindowFlags(Qt::Sheet);
    62     setWindowModality(Qt::WindowModal);
    62     setWindowModality(Qt::WindowModal);
    63     setWindowTitle(tr("Feedback"));
    63     setWindowTitle(tr("Feedback"));
    64     setMinimumSize(700, 460);
       
    65     resize(700, 460);
    64     resize(700, 460);
    66     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    65     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    67 
    66 
    68     netManager = NULL;
    67     netManager = NULL;
    69     GenerateSpecs();
    68     GenerateSpecs();
    70 
    69 
    71     /* Top layout */
    70     /* Top layout */
    72 
    71 
    73     QVBoxLayout * pageLayout = new QVBoxLayout();
    72     QVBoxLayout * pageLayout = new QVBoxLayout();
    74     QHBoxLayout * summaryLayout = new QHBoxLayout();
    73     QGridLayout * feedbackLayout = new QGridLayout();
    75     QHBoxLayout * emailLayout = new QHBoxLayout();
    74 
    76     QHBoxLayout * descriptionLayout = new QHBoxLayout();
    75     setStyleSheet("QPushButton { padding: 5px }");
    77     QHBoxLayout * combinedTopLayout = new QHBoxLayout();
       
    78     QHBoxLayout * systemLayout = new QHBoxLayout();
       
    79 
    76 
    80     info = new QLabel();
    77     info = new QLabel();
    81     info->setText(QString(
    78     info->setText(QString(
    82         "<style type=\"text/css\">"
    79         "<style type=\"text/css\">"
    83         "a { color: #fc0; }"
    80         "a { color: #fc0; }"
    94         .arg(tr("Your email address is optional, but necessary if you want us to get back at you."))
    91         .arg(tr("Your email address is optional, but necessary if you want us to get back at you."))
    95     );
    92     );
    96     info->setOpenExternalLinks(true);
    93     info->setOpenExternalLinks(true);
    97     pageLayout->addWidget(info);
    94     pageLayout->addWidget(info);
    98 
    95 
    99     QVBoxLayout * summaryEmailLayout = new QVBoxLayout();
       
   100 
       
   101     const int labelWidth = 90;
       
   102 
       
   103     label_email = new QLabel();
    96     label_email = new QLabel();
   104     label_email->setText(QLabel::tr("Your Email"));
    97     label_email->setText(QLabel::tr("Your Email"));
   105     label_email->setFixedWidth(labelWidth);
       
   106     emailLayout->addWidget(label_email);
       
   107     email = new QLineEdit();
    98     email = new QLineEdit();
   108     emailLayout->addWidget(email);
    99     feedbackLayout->addWidget(label_email, 0, 0);
   109     summaryEmailLayout->addLayout(emailLayout);
   100     feedbackLayout->addWidget(email, 0, 1);
   110 
   101 
   111     label_summary = new QLabel();
   102     label_summary = new QLabel();
   112     label_summary->setText(QLabel::tr("Summary"));
   103     label_summary->setText(QLabel::tr("Summary"));
   113     label_summary->setFixedWidth(labelWidth);
       
   114     summaryLayout->addWidget(label_summary);
       
   115     summary = new QLineEdit();
   104     summary = new QLineEdit();
   116     summaryLayout->addWidget(summary);
   105     feedbackLayout->addWidget(label_summary, 1, 0);
   117     summaryEmailLayout->addLayout(summaryLayout);
   106     feedbackLayout->addWidget(summary, 1, 1);
   118 
       
   119     combinedTopLayout->addLayout(summaryEmailLayout);
       
   120 
   107 
   121     CheckSendSpecs = new QCheckBox();
   108     CheckSendSpecs = new QCheckBox();
   122     CheckSendSpecs->setText(QLabel::tr("Send system information"));
   109     CheckSendSpecs->setText(QLabel::tr("Send system information"));
   123     CheckSendSpecs->setChecked(true);
   110     CheckSendSpecs->setChecked(true);
   124     systemLayout->addWidget(CheckSendSpecs);
       
   125     BtnViewInfo = new QPushButton(tr("View"));
   111     BtnViewInfo = new QPushButton(tr("View"));
   126     systemLayout->addWidget(BtnViewInfo, 1);
   112     BtnViewInfo->setFixedHeight(40);
   127     BtnViewInfo->setFixedSize(60, 30);
   113     feedbackLayout->addWidget(CheckSendSpecs, 0, 2, 2, 1);
       
   114     feedbackLayout->addWidget(BtnViewInfo, 0, 3, 2, 1);
   128     connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs()));
   115     connect(BtnViewInfo, SIGNAL(clicked()), this, SLOT(ShowSpecs()));
   129     combinedTopLayout->addLayout(systemLayout);
   116 
   130 
       
   131     combinedTopLayout->setStretch(0, 1);
       
   132     combinedTopLayout->insertSpacing(1, 20);
       
   133 
       
   134     pageLayout->addLayout(combinedTopLayout);
       
   135 
   117 
   136     label_description = new QLabel();
   118     label_description = new QLabel();
   137     label_description->setText(QLabel::tr("Description"));
   119     label_description->setText(QLabel::tr("Description"));
   138     label_description->setFixedWidth(labelWidth);
       
   139     descriptionLayout->addWidget(label_description, 0, Qt::AlignTop);
       
   140     description = new QTextBrowser();
   120     description = new QTextBrowser();
   141     description->setReadOnly(false);
   121     description->setReadOnly(false);
   142     descriptionLayout->addWidget(description);
   122     feedbackLayout->addWidget(label_description, 2, 0);
   143     pageLayout->addLayout(descriptionLayout);
   123     feedbackLayout->addWidget(description, 2, 1, 1, 3);
   144 
   124 
   145     /* Bottom layout */
   125     /* Bottom layout */
   146 
   126 
   147     QHBoxLayout * bottomLayout = new QHBoxLayout();
       
   148     QHBoxLayout * captchaLayout = new QHBoxLayout();
   127     QHBoxLayout * captchaLayout = new QHBoxLayout();
   149     QVBoxLayout * captchaInputLayout = new QVBoxLayout();
   128     QVBoxLayout * captchaInputLayout = new QVBoxLayout();
   150 
   129 
   151     QPushButton * BtnCancel = new QPushButton(tr("Cancel"));
   130     QPushButton * BtnCancel = new QPushButton(tr("Cancel"));
   152     bottomLayout->addWidget(BtnCancel, 0);
   131     feedbackLayout->addWidget(BtnCancel, 3, 0);
   153     BtnCancel->setFixedSize(100, 40);
   132     BtnCancel->setFixedHeight(40);
   154     connect(BtnCancel, SIGNAL(clicked()), this, SLOT(reject()));
   133     connect(BtnCancel, SIGNAL(clicked()), this, SLOT(reject()));
   155 
       
   156     bottomLayout->insertStretch(1);
       
   157 
   134 
   158     label_captcha = new QLabel();
   135     label_captcha = new QLabel();
   159     label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
   136     label_captcha->setStyleSheet("border: 3px solid #ffcc00; border-radius: 4px");
   160     label_captcha->setText("loading<br>captcha");
   137     label_captcha->setText("loading<br>captcha");
   161     label_captcha->setFixedSize(200, 50);
   138     label_captcha->setFixedSize(200, 50);
   164     label_captcha_input = new QLabel();
   141     label_captcha_input = new QLabel();
   165     label_captcha_input->setText(QLabel::tr("Type the security code:"));
   142     label_captcha_input->setText(QLabel::tr("Type the security code:"));
   166     captchaInputLayout->addWidget(label_captcha_input);
   143     captchaInputLayout->addWidget(label_captcha_input);
   167     captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
   144     captchaInputLayout->setAlignment(label_captcha, Qt::AlignBottom);
   168     captcha_code = new QLineEdit();
   145     captcha_code = new QLineEdit();
   169     captcha_code->setFixedSize(165, 30);
   146     captcha_code->setFixedHeight(30);
   170     captchaInputLayout->addWidget(captcha_code);
   147     captchaInputLayout->addWidget(captcha_code);
   171     captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
   148     captchaInputLayout->setAlignment(captcha_code, Qt::AlignTop);
   172     captchaLayout->addLayout(captchaInputLayout);
   149     captchaLayout->addLayout(captchaInputLayout);
   173     captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
   150     captchaLayout->setAlignment(captchaInputLayout, Qt::AlignLeft);
   174 
   151 
   175     bottomLayout->addLayout(captchaLayout);
   152     QWidget * captchaLayoutWidget = new QWidget();
   176     bottomLayout->addSpacing(40);
   153     captchaLayoutWidget->setContentsMargins(0, 0, 0, 0);
       
   154     captchaLayoutWidget->setLayout(captchaLayout);
       
   155     feedbackLayout->addWidget(captchaLayoutWidget, 3, 1, 1, 2);
   177 
   156 
   178     // TODO: Set green arrow icon for send button (:/res/Start.png)
   157     // TODO: Set green arrow icon for send button (:/res/Start.png)
   179     BtnSend = new QPushButton(tr("Send Feedback"));
   158     BtnSend = new QPushButton(tr("Send Feedback"));
   180     bottomLayout->addWidget(BtnSend, 0);
   159     feedbackLayout->addWidget(BtnSend, 3, 3);
   181     BtnSend->setFixedSize(120, 40);
   160     BtnSend->setFixedHeight(40);
   182     connect(BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback()));
   161     connect(BtnSend, SIGNAL(clicked()), this, SLOT(SendFeedback()));
   183 
   162 
   184     bottomLayout->setStretchFactor(captchaLayout, 0);
   163     pageLayout->addLayout(feedbackLayout);
   185     bottomLayout->setStretchFactor(BtnSend, 1);
       
   186 
   164 
   187     QVBoxLayout * dialogLayout = new QVBoxLayout(this);
   165     QVBoxLayout * dialogLayout = new QVBoxLayout(this);
   188     dialogLayout->addLayout(pageLayout, 1);
   166     dialogLayout->addLayout(pageLayout, 1);
   189     dialogLayout->addLayout(bottomLayout);
       
   190 
   167 
   191     LoadCaptchaImage();
   168     LoadCaptchaImage();
   192 }
   169 }
   193 
   170 
   194 void FeedbackDialog::GenerateSpecs()
   171 void FeedbackDialog::GenerateSpecs()