mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-16 14:34:46 -06:00
Fix saving
This commit is contained in:
parent
d28860bc58
commit
a03091d042
3
amd.cpp
3
amd.cpp
@ -199,10 +199,11 @@ QString amd::applySettings(int GPUIndex)
|
||||
{
|
||||
QSettings settings("tuxclocker");
|
||||
settings.beginGroup("General");
|
||||
settings.setValue("latestUUID", GPUList[GPUIndex].pci_id);
|
||||
//settings.setValue("latestUUID", GPUList[GPUIndex].pci_id);
|
||||
qDebug() << "read uiid " << settings.value("latestUUID").toString();
|
||||
QString currentProfile = settings.value("currentProfile").toString();
|
||||
settings.endGroup();
|
||||
settings.setValue("latestUUID", GPUList[GPUIndex].pci_id);
|
||||
settings.beginGroup(currentProfile);
|
||||
settings.beginGroup(GPUList[GPUIndex].pci_id);
|
||||
|
||||
|
@ -178,9 +178,7 @@ bool amdPstateEditor::applyValues()
|
||||
}
|
||||
// Save the values if it was successful
|
||||
QSettings settings("tuxclocker");
|
||||
settings.beginGroup("General");
|
||||
QString currentProfile = settings.value("currentProfile").toString();
|
||||
settings.endGroup();
|
||||
settings.beginGroup(currentProfile);
|
||||
settings.beginGroup(types->GPUList[gpuidx].pci_id);
|
||||
|
||||
|
@ -2,11 +2,13 @@
|
||||
#include "ui_editprofile.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
editProfile::editProfile(QWidget *parent) :
|
||||
editProfile::editProfile(QWidget *parent, int GPUIndex, gputypes *types) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::editProfile)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
GPUId = GPUIndex;
|
||||
type = types;
|
||||
|
||||
// Get the main widget backgorund palette and use the colors for the plots
|
||||
QPalette palette;
|
||||
@ -69,11 +71,24 @@ editProfile::editProfile(QWidget *parent) :
|
||||
connect(ui->curvePlot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(drawPointHoveredText(QMouseEvent*)));
|
||||
|
||||
// Load the existing points to the graph
|
||||
MainWindow mw;
|
||||
/*MainWindow mw;
|
||||
for (int i=0; i<mw.xCurvePoints.length(); i++) {
|
||||
qv_x.append(mw.xCurvePoints[i]);
|
||||
qv_y.append(mw.yCurvePoints[i]);
|
||||
}*/
|
||||
QSettings settings("tuxclocker");
|
||||
QString profile = settings.value("currentProfile").toString();
|
||||
QString UUID = settings.value("latestUUID").toString();
|
||||
settings.beginGroup(profile);
|
||||
settings.beginGroup(UUID);
|
||||
int size = settings.beginReadArray("curvepoints");
|
||||
for (int i=0; i<size; i++) {
|
||||
settings.setArrayIndex(i);
|
||||
qv_x.append(settings.value("xpoints").toInt());
|
||||
qv_y.append(settings.value("ypoints").toInt());
|
||||
}
|
||||
settings.endArray();
|
||||
|
||||
|
||||
ui->curvePlot->graph(0)->setData(qv_x, qv_y);
|
||||
drawFillerLines();
|
||||
@ -325,14 +340,10 @@ void editProfile::detectRelease(QMouseEvent *event)
|
||||
void editProfile::on_saveButton_clicked()
|
||||
{
|
||||
QSettings settings("tuxclocker");
|
||||
settings.beginGroup("General");
|
||||
QString currentProfile = settings.value("currentProfile").toString();
|
||||
QString latestUUID = settings.value("latestUUID").toString();
|
||||
//QString latestUUID = "4098-26649";
|
||||
qDebug() << "saving for uuid " << latestUUID;
|
||||
settings.endGroup();
|
||||
settings.setValue("latestUUID", type->GPUList[GPUId].pci_id);
|
||||
settings.beginGroup(currentProfile);
|
||||
settings.beginGroup(latestUUID);
|
||||
settings.beginGroup(type->GPUList[GPUId].pci_id);
|
||||
QString xString;
|
||||
QString yString;
|
||||
settings.beginWriteArray("curvepoints");
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
#include "qcustomplot.h"
|
||||
#include "gputypes.h"
|
||||
#include <QString>
|
||||
|
||||
namespace Ui {
|
||||
@ -15,7 +16,7 @@ class editProfile : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit editProfile(QWidget *parent = nullptr);
|
||||
explicit editProfile(QWidget *parent = nullptr, int GPUIndex = 0, gputypes *types = nullptr);
|
||||
~editProfile();
|
||||
QVector<double> qv_x, qv_y;
|
||||
QVector<int> cpoints_x, cpoints_y;
|
||||
@ -76,6 +77,8 @@ private:
|
||||
int ycoord;
|
||||
int index_x = 0;
|
||||
int index_y = 0;
|
||||
int GPUId = 0;
|
||||
gputypes *type;
|
||||
bool indicesSet = false;
|
||||
bool draggingPoint = false;
|
||||
QTimer *pressTimer = new QTimer(this);
|
||||
|
@ -76,7 +76,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
//setupMonitorTab();
|
||||
setupGraphMonitorTab();
|
||||
|
||||
|
||||
// Enable sliders according to GPU properties
|
||||
/*
|
||||
if (types->GPUList[currentGPUIndex].overClockAvailable) {
|
||||
@ -675,7 +674,7 @@ void MainWindow::checkForProfiles()
|
||||
}
|
||||
if (noProfiles) {
|
||||
settings.setValue("New Profile/isProfile", true);
|
||||
settings.setValue("General/currentProfile", "New Profile");
|
||||
settings.setValue("currentProfile", "New Profile");
|
||||
currentProfile = "New Profile";
|
||||
}
|
||||
// Redefine child groups so it contains the newly created profile if it was made
|
||||
@ -696,7 +695,7 @@ void MainWindow::on_profileComboBox_activated(const QString &arg1)
|
||||
if (currentProfile != arg1) {
|
||||
currentProfile = arg1;
|
||||
QSettings settings("tuxclocker");
|
||||
settings.setValue("General/currentProfile", currentProfile);
|
||||
settings.setValue("currentProfile", currentProfile);
|
||||
loadProfileSettings();
|
||||
}
|
||||
resettimer->stop();
|
||||
@ -891,8 +890,8 @@ void MainWindow::applyGPUSettings()
|
||||
void MainWindow::loadProfileSettings()
|
||||
{
|
||||
QSettings settings("tuxclocker");
|
||||
currentProfile = settings.value("General/currentProfile").toString();
|
||||
latestUUID = settings.value("General/latestUUID").toString();
|
||||
currentProfile = settings.value("currentProfile").toString();
|
||||
latestUUID = settings.value("latestUUID").toString();
|
||||
// Set the profile combo box selection to currentProfile
|
||||
for (int i=0; i<ui->profileComboBox->count(); i++) {
|
||||
if (ui->profileComboBox->itemText(i).contains(currentProfile)) {
|
||||
@ -989,7 +988,7 @@ void MainWindow::on_newProfile_closed()
|
||||
}
|
||||
}
|
||||
//settings.endGroup();
|
||||
settings.setValue("General/currentProfile", currentProfile);
|
||||
settings.setValue("currentProfile", currentProfile);
|
||||
ui->profileComboBox->clear();
|
||||
//ui->GPUComboBox->clear();
|
||||
checkForProfiles();
|
||||
@ -1103,20 +1102,21 @@ void MainWindow::enableFanUpdater()
|
||||
void MainWindow::on_applyButton_clicked()
|
||||
{
|
||||
resettimer->stop();
|
||||
applyGPUSettings();
|
||||
/*
|
||||
QSettings settings("tuxclocker");
|
||||
settings.beginGroup("General");
|
||||
QString prevProfile = settings.value("currentProfile").toString();
|
||||
settings.setValue("currentProfile", currentProfile);
|
||||
|
||||
applyGPUSettings();
|
||||
// Query the maximum offsets
|
||||
types->queryGPUCurrentMaxClocks(currentGPUIndex);
|
||||
curmaxmemclk->setText(1, QString::number(types->GPUList[currentGPUIndex].maxMemClk) + "MHz");
|
||||
curmaxclk->setText(1, QString::number(types->GPUList[currentGPUIndex].maxCoreClk) + "MHz");
|
||||
curmaxclk->setText(1, QString::number(types->GPUList[currentGPUIndex].maxCoreClk) + "MHz");*/
|
||||
}
|
||||
void MainWindow::on_editFanCurveButton_pressed()
|
||||
{
|
||||
editProfile *editProf = new editProfile(this);
|
||||
editProfile *editProf = new editProfile(this, currentGPUIndex, types);
|
||||
editProf->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(editProf, SIGNAL(destroyed(QObject*)), SLOT(on_editProfile_closed()));
|
||||
editProf->setModal(true);
|
||||
@ -1151,7 +1151,7 @@ void MainWindow::on_GPUComboBox_currentIndexChanged(int index)
|
||||
currentGPUIndex = index;
|
||||
// Change latest UUID and load settings for the GPU
|
||||
QSettings settings("tuxclocker");
|
||||
settings.setValue("General/latestUUID", types->GPUList[index].uuid);
|
||||
//settings.setValue("latestUUID", types->GPUList[index].uuid);
|
||||
// Call the NVML setup function so the index of the device struct is updated
|
||||
types->setupGPUSecondary(currentGPUIndex);
|
||||
types->queryGPUPowerLimitLimits(currentGPUIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user