38 #include <QFileDialog>
42 #include <QPushButton>
43 #include <QVBoxLayout>
56 QVBoxLayout* layout =
new QVBoxLayout(
this);
59 QLabel* page_title =
new QLabel(
this);
60 page_title->setText(title.c_str());
61 QFont page_title_font(QFont().defaultFamily(), 18, QFont::Bold);
62 page_title->setFont(page_title_font);
63 page_title->setWordWrap(
true);
64 page_title->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
65 layout->addWidget(page_title);
68 QLabel* page_instructions =
new QLabel(
this);
69 page_instructions->setText(instructions.c_str());
70 page_instructions->setWordWrap(
true);
71 page_instructions->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
72 layout->addWidget(page_instructions);
75 layout->setContentsMargins(0, 0, 0, 0);
77 this->setLayout(layout);
80 this->setStyleSheet(QString(
"background-color:%1;").arg(QWidget::palette().color(QWidget::backgroundRole()).
name()));
94 : QFrame(parent), dir_only_(dir_only), load_only_(load_only)
97 setFrameShape(QFrame::StyledPanel);
98 setFrameShadow(QFrame::Raised);
103 QVBoxLayout* layout =
new QVBoxLayout(
this);
106 QHBoxLayout* hlayout =
new QHBoxLayout();
109 QLabel* widget_title =
new QLabel(
this);
110 widget_title->setText(title);
111 QFont widget_title_font(QFont().defaultFamily(), 12, QFont::Bold);
112 widget_title->setFont(widget_title_font);
113 layout->addWidget(widget_title);
114 layout->setAlignment(widget_title, Qt::AlignTop);
117 QLabel* widget_instructions =
new QLabel(
this);
118 widget_instructions->setText(instructions);
119 widget_instructions->setWordWrap(
true);
120 widget_instructions->setTextFormat(Qt::RichText);
121 layout->addWidget(widget_instructions);
122 layout->setAlignment(widget_instructions, Qt::AlignTop);
125 path_box_ =
new QLineEdit(
this);
126 connect(path_box_, SIGNAL(textChanged(QString)),
this, SIGNAL(
pathChanged(QString)));
128 hlayout->addWidget(path_box_);
131 QPushButton* browse_button =
new QPushButton(
this);
132 browse_button->setText(
"Browse");
133 connect(browse_button, SIGNAL(clicked()),
this, SLOT(btnFileDialog()));
134 hlayout->addWidget(browse_button);
137 layout->addLayout(hlayout);
145 void LoadPathWidget::btnFileDialog()
150 path = QFileDialog::getExistingDirectory(
this,
"Open Package Directory", path_box_->text(),
151 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
157 start_path = path_box_->text();
161 path = QFileDialog::getOpenFileName(
this,
"Open File", start_path,
"");
165 path = QFileDialog::getSaveFileName(
this,
"Create/Load File", start_path,
"");
171 path_box_->setText(path);
179 return path_box_->text();
195 path_box_->setText(path);
203 path_box_->setText(QString(path.c_str()));
207 const QString& arg_instructions, QWidget* parent,
const bool dir_only,
208 const bool load_only)
209 :
LoadPathWidget(title, instructions, parent, dir_only, load_only)
212 args_instructions_ =
new QLabel(arg_instructions,
this);
213 args_ =
new QLineEdit(
this);
215 layout()->addWidget(args_instructions_);
216 layout()->addWidget(args_);
221 return args_->text();
226 args_->setText(
args);
231 args_->setEnabled(enabled);