Skip to content
Snippets Groups Projects
Commit 0e79aeed authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Rework targetsetuppage interface slightly

 * Remove PathChooser widget so that you need to use a proper dialog
   to select pathes. So typing into that PathChooser is no longer slow;-)

   The PathChooser does not provide a proper signal on when a user is done
   entering a directory, so it was not a good choice.

Tasknumber: QTCREATORBUG-1128
Reviewed-by: dt
parent 6186e130
No related branches found
No related tags found
No related merge requests found
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qt4target.h" #include "qt4target.h"
#include <utils/pathchooser.h> #include <QtGui/QFileDialog>
#include <QtGui/QHeaderView> #include <QtGui/QHeaderView>
#include <QtGui/QLabel> #include <QtGui/QLabel>
#include <QtGui/QLayout> #include <QtGui/QLayout>
#include <QtGui/QPushButton>
#include <QtGui/QTreeWidget> #include <QtGui/QTreeWidget>
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
...@@ -64,19 +64,11 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) : ...@@ -64,19 +64,11 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
m_treeWidget->setHeaderLabels(QStringList() << tr("Qt Version") << tr("Status") << tr("Directory")); m_treeWidget->setHeaderLabels(QStringList() << tr("Qt Version") << tr("Status") << tr("Directory"));
vbox->addWidget(m_treeWidget); vbox->addWidget(m_treeWidget);
QHBoxLayout *hbox = new QHBoxLayout; m_addDirectoryButton = new QPushButton(tr("Add shadow build location"));
m_directoryLabel = new QLabel(this); vbox->addWidget(m_addDirectoryButton);
m_directoryLabel->setText(tr("Scan for builds"));
hbox->addWidget(m_directoryLabel);
m_directoryChooser = new Utils::PathChooser(this);
m_directoryChooser->setPromptDialogTitle(tr("Directory to import builds from"));
m_directoryChooser->setExpectedKind(Utils::PathChooser::Directory);
hbox->addWidget(m_directoryChooser);
vbox->addLayout(hbox);
connect(m_directoryChooser, SIGNAL(changed(QString)), connect(m_addDirectoryButton, SIGNAL(clicked()),
this, SLOT(importDirectoryAdded(QString))); this, SLOT(addShadowBuildLocation()));
} }
TargetSetupPage::~TargetSetupPage() TargetSetupPage::~TargetSetupPage()
...@@ -263,14 +255,13 @@ bool TargetSetupPage::isComplete() const ...@@ -263,14 +255,13 @@ bool TargetSetupPage::isComplete() const
void TargetSetupPage::setImportDirectoryBrowsingEnabled(bool browsing) void TargetSetupPage::setImportDirectoryBrowsingEnabled(bool browsing)
{ {
m_directoryChooser->setEnabled(browsing); m_addDirectoryButton->setEnabled(browsing);
m_directoryChooser->setVisible(browsing); m_addDirectoryButton->setVisible(browsing);
m_directoryLabel->setVisible(browsing);
} }
void TargetSetupPage::setImportDirectoryBrowsingLocation(const QString &directory) void TargetSetupPage::setImportDirectoryBrowsingLocation(const QString &directory)
{ {
m_directoryChooser->setInitialBrowsePathBackup(directory); m_defaultShadowBuildLocation = directory;
} }
void TargetSetupPage::setShowLocationInformation(bool location) void TargetSetupPage::setShowLocationInformation(bool location)
...@@ -383,15 +374,23 @@ TargetSetupPage::recursivelyCheckDirectoryForBuild(const QString &directory, con ...@@ -383,15 +374,23 @@ TargetSetupPage::recursivelyCheckDirectoryForBuild(const QString &directory, con
return results; return results;
} }
void TargetSetupPage::importDirectoryAdded(const QString &directory) void TargetSetupPage::addShadowBuildLocation()
{ {
QFileInfo dir(directory); QString newPath =
QFileDialog::getExistingDirectory(this,
tr("Choose a directory to scan for additional shadow builds"),
m_defaultShadowBuildLocation);
if (newPath.isEmpty())
return;
QFileInfo dir(QDir::fromNativeSeparators(newPath));
if (!dir.exists() || !dir.isDir()) if (!dir.exists() || !dir.isDir())
return; return;
m_directoryChooser->setPath(QString());
QList<ImportInfo> tmp = m_infos; QList<ImportInfo> tmp = m_infos;
m_infos.clear(); // Clear m_infos without deleting temporary QtVersions! m_infos.clear(); // Clear m_infos without deleting temporary QtVersions!
tmp.append(recursivelyCheckDirectoryForBuild(directory, m_proFilePath)); tmp.append(recursivelyCheckDirectoryForBuild(dir.absoluteFilePath(), m_proFilePath));
setImportInfos(tmp); setImportInfos(tmp);
} }
......
...@@ -40,13 +40,10 @@ ...@@ -40,13 +40,10 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QLabel; class QLabel;
class QPushButton;
class QTreeWidget; class QTreeWidget;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils {
class PathChooser;
}
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
class Qt4Project; class Qt4Project;
...@@ -112,17 +109,17 @@ public: ...@@ -112,17 +109,17 @@ public:
private slots: private slots:
void itemWasChanged(); void itemWasChanged();
void importDirectoryAdded(const QString &); void addShadowBuildLocation();
private: private:
void resetInfos(); void resetInfos();
QList<ImportInfo> m_infos; QList<ImportInfo> m_infos;
QTreeWidget *m_treeWidget; QTreeWidget *m_treeWidget;
Utils::PathChooser *m_directoryChooser; QPushButton *m_addDirectoryButton;
QLabel *m_directoryLabel;
bool m_preferMobile; bool m_preferMobile;
QString m_proFilePath; QString m_proFilePath;
QString m_defaultShadowBuildLocation;
}; };
} // namespace Internal } // namespace Internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment