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() );
94 void QY2RelNotesDialog::setRelNotes(
const std::map<string,string>& relnotes )
96 while (tabBar->count() > 0)
98 tabBar->removeTab( 0 );
101 _relnotes = relnotes;
102 _tab_keys = std::vector<string>();
103 for ( std::map<string,string>::const_iterator it = relnotes.begin(); it != relnotes.end(); ++it )
105 _tab_keys.push_back(it->first);
106 tabBar->addTab( it->first.c_str() );
108 if (_relnotes.size() > 1)
116 textBrowser->setText( relnotes.begin()->second.c_str() );
120 QY2RelNotesDialog::~QY2RelNotesDialog()
126 void QY2RelNotesDialog::tabChanged(
int index )
128 if (index < 0 || _tab_keys.empty() || _relnotes.empty())
132 textBrowser->setText( _relnotes[_tab_keys[index]].c_str() );
136 void QY2RelNotesDialog::retranslate()
138 setWindowTitle( _(
"Release Notes" ) );
139 closeButton->setText( _(
"&Close" ) );