diff options
Diffstat (limited to 'application/widgets')
-rw-r--r-- | application/widgets/InstanceCardWidget.ui | 61 | ||||
-rw-r--r-- | application/widgets/JavaSettingsWidget.cpp | 4 | ||||
-rw-r--r-- | application/widgets/PageContainer.cpp | 3 | ||||
-rw-r--r-- | application/widgets/PageContainer.h | 10 | ||||
-rw-r--r-- | application/widgets/VersionSelectWidget.cpp | 23 | ||||
-rw-r--r-- | application/widgets/VersionSelectWidget.h | 6 |
6 files changed, 90 insertions, 17 deletions
diff --git a/application/widgets/InstanceCardWidget.ui b/application/widgets/InstanceCardWidget.ui new file mode 100644 index 00000000..3ea3e85f --- /dev/null +++ b/application/widgets/InstanceCardWidget.ui @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>InstanceCardWidget</class> + <widget class="QWidget" name="InstanceCardWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>473</width> + <height>118</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" rowspan="2"> + <widget class="QToolButton" name="iconButton"> + <property name="iconSize"> + <size> + <width>80</width> + <height>80</height> + </size> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="nameLabel"> + <property name="text"> + <string>&Name:</string> + </property> + <property name="buddy"> + <cstring>instNameTextBox</cstring> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLineEdit" name="instNameTextBox"/> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="groupLabel"> + <property name="text"> + <string>&Group:</string> + </property> + <property name="buddy"> + <cstring>groupBox</cstring> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QComboBox" name="groupBox"> + <property name="editable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/application/widgets/JavaSettingsWidget.cpp b/application/widgets/JavaSettingsWidget.cpp index 13cd27e7..13fad72a 100644 --- a/application/widgets/JavaSettingsWidget.cpp +++ b/application/widgets/JavaSettingsWidget.cpp @@ -41,7 +41,7 @@ void JavaSettingsWidget::setupUi() m_verticalLayout = new QVBoxLayout(this); m_verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - m_versionWidget = new VersionSelectWidget(MMC->javalist().get(), this); + m_versionWidget = new VersionSelectWidget(this); m_versionWidget->setResizeOn(2); m_verticalLayout->addWidget(m_versionWidget); @@ -116,7 +116,7 @@ void JavaSettingsWidget::setupUi() void JavaSettingsWidget::initialize() { - m_versionWidget->initialize(); + m_versionWidget->initialize(MMC->javalist().get()); auto s = MMC->settings(); // Memory observedMinMemory = s->get("MinMemAlloc").toInt(); diff --git a/application/widgets/PageContainer.cpp b/application/widgets/PageContainer.cpp index 0f78329a..4dbd7fb2 100644 --- a/application/widgets/PageContainer.cpp +++ b/application/widgets/PageContainer.cpp @@ -53,7 +53,7 @@ protected: } }; -PageContainer::PageContainer(BasePageProviderPtr pageProvider, QString defaultId, +PageContainer::PageContainer(BasePageProvider *pageProvider, QString defaultId, QWidget *parent) : QWidget(parent) { @@ -158,6 +158,7 @@ void PageContainer::createUI() m_layout->addWidget(m_pageList, 0, 0, 2, 1); m_layout->addLayout(m_pageStack, 1, 1, 1, 1); m_layout->setColumnStretch(1, 4); + m_layout->setContentsMargins(0, 0, 0, 0); setLayout(m_layout); } diff --git a/application/widgets/PageContainer.h b/application/widgets/PageContainer.h index 96eac80a..ea9f8ce1 100644 --- a/application/widgets/PageContainer.h +++ b/application/widgets/PageContainer.h @@ -35,7 +35,7 @@ class PageContainer : public QWidget, public BasePageContainer { Q_OBJECT public: - explicit PageContainer(BasePageProviderPtr pageProvider, QString defaultId = QString(), + explicit PageContainer(BasePageProvider *pageProvider, QString defaultId = QString(), QWidget *parent = 0); virtual ~PageContainer() {} @@ -67,11 +67,13 @@ public: private: void createUI(); -private -slots: + +public slots: + void help(); + +private slots: void currentChanged(const QModelIndex ¤t); void showPage(int row); - void help(); private: BasePageContainer * m_container = nullptr; diff --git a/application/widgets/VersionSelectWidget.cpp b/application/widgets/VersionSelectWidget.cpp index 2a7cbfb7..ce1141b6 100644 --- a/application/widgets/VersionSelectWidget.cpp +++ b/application/widgets/VersionSelectWidget.cpp @@ -6,8 +6,8 @@ #include <VersionProxyModel.h> #include <dialogs/CustomMessageBox.h> -VersionSelectWidget::VersionSelectWidget(BaseVersionList* vlist, QWidget* parent) - : QWidget(parent), m_vlist(vlist) +VersionSelectWidget::VersionSelectWidget(QWidget* parent) + : QWidget(parent) { setObjectName(QStringLiteral("VersionSelectWidget")); verticalLayout = new QVBoxLayout(this); @@ -15,7 +15,6 @@ VersionSelectWidget::VersionSelectWidget(BaseVersionList* vlist, QWidget* parent verticalLayout->setContentsMargins(0, 0, 0, 0); m_proxyModel = new VersionProxyModel(this); - m_proxyModel->setSourceModel(vlist); listView = new VersionListView(this); listView->setObjectName(QStringLiteral("listView")); @@ -27,8 +26,6 @@ VersionSelectWidget::VersionSelectWidget(BaseVersionList* vlist, QWidget* parent listView->header()->setCascadingSectionResizes(true); listView->header()->setStretchLastSection(false); listView->setModel(m_proxyModel); - listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); verticalLayout->addWidget(listView); sneakyProgressBar = new QProgressBar(this); @@ -67,8 +64,13 @@ void VersionSelectWidget::setResizeOn(int column) listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); } -void VersionSelectWidget::initialize() +void VersionSelectWidget::initialize(BaseVersionList *vlist) { + m_vlist = vlist; + m_proxyModel->setSourceModel(vlist); + listView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + listView->header()->setSectionResizeMode(resizeOnColumn, QHeaderView::Stretch); + if (!m_vlist->isLoaded()) { loadList(); @@ -185,10 +187,15 @@ BaseVersionPtr VersionSelectWidget::selectedVersion() const void VersionSelectWidget::setExactFilter(BaseVersionList::ModelRoles role, QString filter) { - m_proxyModel->setFilter(role, filter, true); + m_proxyModel->setFilter(role, new ExactFilter(filter)); } void VersionSelectWidget::setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter) { - m_proxyModel->setFilter(role, filter, false); + m_proxyModel->setFilter(role, new ContainsFilter(filter)); +} + +void VersionSelectWidget::setFilter(BaseVersionList::ModelRoles role, Filter *filter) +{ + m_proxyModel->setFilter(role, filter); } diff --git a/application/widgets/VersionSelectWidget.h b/application/widgets/VersionSelectWidget.h index 3ea0b4f5..c134887f 100644 --- a/application/widgets/VersionSelectWidget.h +++ b/application/widgets/VersionSelectWidget.h @@ -23,16 +23,17 @@ class VersionProxyModel; class VersionListView; class QVBoxLayout; class QProgressBar; +class Filter; class VersionSelectWidget: public QWidget { Q_OBJECT public: - explicit VersionSelectWidget(BaseVersionList *vlist, QWidget *parent = 0); + explicit VersionSelectWidget(QWidget *parent = 0); ~VersionSelectWidget(); //! loads the list if needed. - void initialize(); + void initialize(BaseVersionList *vlist); //! Starts a task that loads the list. void loadList(); @@ -45,6 +46,7 @@ public: void setCurrentVersion(const QString & version); void setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter); void setExactFilter(BaseVersionList::ModelRoles role, QString filter); + void setFilter(BaseVersionList::ModelRoles role, Filter *filter); void setEmptyString(QString emptyString); void setEmptyErrorString(QString emptyErrorString); void setResizeOn(int column); |