27 #include "QY2RelNotesDialog.h" 29 #include <QTextObject> 32 #include "QY2Styler.h" 33 #define YUILogComponent "qt-ui" 34 #include <yui/YUILog.h> 41 #define TEXTDOMAIN "qt" 44 QY2RelNotesDialog::QY2RelNotesDialog( QWidget *parent )
47 if (this->objectName().isEmpty())
48 this->setObjectName(QStringLiteral(
"QRelNotesDialog"));
49 this->resize(581, 388);
50 vboxLayout =
new QVBoxLayout(
this);
51 vboxLayout->setObjectName(QStringLiteral(
"vboxLayout"));
53 tabBar =
new QTabBar(
this );
54 Q_CHECK_PTR( tabBar );
56 tabBar->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
57 setFocusProxy( tabBar );
58 setFocusPolicy( Qt::TabFocus );
60 QObject::connect( tabBar, SIGNAL(currentChanged(
int)),
this, SLOT(tabChanged(
int )));
62 vboxLayout->addWidget(tabBar);
64 textBrowser =
new QTextBrowser(
this);
65 textBrowser->setObjectName(QStringLiteral(
"textBrowser"));
67 vboxLayout->addWidget(textBrowser);
69 hboxLayout =
new QHBoxLayout();
70 closeButton =
new QPushButton(
this);
71 closeButton->setObjectName(QStringLiteral(
"closeButton"));
72 hboxLayout->addStretch();
73 hboxLayout->addWidget(closeButton);
74 hboxLayout->addStretch();
76 vboxLayout->addLayout(hboxLayout);
78 QObject::connect(closeButton, SIGNAL(clicked()),
this, SLOT(accept()));
83 setWindowTitle( _(
"Release Notes" ) );
86 closeButton->setText( _(
"&Close" ) );
90 textBrowser->document()->setDefaultStyleSheet( QY2Styler::styler()->textStyle() );
93 void QY2RelNotesDialog::setRelNotes(
const std::map<std::string,std::string>& relnotes )
95 while (tabBar->count() > 0)
97 tabBar->removeTab( 0 );
100 _relnotes = relnotes;
101 _tab_keys = std::vector<std::string>();
102 for(std::map<std::string,std::string>::const_iterator it = relnotes.begin(); it != relnotes.end(); ++it) {
103 _tab_keys.push_back(it->first);
104 tabBar->addTab( it->first.c_str() );
106 if (_relnotes.size() > 1)
114 textBrowser->setText( relnotes.begin()->second.c_str() );
117 QY2RelNotesDialog::~QY2RelNotesDialog()
122 void QY2RelNotesDialog::tabChanged(
int index )
124 if (index < 0 || _tab_keys.empty() || _relnotes.empty())
128 textBrowser->setText( _relnotes[_tab_keys[index]].c_str() );
131 void QY2RelNotesDialog::retranslate()
133 setWindowTitle( _(
"Release Notes" ) );
134 closeButton->setText( _(
"&Close" ) );
139 #include "QY2RelNotesDialog.moc" void registerWidget(QWidget *widget)
Registers a widget and applies the style sheet.
void unregisterWidget(QWidget *widget)
Unregisters a widget.
static void setTextdomain(const char *domain)
Initialize and set a textdomain for gettext()