Files
OpenRGB/qt/OpenRGBDeviceInfoPage/OpenRGBDeviceInfoPage.cpp
Adam Honse a3b023d86c RGBController API Overhaul
* Reorganize and clean up RGBController API functions
    * Add functions to get protected RGBController member values
    * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
    * Protected previously-public RGBController members
        * Information strings (name, vendor, description, version, serial location)
        * Device type
        * Active mode
        * Flags
        * LEDs vector
        * LED alternate names vector
        * Modes vector
        * Colors vector
        * Zones vector
    * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
    * Add update reason codes to RGBController update callback and signal updates on more RGBController events
    * Add loop zone types and segmented zone type
    * Add matrix map field to segments
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
2026-01-11 13:10:40 -06:00

96 lines
2.7 KiB
C++

/*---------------------------------------------------------*\
| OpenRGBDeviceInfoPage.cpp |
| |
| User interface for OpenRGB device information page |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "OpenRGBDeviceInfoPage.h"
#include "ui_OpenRGBDeviceInfoPage.h"
OpenRGBDeviceInfoPage::OpenRGBDeviceInfoPage(RGBController *dev, QWidget *parent) :
QFrame(parent),
ui(new Ui::OpenRGBDeviceInfoPage)
{
controller = dev;
ui->setupUi(this);
ui->TypeValue->setText(device_type_to_str(dev->GetDeviceType()).c_str());
ui->NameValue->setText(QString::fromStdString(dev->GetName()));
ui->VendorValue->setText(QString::fromStdString(dev->GetVendor()));
ui->DescriptionValue->setText(QString::fromStdString(dev->GetDescription()));
ui->VersionValue->setText(QString::fromStdString(dev->GetVersion()));
ui->LocationValue->setText(QString::fromStdString(dev->GetLocation()));
ui->SerialValue->setText(QString::fromStdString(dev->GetSerial()));
unsigned int flags = dev->GetFlags();
std::string flags_string = "";
bool need_separator = false;
if(flags & CONTROLLER_FLAG_LOCAL)
{
flags_string += "Local";
need_separator = true;
}
if(flags & CONTROLLER_FLAG_REMOTE)
{
if(need_separator)
{
flags_string += ", ";
}
flags_string += "Remote";
need_separator = true;
}
if(flags & CONTROLLER_FLAG_VIRTUAL)
{
if(need_separator)
{
flags_string += ", ";
}
flags_string += "Virtual";
need_separator = true;
}
if(flags & CONTROLLER_FLAG_HIDDEN)
{
if(need_separator)
{
flags_string += ", ";
}
flags_string += "Hidden";
need_separator = true;
}
if(flags & CONTROLLER_FLAG_RESET_BEFORE_UPDATE)
{
if(need_separator)
{
flags_string += ", ";
}
flags_string += "Reset Before Update";
need_separator = true;
}
ui->FlagsValue->setText(QString::fromStdString(flags_string));
}
OpenRGBDeviceInfoPage::~OpenRGBDeviceInfoPage()
{
delete ui;
}
void OpenRGBDeviceInfoPage::changeEvent(QEvent *event)
{
if(event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this);
}
}
RGBController* OpenRGBDeviceInfoPage::GetController()
{
return controller;
}