Commit 520bd9ad authored by Tobias Hunger's avatar Tobias Hunger

TargetSetupPage: Simplify handling of import widget

Show the import widget if we have set a importer and hide it
otherwise.

Change-Id: Ia0a97d58a998478a9247767ace0dc6fab8ba92c2
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 1a03adf4
......@@ -136,13 +136,14 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
m_preferredMatcher(0),
m_importer(0),
m_baseLayout(0),
m_importSearch(false),
m_firstWidget(0),
m_ui(new TargetSetupPageUi),
m_importWidget(new Internal::ImportWidget(this)),
m_spacer(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)),
m_forceOptionHint(false)
{
m_importWidget->setVisible(false);
setObjectName(QLatin1String("TargetSetupPage"));
setWindowTitle(tr("Select Kits for Your Project"));
m_ui->setupUi(this);
......@@ -160,7 +161,6 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
m_ui->centralWidget->layout()->setMargin(0);
setUseScrollArea(true);
setImportSearch(false);
setTitle(tr("Kit Selection"));
......@@ -249,12 +249,6 @@ bool TargetSetupPage::isComplete() const
return false;
}
void TargetSetupPage::setImportSearch(bool b)
{
m_importSearch = b;
m_importWidget->setVisible(b);
}
void TargetSetupPage::setupWidgets()
{
QList<Kit *> kitList;
......@@ -312,6 +306,8 @@ void TargetSetupPage::setProjectImporter(ProjectImporter *importer)
delete m_importer;
m_importer = importer;
m_importWidget->setVisible(m_importer);
reset();
setupWidgets();
}
......@@ -330,7 +326,7 @@ void TargetSetupPage::showOptionsHint(bool show)
void TargetSetupPage::setupImports()
{
if (!m_importer || !m_importSearch || m_projectPath.isEmpty())
if (!m_importer || m_projectPath.isEmpty())
return;
QStringList toImport = m_importer->importCandidates(Utils::FileName::fromString(m_projectPath));
......
......@@ -70,7 +70,6 @@ public:
// Call these before initializePage!
void setRequiredKitMatcher(KitMatcher *matcher);
void setPreferredKitMatcher(KitMatcher *matcher);
void setImportSearch(bool b);
/// Sets whether the targetsetupage uses a scrollarea
/// to host the widgets from the factories
......@@ -113,7 +112,6 @@ private:
KitMatcher *m_preferredMatcher;
ProjectImporter *m_importer;
QLayout *m_baseLayout;
bool m_importSearch;
QString m_projectPath;
QString m_defaultShadowBuildLocation;
QMap<Core::Id, Internal::TargetSetupWidget *> m_widgets;
......
......@@ -97,7 +97,6 @@ TargetSetupPageWrapper::TargetSetupPageWrapper(Project *project) :
m_targetSetupPage = new TargetSetupPage(this);
m_targetSetupPage->setProjectImporter(project->createProjectImporter());
m_targetSetupPage->setUseScrollArea(false);
m_targetSetupPage->setImportSearch(true);
m_targetSetupPage->setProjectPath(project->projectFilePath());
m_targetSetupPage->setRequiredKitMatcher(project->createRequiredKitMatcher());
m_targetSetupPage->setPreferredKitMatcher(project->createPreferredKitMatcher());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment