Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBSupportedDevicePage.cpp |
|
||||
| |
|
||||
| User interface for enabling and disabling devices |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "OpenRGBSupportedDevicesPage.h"
|
||||
#include "ui_OpenRGBSupportedDevicesPage.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "OpenRGBHardwareIDsDialog.h"
|
||||
|
||||
OpenRGBSupportedDevicesPage::OpenRGBSupportedDevicesPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::OpenRGBSupportedDevicesPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Create a detector table model and a sort model and |
|
||||
| set them |
|
||||
\*-----------------------------------------------------*/
|
||||
detectorTableModel = new DetectorTableModel;
|
||||
detectorSortModel = new QSortFilterProxyModel;
|
||||
|
||||
detectorSortModel->setSourceModel(detectorTableModel);
|
||||
ui->SupportedDevicesTable->setModel(detectorSortModel);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Disable header, enable sorting, and sort in ascending |
|
||||
| order |
|
||||
\*-----------------------------------------------------*/
|
||||
ui->SupportedDevicesTable->verticalHeader()->setVisible(0);
|
||||
ui->SupportedDevicesTable->setSortingEnabled(true);
|
||||
ui->SupportedDevicesTable->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Resize columns to fit the contents |
|
||||
\*-----------------------------------------------------*/
|
||||
ui->SupportedDevicesTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
|
||||
}
|
||||
|
||||
OpenRGBSupportedDevicesPage::~OpenRGBSupportedDevicesPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBSupportedDevicesPage::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenRGBSupportedDevicesPage::on_SaveButton_clicked()
|
||||
{
|
||||
detectorTableModel->applySettings();
|
||||
}
|
||||
|
||||
void OpenRGBSupportedDevicesPage::on_GetHardwareIDsButton_clicked()
|
||||
{
|
||||
OpenRGBHardwareIDsDialog dialog(this);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
void OpenRGBSupportedDevicesPage::on_Filter_textChanged(const QString &arg1)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
detectorSortModel->setFilterRegularExpression(QRegularExpression(arg1 , QRegularExpression::CaseInsensitiveOption));
|
||||
#else
|
||||
detectorSortModel->setFilterRegExp(QRegExp(arg1, Qt::CaseInsensitive));
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenRGBSupportedDevicesPage::on_ToggleAllCheckbox_toggled(const bool checked)
|
||||
{
|
||||
detectorTableModel->toggleAll(checked, detectorSortModel);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBSupportedDevicePage.h |
|
||||
| |
|
||||
| User interface for enabling and disabling devices |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "DetectorTableModel.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBSupportedDevicesPage;
|
||||
}
|
||||
|
||||
class OpenRGBSupportedDevicesPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBSupportedDevicesPage(QWidget *parent = nullptr);
|
||||
~OpenRGBSupportedDevicesPage();
|
||||
DetectorTableModel* detectorTableModel;
|
||||
QSortFilterProxyModel* detectorSortModel;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
void on_SaveButton_clicked();
|
||||
void on_GetHardwareIDsButton_clicked();
|
||||
|
||||
void on_Filter_textChanged(const QString &arg1);
|
||||
|
||||
void on_ToggleAllCheckbox_toggled(const bool checked);
|
||||
|
||||
private:
|
||||
Ui::OpenRGBSupportedDevicesPage *ui;
|
||||
};
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBSupportedDevicesPage</class>
|
||||
<widget class="QWidget" name="OpenRGBSupportedDevicesPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Supported Devices Page</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Filter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="Filter"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="ToggleAllCheckbox">
|
||||
<property name="text">
|
||||
<string>Enable/Disable all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="SupportedDevicesTable"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="ButtonsLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="SaveButton">
|
||||
<property name="text">
|
||||
<string>Apply Changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="GetHardwareIDsButton">
|
||||
<property name="text">
|
||||
<string>Get Hardware IDs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user