try adding pstate editor

This commit is contained in:
jussi 2019-02-18 21:06:25 +02:00
parent bb631e6952
commit 09ca6b3c9f
7 changed files with 150 additions and 2 deletions

75
amdpstateeditor.cpp Normal file
View File

@ -0,0 +1,75 @@
#include "amdpstateeditor.h"
#include "ui_amdpstateeditor.h"
amdPstateEditor::amdPstateEditor(QWidget *parent) :
QDialog(parent),
ui(new Ui::amdPstateEditor)
{
ui->setupUi(this);
}
amdPstateEditor::~amdPstateEditor()
{
delete ui;
}
void amdPstateEditor::generateUI(gputypes *types)
{
QWidget *lower = new QWidget;
QWidget *upper = new QWidget;
QHBoxLayout *ulo = new QHBoxLayout;
QHBoxLayout *llo = new QHBoxLayout;
for (int i=0; i<types->GPUList[0].corecloks.size(); i++) {
QGridLayout *glo = new QGridLayout;
QLabel *lb = new QLabel;
QLabel *lb1 = new QLabel;
QLabel *lb2 = new QLabel;
lb->setText("mV");
lb1->setText("MHz");
lb2->setText("Core pstate "+QString::number(i));
QSlider *sl = new QSlider;
QSlider *sl1 = new QSlider;
QSpinBox *sp = new QSpinBox;
QSpinBox *sp1 = new QSpinBox;
glo->addWidget(lb2);
glo->addWidget(lb1, 1, 0);
glo->addWidget(lb, 1, 1);
glo->addWidget(sl, 2, 0);
glo->addWidget(sl1, 2, 1);
glo->addWidget(sp, 3, 0);
glo->addWidget(sp1, 3, 1);
QWidget *slowdg = new QWidget;
slowdg->setLayout(glo);
llo->addWidget(slowdg);
}
for (int i=0; i<types->GPUList[0].memclocks.size(); i++) {
QGridLayout *glo = new QGridLayout;
QLabel *lb = new QLabel;
QLabel *lb1 = new QLabel;
QLabel *lb2 = new QLabel;
lb->setText("mV");
lb1->setText("MHz");
lb2->setText("Memory pstate "+QString::number(i));
QSlider *sl = new QSlider;
QSlider *sl1 = new QSlider;
QSpinBox *sp = new QSpinBox;
QSpinBox *sp1 = new QSpinBox;
glo->addWidget(lb2);
glo->addWidget(lb1, 1, 0);
glo->addWidget(lb, 1, 1);
glo->addWidget(sl, 2, 0);
glo->addWidget(sl1, 2, 1);
glo->addWidget(sp, 3, 0);
glo->addWidget(sp1, 3, 1);
QWidget *slowdg = new QWidget;
slowdg->setLayout(glo);
ulo->addWidget(slowdg);
}
lower->setLayout(ulo);
upper->setLayout(llo);
QVBoxLayout *mainlo = new QVBoxLayout(this);
mainlo->addWidget(upper);
mainlo->addWidget(lower);
ui->centralWidget->setLayout(mainlo);
}

29
amdpstateeditor.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef AMDPSTATEEDITOR_H
#define AMDPSTATEEDITOR_H
#include <QDialog>
#include <QWidget>
#include "gputypes.h"
#include <QLabel>
#include <QSlider>
#include <QSpinBox>
#include <QLayout>
namespace Ui {
class amdPstateEditor;
}
class amdPstateEditor : public QDialog
{
Q_OBJECT
public:
explicit amdPstateEditor(QWidget *parent = nullptr);
~amdPstateEditor();
void generateUI(gputypes *types);
private:
Ui::amdPstateEditor *ui;
};
#endif // AMDPSTATEEDITOR_H

24
amdpstateeditor.ui Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>amdPstateEditor</class>
<widget class="QDialog" name="amdPstateEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>428</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="centralWidget" native="true"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -4,6 +4,7 @@
#include "ui_editprofile.h"
#include "newprofile.h"
#include "plotwidget.h"
#include "amdpstateeditor.h"
#ifdef NVIDIA
#include <NVCtrl/NVCtrl.h>
#endif
@ -1102,3 +1103,10 @@ void MainWindow::on_GPUComboBox_currentIndexChanged(int index)
curmaxmemclk->setText(1, QString::number(types->GPUList[index].maxMemClk) + "MHz");
curmaxclk->setText(1, QString::number(types->GPUList[index].maxCoreClk) + "MHz");
}
void MainWindow::on_pstateButton_clicked()
{
amdPstateEditor *ps = new amdPstateEditor;
ps->generateUI(types);
ps->exec();
}

View File

@ -149,6 +149,8 @@ private slots:
void on_GPUComboBox_currentIndexChanged(int index);
void on_pstateButton_clicked();
private:
Ui::MainWindow *ui;
bool noProfiles = true;

View File

@ -173,6 +173,13 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="pstateButton">
<property name="text">
<string>Edit Pstates</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="monitorTab">

View File

@ -39,7 +39,8 @@ SOURCES += \
plotwidget.cpp \
nvidia.cpp \
gputypes.cpp \
amd.cpp
amd.cpp \
amdpstateeditor.cpp
HEADERS += \
mainwindow.h \
@ -51,11 +52,13 @@ HEADERS += \
nvml.h \
gputypes.h \
#xlibvars.h
amdpstateeditor.h
FORMS += \
mainwindow.ui \
editprofile.ui \
newprofile.ui
newprofile.ui \
amdpstateeditor.ui
INCLUDEPATH += "/usr/lib"
INCLUDEPATH += $$(INCLUDEPATH)