1919*/
2020
2121#include " outputdialog.h"
22+ #include " ui_outputdialog.h"
2223#include " ../../src/pacmanexec.h"
2324#include " ../../src/searchbar.h"
2425#include " ../../src/uihelper.h"
3738/*
3839 * The obligatory constructor...
3940 */
40- OutputDialog::OutputDialog (QWidget *parent): QDialog(parent)
41+ OutputDialog::OutputDialog (QWidget *parent):
42+ QDialog(parent),
43+ ui(new Ui::OutputDialog)
4144{
45+ ui->setupUi (this );
4246 init ();
4347 m_upgradeRunning = false ;
4448 m_debugInfo = false ;
@@ -52,49 +56,20 @@ void OutputDialog::setDebugMode(bool newValue)
5256 m_debugInfo = newValue;
5357}
5458
55- QFrame::Shape OutputDialog::frameShape ()
56- {
57- return m_textBrowser->frameShape ();
58- }
59-
60- void OutputDialog::setFrameShape (QFrame::Shape shape)
61- {
62- m_textBrowser->setFrameShape (shape);
63- }
64-
6559/*
6660 * Let's build the main widgets...
6761 */
6862void OutputDialog::init ()
6963{
70- this ->resize (650 , 500 );
71-
72- setWindowTitle (QCoreApplication::translate (" MainWindow" , " System upgrade" ));
7364 setWindowIcon (IconHelper::getIconSystemUpgrade ());
74- m_mainLayout = new QVBoxLayout (this );
75- m_textBrowser = new QTextBrowser (this );
76- m_progressBar = new QProgressBar (this );
77-
78- m_textBrowser->setGeometry (QRect (0 , 0 , 650 , 500 ));
79-
80- m_mainLayout->addWidget (m_textBrowser);
81-
82- m_searchBar = new SearchBar (this );
83- connect (m_searchBar, SIGNAL (textChanged (QString)), this , SLOT (onSearchBarTextChanged (QString)));
84- connect (m_searchBar, SIGNAL (closed ()), this , SLOT (onSearchBarClosed ()));
85- connect (m_searchBar, SIGNAL (findNext ()), this , SLOT (onSearchBarFindNext ()));
86- connect (m_searchBar, SIGNAL (findPrevious ()), this , SLOT (onSearchBarFindPrevious ()));
87- m_mainLayout->addWidget (m_progressBar);
88- m_mainLayout->addWidget (m_searchBar);
89- m_mainLayout->setSpacing (0 );
90- m_mainLayout->setSizeConstraint (QLayout::SetMinimumSize);
91- m_mainLayout->setContentsMargins (2 , 2 , 2 , 2 );
9265
93- m_progressBar->setMinimum (0 );
94- m_progressBar->setMaximum (100 );
95- m_progressBar->setValue (0 );
96- m_progressBar->close ();
97- m_searchBar->show ();
66+ connect (ui->m_searchBar , SIGNAL (textChanged (QString)), this , SLOT (onSearchBarTextChanged (QString)));
67+ connect (ui->m_searchBar , SIGNAL (closed ()), this , SLOT (onSearchBarClosed ()));
68+ connect (ui->m_searchBar , SIGNAL (findNext ()), this , SLOT (onSearchBarFindNext ()));
69+ connect (ui->m_searchBar , SIGNAL (findPrevious ()), this , SLOT (onSearchBarFindPrevious ()));
70+ ui->m_searchBar ->show ();
71+
72+ ui->m_progressBar ->close ();
9873}
9974
10075/*
@@ -147,53 +122,53 @@ void OutputDialog::reject()
147122 */
148123void OutputDialog::onPencertange (int percentage)
149124{
150- if (percentage > 0 && !m_progressBar->isVisible ()) m_progressBar->show ();
151- m_progressBar->setValue (percentage);
125+ if (percentage > 0 && !ui-> m_progressBar ->isVisible ()) ui-> m_progressBar ->show ();
126+ ui-> m_progressBar ->setValue (percentage);
152127}
153128
154129/*
155130 * Helper method to position the text cursor always in the end of doc
156131 */
157132void OutputDialog::positionTextEditCursorAtEnd ()
158133{
159- QTextCursor tc = m_textBrowser->textCursor ();
134+ QTextCursor tc = ui-> m_textBrowser ->textCursor ();
160135 tc.clearSelection ();
161136 tc.movePosition (QTextCursor::End);
162- m_textBrowser->setTextCursor (tc);
137+ ui-> m_textBrowser ->setTextCursor (tc);
163138}
164139
165140/*
166141 * A helper method which writes the given string to the textbrowser
167142 */
168143void OutputDialog::writeToTabOutput (const QString &msg, TreatURLLinks treatURLLinks)
169144{
170- utils::writeToTextBrowser (m_textBrowser, msg, treatURLLinks);
145+ utils::writeToTextBrowser (ui-> m_textBrowser , msg, treatURLLinks);
171146}
172147
173148/*
174149 * Slot called whenever PacmanExec emits a new output
175150 */
176151void OutputDialog::onWriteOutput (const QString &output)
177152{
178- utils::positionTextEditCursorAtEnd (m_textBrowser);
179- m_textBrowser->insertHtml (output);
180- m_textBrowser->ensureCursorVisible ();
153+ utils::positionTextEditCursorAtEnd (ui-> m_textBrowser );
154+ ui-> m_textBrowser ->insertHtml (output);
155+ ui-> m_textBrowser ->ensureCursorVisible ();
181156}
182157
183158/*
184159 * Helper method to find the given "findText" in a TextEdit
185160 */
186161bool OutputDialog::textInTabOutput (const QString& findText)
187162{
188- return (utils::strInQTextEdit (m_textBrowser, findText));
163+ return (utils::strInQTextEdit (ui-> m_textBrowser , findText));
189164}
190165
191166/*
192167 * Slot called whenever PacmanExec finishes its job
193168 */
194169void OutputDialog::pacmanProcessFinished (int exitCode, QProcess::ExitStatus exitStatus)
195170{
196- m_progressBar->close ();
171+ ui-> m_progressBar ->close ();
197172
198173 if ((exitCode == 0 ) && exitStatus == QProcess::NormalExit)
199174 {
@@ -226,31 +201,31 @@ void OutputDialog::pacmanProcessFinished(int exitCode, QProcess::ExitStatus exit
226201 */
227202void OutputDialog::onSearchBarTextChanged (QString strToSearch)
228203{
229- utils::searchBarTextChangedInTextBrowser (m_textBrowser, m_searchBar, strToSearch);
204+ utils::searchBarTextChangedInTextBrowser (ui-> m_textBrowser , ui-> m_searchBar , strToSearch);
230205}
231206
232207/*
233208 * User closed the search bar
234209 */
235210void OutputDialog::onSearchBarClosed ()
236211{
237- utils::searchBarClosedInTextBrowser (m_textBrowser, m_searchBar);
212+ utils::searchBarClosedInTextBrowser (ui-> m_textBrowser , ui-> m_searchBar );
238213}
239214
240215/*
241216 * User requested next found string
242217 */
243218void OutputDialog::onSearchBarFindNext ()
244219{
245- utils::searchBarFindNextInTextBrowser (m_textBrowser, m_searchBar);
220+ utils::searchBarFindNextInTextBrowser (ui-> m_textBrowser , ui-> m_searchBar );
246221}
247222
248223/*
249224 * User requested previous found string
250225 */
251226void OutputDialog::onSearchBarFindPrevious ()
252227{
253- utils::searchBarFindPreviousInTextBrowser (m_textBrowser, m_searchBar);
228+ utils::searchBarFindPreviousInTextBrowser (ui-> m_textBrowser , ui-> m_searchBar );
254229}
255230
256231/*
@@ -277,7 +252,7 @@ void OutputDialog::keyPressEvent(QKeyEvent *ke)
277252{
278253 if (ke->key () == Qt::Key_F && ke->modifiers () == Qt::ControlModifier)
279254 {
280- m_searchBar->show ();
255+ ui-> m_searchBar ->show ();
281256 }
282257 else if (ke->key () == Qt::Key_Escape)
283258 {
0 commit comments