Bug #1604 ยป 1604_qt.patch
| client/gui-qt/helpdlg.cpp | ||
|---|---|---|
| 
       struct canvas *canvas; 
   | 
||
| 
       const struct unit_type *obsolete; 
   | 
||
| 
       struct unit_type *utype, *max_utype; 
   | 
||
| 
       QList<int> list; 
   | 
||
| 
       QString str; 
   | 
||
| 
       utype = unit_type_by_translated_name(title); 
   | 
||
| ... | ... | |
| 
         add_info_separator(); 
   | 
||
| 
         // Tech requirement 
   | 
||
| 
         tech = utype_primary_tech_req(utype); 
   | 
||
| 
         if (advance_number(tech) != A_NONE) { 
   | 
||
| 
           QLabel *tb; 
   | 
||
| 
           tb = new QLabel(this); 
   | 
||
| 
         // Tech requirements 
   | 
||
| 
         // see if any reqs 
   | 
||
| 
         if (utype->build_reqs.size == 0) { 
   | 
||
| 
           add_info_label(_("No technology required.")); 
   | 
||
| 
         } else { 
   | 
||
| 
           // there is >= 1 req 
   | 
||
| 
           // TRANS: this and similar literal strings interpreted as (Qt) HTML 
   | 
||
| 
           str = _("Requires"); 
   | 
||
| 
           str = "<b>" + str + "</b> " 
   | 
||
| 
                 + link_me(advance_name_translation(tech), HELP_TECH); 
   | 
||
| 
           str = "<b>" + str + "</b> "; 
   | 
||
| 
           tb->setProperty(fonts::help_label, "true"); 
   | 
||
| 
           tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse); 
   | 
||
| 
           tb->setTextFormat(Qt::RichText); 
   | 
||
| 
           tb->setText(str.trimmed()); 
   | 
||
| 
           connect(tb, &QLabel::linkActivated, 
   | 
||
| 
                   this, &help_widget::anchor_clicked); 
   | 
||
| 
           info_layout->addWidget(tb); 
   | 
||
| 
         } else { 
   | 
||
| 
           add_info_label(_("No technology required.")); 
   | 
||
| 
           // iterate all the reqs 
   | 
||
| 
           QLabel *tb; 
   | 
||
| 
           int num_reqs_on_this_line = 0; 
   | 
||
| 
           unit_tech_reqs_iterate(utype, padv) { 
   | 
||
| 
             str = str + link_me(advance_name_translation(padv), HELP_TECH); 
   | 
||
| 
             if (++num_reqs_on_this_line == 3) { 
   | 
||
| 
               // start a new line when we get 3 on this line 
   | 
||
| 
               tb = new QLabel(this); 
   | 
||
| 
               tb->setProperty(fonts::help_label, "true"); 
   | 
||
| 
               tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse); 
   | 
||
| 
               tb->setTextFormat(Qt::RichText); 
   | 
||
| 
               tb->setText(str.trimmed()); 
   | 
||
| 
               connect(tb, &QLabel::linkActivated, 
   | 
||
| 
                       this, &help_widget::anchor_clicked); 
   | 
||
| 
               info_layout->addWidget(tb); 
   | 
||
| 
               num_reqs_on_this_line = 0; 
   | 
||
| 
               str = ""; 
   | 
||
| 
             } 
   | 
||
| 
           } unit_tech_reqs_iterate_end; 
   | 
||
| 
           // finish any leftovers on last line 
   | 
||
| 
           if (num_reqs_on_this_line != 0) { 
   | 
||
| 
               tb = new QLabel(this); 
   | 
||
| 
               tb->setProperty(fonts::help_label, "true"); 
   | 
||
| 
               tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse); 
   | 
||
| 
               tb->setTextFormat(Qt::RichText); 
   | 
||
| 
               tb->setText(str.trimmed()); 
   | 
||
| 
               connect(tb, &QLabel::linkActivated, 
   | 
||
| 
                       this, &help_widget::anchor_clicked); 
   | 
||
| 
               info_layout->addWidget(tb); 
   | 
||
| 
           } 
   | 
||
| 
         } 
   | 
||
| 
         // Obsolescence 
   | 
||