Publish LumaOps source
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBProfileSaveDialog.cpp |
|
||||
| |
|
||||
| User interface entry for OpenRGB profile save dialog |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include "ResourceManager.h"
|
||||
#include "OpenRGBDialog.h"
|
||||
#include "ProfileManager.h"
|
||||
#include "OpenRGBProfileSaveDialog.h"
|
||||
#include "ui_OpenRGBProfileSaveDialog.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <QSettings>
|
||||
#endif
|
||||
|
||||
OpenRGBProfileSaveDialog::OpenRGBProfileSaveDialog(QWidget *parent) :
|
||||
QDialog(parent), ui(new Ui::OpenRGBProfileSaveDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
std::vector<std::string> filenames = ResourceManager::get()->GetProfileManager()->profile_list;
|
||||
|
||||
if(filenames.empty())
|
||||
{
|
||||
ui->list_profile->setVisible(false);
|
||||
ui->existing->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(const std::string& f: filenames)
|
||||
{
|
||||
ui->list_profile->addItem(QString::fromStdString(f));
|
||||
}
|
||||
|
||||
connect(ui->list_profile, &QListWidget::currentItemChanged, [=](){
|
||||
ui->lineEdit->setText(ui->list_profile->currentItem()->text());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
OpenRGBProfileSaveDialog::~OpenRGBProfileSaveDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OpenRGBProfileSaveDialog::changeEvent(QEvent *event)
|
||||
{
|
||||
if(event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
std::string OpenRGBProfileSaveDialog::show()
|
||||
{
|
||||
std::string return_string;
|
||||
|
||||
int result = this->exec();
|
||||
|
||||
if(result == QDialog::Rejected)
|
||||
{
|
||||
return_string = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return_string = ui->lineEdit->text().toStdString();
|
||||
}
|
||||
|
||||
return(return_string);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------*\
|
||||
| OpenRGBProfileSaveDialog.h |
|
||||
| |
|
||||
| User interface entry for OpenRGB profile save dialog |
|
||||
| |
|
||||
| This file is part of the OpenRGB project |
|
||||
| SPDX-License-Identifier: GPL-2.0-or-later |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "OpenRGBDialog.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class OpenRGBProfileSaveDialog;
|
||||
}
|
||||
|
||||
class OpenRGBProfileSaveDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OpenRGBProfileSaveDialog(QWidget *parent = nullptr);
|
||||
~OpenRGBProfileSaveDialog();
|
||||
|
||||
std::string show();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBProfileSaveDialog *ui;
|
||||
|
||||
private slots:
|
||||
void changeEvent(QEvent *event);
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenRGBProfileSaveDialog</class>
|
||||
<widget class="QDialog" name="OpenRGBProfileSaveDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>184</width>
|
||||
<height>186</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Profile Name</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="existing">
|
||||
<property name="text">
|
||||
<string>Save to an existing profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list_profile"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="new_2">
|
||||
<property name="text">
|
||||
<string>Create a new profile:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>OpenRGBProfileSaveDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>OpenRGBProfileSaveDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user