forked from qt-creator/qt-creator
MiniProjectTargetSelector: Move internal classes out of header file
Preparation for upcoming refactoring. Change-Id: Id3fcafa776efd3de02bc5b08234e8b37cf5fe417 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -60,6 +60,11 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
|
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
static QIcon createCenteredIcon(const QIcon &icon, const QIcon &overlay)
|
static QIcon createCenteredIcon(const QIcon &icon, const QIcon &overlay)
|
||||||
{
|
{
|
||||||
QPixmap targetPixmap;
|
QPixmap targetPixmap;
|
||||||
@@ -84,10 +89,6 @@ static QIcon createCenteredIcon(const QIcon &icon, const QIcon &overlay)
|
|||||||
return QIcon(targetPixmap);
|
return QIcon(targetPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
using namespace ProjectExplorer::Internal;
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
static bool projectLesserThan(Project *p1, Project *p2)
|
static bool projectLesserThan(Project *p1, Project *p2)
|
||||||
{
|
{
|
||||||
int result = caseFriendlyCompare(p1->displayName(), p2->displayName());
|
int result = caseFriendlyCompare(p1->displayName(), p2->displayName());
|
||||||
@@ -117,6 +118,89 @@ static QString toolTipFor(QObject *object)
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper classes
|
||||||
|
class ListWidget : public QListWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ListWidget(QWidget *parent);
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
void keyReleaseEvent(QKeyEvent *event) override;
|
||||||
|
void setMaxCount(int maxCount);
|
||||||
|
int maxCount();
|
||||||
|
|
||||||
|
int optimalWidth() const;
|
||||||
|
void setOptimalWidth(int width);
|
||||||
|
|
||||||
|
int padding();
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_maxCount = 0;
|
||||||
|
int m_optimalWidth = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ProjectListWidget : public ListWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ProjectListWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void addProject(ProjectExplorer::Project *project);
|
||||||
|
void removeProject(ProjectExplorer::Project *project);
|
||||||
|
void projectDisplayNameChanged(ProjectExplorer::Project *project);
|
||||||
|
void changeStartupProject(ProjectExplorer::Project *project);
|
||||||
|
void setProject(int index);
|
||||||
|
QListWidgetItem *itemForProject(Project *project);
|
||||||
|
QString fullName(Project *project);
|
||||||
|
bool m_ignoreIndexChange;
|
||||||
|
};
|
||||||
|
|
||||||
|
class KitAreaWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit KitAreaWidget(QWidget *parent = nullptr);
|
||||||
|
~KitAreaWidget() override;
|
||||||
|
|
||||||
|
void setKit(ProjectExplorer::Kit *k);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateKit(ProjectExplorer::Kit *k);
|
||||||
|
|
||||||
|
QGridLayout *m_layout;
|
||||||
|
Kit *m_kit = nullptr;
|
||||||
|
QList<KitAspectWidget *> m_widgets;
|
||||||
|
QList<QLabel *> m_labels;
|
||||||
|
};
|
||||||
|
|
||||||
|
class GenericListWidget : public ListWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit GenericListWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void changeActiveProjectConfiguration(QObject *dc);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void setProjectConfigurations(const QList<QObject *> &list, QObject *active);
|
||||||
|
void setActiveProjectConfiguration(QObject *active);
|
||||||
|
void addProjectConfiguration(QObject *pc);
|
||||||
|
void removeProjectConfiguration(QObject *pc);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QObject *objectAt(int row) const;
|
||||||
|
|
||||||
|
void rowChanged(int index);
|
||||||
|
void displayNameChanged();
|
||||||
|
void toolTipChanged();
|
||||||
|
QListWidgetItem *itemForProjectConfiguration(QObject *pc);
|
||||||
|
bool m_ignoreIndexChange;
|
||||||
|
};
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// TargetSelectorDelegate
|
// TargetSelectorDelegate
|
||||||
@@ -1648,3 +1732,8 @@ void MiniProjectTargetSelector::switchToProjectsMode()
|
|||||||
Core::ModeManager::activateMode(Constants::MODE_SESSION);
|
Core::ModeManager::activateMode(Constants::MODE_SESSION);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
|
#include <miniprojecttargetselector.moc>
|
||||||
|
|||||||
@@ -25,19 +25,15 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QComboBox;
|
|
||||||
class QGridLayout;
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QStackedWidget;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Kit;
|
class Kit;
|
||||||
class KitAspectWidget;
|
|
||||||
class Project;
|
class Project;
|
||||||
class Target;
|
class Target;
|
||||||
class BuildConfiguration;
|
class BuildConfiguration;
|
||||||
@@ -46,92 +42,10 @@ class ProjectConfiguration;
|
|||||||
class RunConfiguration;
|
class RunConfiguration;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
class ProjectListWidget;
|
||||||
|
class KitAreaWidget;
|
||||||
|
class GenericListWidget;
|
||||||
|
|
||||||
// helper classes
|
|
||||||
class ListWidget : public QListWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ListWidget(QWidget *parent);
|
|
||||||
void keyPressEvent(QKeyEvent *event) override;
|
|
||||||
void keyReleaseEvent(QKeyEvent *event) override;
|
|
||||||
void setMaxCount(int maxCount);
|
|
||||||
int maxCount();
|
|
||||||
|
|
||||||
int optimalWidth() const;
|
|
||||||
void setOptimalWidth(int width);
|
|
||||||
|
|
||||||
int padding();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_maxCount = 0;
|
|
||||||
int m_optimalWidth = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ProjectListWidget : public ListWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit ProjectListWidget(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void addProject(ProjectExplorer::Project *project);
|
|
||||||
void removeProject(ProjectExplorer::Project *project);
|
|
||||||
void projectDisplayNameChanged(ProjectExplorer::Project *project);
|
|
||||||
void changeStartupProject(ProjectExplorer::Project *project);
|
|
||||||
void setProject(int index);
|
|
||||||
QListWidgetItem *itemForProject(Project *project);
|
|
||||||
QString fullName(Project *project);
|
|
||||||
bool m_ignoreIndexChange;
|
|
||||||
};
|
|
||||||
|
|
||||||
class KitAreaWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit KitAreaWidget(QWidget *parent = nullptr);
|
|
||||||
~KitAreaWidget() override;
|
|
||||||
|
|
||||||
void setKit(ProjectExplorer::Kit *k);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateKit(ProjectExplorer::Kit *k);
|
|
||||||
|
|
||||||
QGridLayout *m_layout;
|
|
||||||
Kit *m_kit = nullptr;
|
|
||||||
QList<KitAspectWidget *> m_widgets;
|
|
||||||
QList<QLabel *> m_labels;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GenericListWidget : public ListWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit GenericListWidget(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void changeActiveProjectConfiguration(QObject *dc);
|
|
||||||
|
|
||||||
public:
|
|
||||||
void setProjectConfigurations(const QList<QObject *> &list, QObject *active);
|
|
||||||
void setActiveProjectConfiguration(QObject *active);
|
|
||||||
void addProjectConfiguration(QObject *pc);
|
|
||||||
void removeProjectConfiguration(QObject *pc);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QObject *objectAt(int row) const;
|
|
||||||
|
|
||||||
void rowChanged(int index);
|
|
||||||
void displayNameChanged();
|
|
||||||
void toolTipChanged();
|
|
||||||
QListWidgetItem *itemForProjectConfiguration(QObject *pc);
|
|
||||||
bool m_ignoreIndexChange;
|
|
||||||
};
|
|
||||||
|
|
||||||
// main class
|
|
||||||
class MiniProjectTargetSelector : public QWidget
|
class MiniProjectTargetSelector : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
Reference in New Issue
Block a user