10 #include "../include/WorkspaceSwitch.h"
15 WorkspaceSwitch::WorkspaceSwitch(QWidget *parent) :
21 void WorkspaceSwitch::init()
23 QGridLayout *layout =
new QGridLayout(
this);
24 layout->addWidget(
new QLabel(tr(
"Choose the workspace "
25 "path for this session"),
this));
26 wsPath =
new QLineEdit(
this);
27 wsPath->setEnabled(
false);
28 layout->addWidget(wsPath,1,0);
29 openDir =
new QPushButton(tr(
"Choose Directory"),
this);
30 connect(openDir,SIGNAL(clicked()),SLOT(openDirectory()));
31 layout->addWidget(openDir,1,1);
32 QFrame *line =
new QFrame(
this);
33 line->setFrameShape(QFrame::HLine);
34 line->setFrameShadow(QFrame::Sunken);
35 layout->addWidget(line,4,0,1,2);
37 bOk =
new QPushButton(tr(
"OK"),
this);
38 connect(bOk,SIGNAL(clicked()),SLOT(accept()));
39 bCancel =
new QPushButton(tr(
"Cancel"),
this);
40 connect(bCancel,SIGNAL(clicked()),SLOT(reject()));
42 QHBoxLayout *bL =
new QHBoxLayout;
43 bL->addWidget(bCancel);
45 layout->addLayout(bL,5,1);
49 void WorkspaceSwitch::openDirectory()
51 QFileDialog::Options options = QFileDialog::ShowDirsOnly;
52 QDir *dir =
new QDir(QDir::homePath());
53 QString directoryURI = QFileDialog::getExistingDirectory(
this,
54 tr(
"Select the target directory"),
57 wsPath->setText(directoryURI);