| 22 | { |
| 23 | |
| 24 | MainProgress::MainProgress(const std::shared_ptr<ThunderSdk>& sdk, const std::shared_ptr<ClientContext>& ctx, QWidget* parent) : QLabel(parent) { |
| 25 | sdk_ = sdk; |
| 26 | context_ = ctx; |
| 27 | settings_ = Settings::Instance(); |
| 28 | auto root_layout = new NoMarginVLayout(); |
| 29 | root_layout->addStretch(1); |
| 30 | // logo |
| 31 | { |
| 32 | auto layout = new NoMarginHLayout(); |
| 33 | auto logo = new QLabel(this); |
| 34 | logo->setFixedSize(100, 100); |
| 35 | logo->setStyleSheet(R"(border-image: url(:/resources/tc_trans_icon_blue.png)})"); |
| 36 | layout->addStretch(); |
| 37 | layout->addWidget(logo); |
| 38 | layout->addStretch(); |
| 39 | |
| 40 | root_layout->addLayout(layout); |
| 41 | } |
| 42 | |
| 43 | // title |
| 44 | { |
| 45 | auto layout = new NoMarginHLayout(); |
| 46 | auto title = new TcLabel(this); |
| 47 | title->SetTextId("id_connecting_server"); |
| 48 | title->setStyleSheet(R"(font-size: 20px; font-weight: 500;)"); |
| 49 | layout->addStretch(); |
| 50 | layout->addWidget(title); |
| 51 | layout->addStretch(); |
| 52 | root_layout->addSpacing(40); |
| 53 | root_layout->addLayout(layout); |
| 54 | } |
| 55 | |
| 56 | // progress bar |
| 57 | { |
| 58 | LOGI("For progressbar, network type: {}, total steps: {}", (int)settings_->network_type_, sdk_->GetProgressSteps()); |
| 59 | auto layout = new NoMarginHLayout(); |
| 60 | auto progress_bar = new QProgressBar(); |
| 61 | progress_bar_ = progress_bar; |
| 62 | progress_bar->setFixedSize(400, 6); |
| 63 | progress_bar->setMaximum(sdk_->GetProgressSteps()); |
| 64 | progress_bar->setValue(0); |
| 65 | layout->addStretch(); |
| 66 | layout->addWidget(progress_bar); |
| 67 | layout->addStretch(); |
| 68 | |
| 69 | root_layout->addSpacing(20); |
| 70 | root_layout->addLayout(layout); |
| 71 | } |
| 72 | |
| 73 | // sub messages |
| 74 | { |
| 75 | auto layout = new NoMarginHLayout(); |
| 76 | auto lbl = new TcLabel(this); |
| 77 | lbl_sub_message_ = lbl; |
| 78 | lbl->SetTextId("id_start_connection"); |
| 79 | lbl->setStyleSheet(R"(font-size: 16px;;)"); |
| 80 | layout->addStretch(); |
| 81 | layout->addWidget(lbl); |
nothing calls this directly
no test coverage detected