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 @@
#include "qt4projectmanagerconstants.h"
#include "qt4target.h"
#include <utils/pathchooser.h>
#include <QtGui/QFileDialog>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QPushButton>
#include <QtGui/QTreeWidget>
using namespace Qt4ProjectManager::Internal;
......@@ -64,19 +64,11 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
m_treeWidget->setHeaderLabels(QStringList() << tr("Qt Version") << tr("Status") << tr("Directory"));
vbox->addWidget(m_treeWidget);
QHBoxLayout *hbox = new QHBoxLayout;
m_directoryLabel = new QLabel(this);
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);
m_addDirectoryButton = new QPushButton(tr("Add shadow build location"));
vbox->addWidget(m_addDirectoryButton);
connect(m_directoryChooser, SIGNAL(changed(QString)),
this, SLOT(importDirectoryAdded(QString)));
connect(m_addDirectoryButton, SIGNAL(clicked()),
this, SLOT(addShadowBuildLocation()));
}
TargetSetupPage::~TargetSetupPage()
......@@ -263,14 +255,13 @@ bool TargetSetupPage::isComplete() const
void TargetSetupPage::setImportDirectoryBrowsingEnabled(bool browsing)
{
m_directoryChooser->setEnabled(browsing);
m_directoryChooser->setVisible(browsing);
m_directoryLabel->setVisible(browsing);
m_addDirectoryButton->setEnabled(browsing);
m_addDirectoryButton->setVisible(browsing);
}
void TargetSetupPage::setImportDirectoryBrowsingLocation(const QString &directory)
{
m_directoryChooser->setInitialBrowsePathBackup(directory);
m_defaultShadowBuildLocation = directory;
}
void TargetSetupPage::setShowLocationInformation(bool location)
......@@ -383,15 +374,23 @@ TargetSetupPage::recursivelyCheckDirectoryForBuild(const QString &directory, con
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())
return;
m_directoryChooser->setPath(QString());
QList<ImportInfo> tmp = m_infos;
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);
}
......
......@@ -40,13 +40,10 @@
QT_BEGIN_NAMESPACE
class QLabel;
class QPushButton;
class QTreeWidget;
QT_END_NAMESPACE
namespace Utils {
class PathChooser;
}
namespace Qt4ProjectManager {
class Qt4Project;
......@@ -112,17 +109,17 @@ public:
private slots:
void itemWasChanged();
void importDirectoryAdded(const QString &);
void addShadowBuildLocation();
private:
void resetInfos();
QList<ImportInfo> m_infos;
QTreeWidget *m_treeWidget;
Utils::PathChooser *m_directoryChooser;
QLabel *m_directoryLabel;
QPushButton *m_addDirectoryButton;
bool m_preferMobile;
QString m_proFilePath;
QString m_defaultShadowBuildLocation;
};
} // 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