Files
OpenRGB/qt/OpenRGBSupportedDevicesPage.cpp
k1-801 8a88573443 Add settings page to enable and disable devices
Commits squashed and amended to read information only from settings manager by Adam Honse <calcprogrammer1@gmail.com>
2020-12-06 20:19:12 -06:00

50 lines
1.8 KiB
C++

#include "OpenRGBSupportedDevicesPage.h"
#include "ui_OpenRGBSupportedDevicesPage.h"
using namespace Ui;
OpenRGBSupportedDevicesPage::OpenRGBSupportedDevicesPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::OpenRGBSupportedDevicesPageUi)
{
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::on_SaveButton_clicked()
{
detectorTableModel->applySettings();
}
void OpenRGBSupportedDevicesPage::on_Filter_textChanged(const QString &arg1)
{
detectorSortModel->setFilterRegExp(QRegExp(arg1, Qt::CaseInsensitive));
}