@@ -32,47 +32,13 @@ ApplicationDialog::ApplicationDialog(const QString &name,
3232 QWidget *parent) :
3333 QDialog(parent)
3434{
35- QVBoxLayout *layout = new QVBoxLayout ();
36- mName = new QLineEdit (name);
37- mName ->setMaxLength (100 ); // Should be plenty for app name
38- mPath = new QLineEdit (QDir::toNativeSeparators (path));
39-
40- QString guide = tr (" Here you can add applications that can open error files.\n " \
41- " Specify a name for the application and the application to execute.\n\n " \
42- " The following texts are replaced with appriproate values when application is executed:\n " \
43- " (file) - Filename containing the error\n " \
44- " (line) - Line number containing the error\n " \
45- " (message) - Error message\n " \
46- " (severity) - Error severity\n " \
47- " \n " \
48- " Example opening a file with Kate and make Kate scroll to the correct line:\n " \
49- " kate -l(line) (file)" );
50-
51- layout->addWidget (new QLabel (guide));
52-
53- layout->addWidget (new QLabel (tr (" Application's name" )));
54- layout->addWidget (mName );
55- layout->addWidget (new QLabel (tr (" Application to execute" )));
56- layout->addWidget (mPath );
57- QPushButton *browse = new QPushButton (tr (" Browse" ));
58- connect (browse, SIGNAL (clicked ()), this , SLOT (Browse ()));
59- layout->addWidget (browse);
60-
61- QPushButton *cancel = new QPushButton (tr (" Cancel" ));
62- QPushButton *ok = new QPushButton (tr (" Ok" ));
63-
64- // Add a layout for ok/cancel buttons
65- QHBoxLayout *buttonLayout = new QHBoxLayout ();
66- buttonLayout->addWidget (ok);
67- buttonLayout->addWidget (cancel);
68- layout->addLayout (buttonLayout);
69-
70- // Connect OK buttons
71- connect (ok, SIGNAL (clicked ()),
72- this , SLOT (Ok ()));
73- connect (cancel, SIGNAL (clicked ()),
74- this , SLOT (reject ()));
75- setLayout (layout);
35+ mUI .setupUi (this );
36+
37+ connect (mUI .mButtonBrowse , SIGNAL (clicked ()), this , SLOT (Browse ()));
38+ connect (mUI .mButtons , SIGNAL (accepted ()), this , SLOT (accept ()));
39+ connect (mUI .mButtons , SIGNAL (rejected ()), this , SLOT (reject ()));
40+ mUI .mPath ->setText (path);
41+ mUI .mName ->setText (name);
7642 setWindowTitle (title);
7743}
7844
@@ -108,24 +74,24 @@ void ApplicationDialog::Browse()
10874 }
10975#endif // Q_WS_WIN
11076
111- mPath ->setText (path);
77+ mUI . mPath ->setText (path);
11278 }
11379}
11480
11581QString ApplicationDialog::GetName ()
11682{
117- return mName ->text ();
83+ return mUI . mName ->text ();
11884}
11985
12086
12187QString ApplicationDialog::GetPath ()
12288{
123- return mPath ->text ();
89+ return mUI . mPath ->text ();
12490}
12591
12692void ApplicationDialog::Ok ()
12793{
128- if (mName ->text ().isEmpty () || mPath ->text ().isEmpty ())
94+ if (mUI . mName ->text ().isEmpty () || mUI . mPath ->text ().isEmpty ())
12995 {
13096 QMessageBox msg (QMessageBox::Warning,
13197 tr (" Cppcheck" ),
@@ -139,7 +105,7 @@ void ApplicationDialog::Ok()
139105 else
140106 {
141107 // Convert possible native (Windows) path to internal presentation format
142- mPath ->setText (QDir::fromNativeSeparators (mPath ->text ()));
108+ mUI . mPath ->setText (QDir::fromNativeSeparators (mUI . mPath ->text ()));
143109 accept ();
144110 }
145111}
0 commit comments