mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-24 09:10:16 -06:00
more stuff
This commit is contained in:
parent
ba3d2964b4
commit
45ac973040
@ -44,6 +44,14 @@ editProfile::editProfile(QWidget *parent) :
|
||||
connect(ui->curvePlot, SIGNAL(mouseRelease(QMouseEvent*)), SLOT(detectRelease(QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(getYcoordValue(QMouseEvent*)));
|
||||
|
||||
// Load the existing points to the graph
|
||||
MainWindow mw;
|
||||
for (int i=0; i<mw.xCurvePoints.length(); i++) {
|
||||
qv_x.append(mw.xCurvePoints[i]);
|
||||
qv_y.append(mw.yCurvePoints[i]);
|
||||
}
|
||||
ui->curvePlot->graph(0)->setData(qv_x, qv_y);
|
||||
drawFillerLines();
|
||||
|
||||
}
|
||||
|
||||
@ -56,7 +64,9 @@ void editProfile::addPoint(double x, double y)
|
||||
{
|
||||
y = round(y);
|
||||
x = round(x);
|
||||
if (qv_x.length() != 0) {
|
||||
checkForDuplicatePoint(x, y);
|
||||
}
|
||||
if ((x_lower<=x) && (x<=x_upper) && (y_lower<=y) && (y<=y_upper) && !duplicatePoint) {
|
||||
qv_x.append(x);
|
||||
qv_y.append(y);
|
||||
@ -79,11 +89,9 @@ void editProfile::clickedGraph(QMouseEvent *event)
|
||||
void editProfile::clickedPoint(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event)
|
||||
{
|
||||
checkForNearbyPoints(event);
|
||||
//double ycoord = ui->curvePlot->graph(0)->dataMainValue(dataIndex);
|
||||
//double xcoord = ui->curvePlot->graph(0)->dataSortKey(dataIndex);
|
||||
ycoord = round(ycoord);
|
||||
xcoord = round(xcoord);
|
||||
if (isNearbyPoint) {
|
||||
if (isNearbyPoint && qv_x.length() != 0) {
|
||||
for (int i=0; i<qv_y.length(); i++ ) {
|
||||
qv_y[i] = round(qv_y[i]);
|
||||
qv_x[i] = round(qv_x[i]);
|
||||
@ -102,6 +110,7 @@ void editProfile::clickedPoint(QCPAbstractPlottable *plottable, int dataIndex, Q
|
||||
|
||||
bool editProfile::checkForNearbyPoints(QMouseEvent *event)
|
||||
{
|
||||
if (qv_x.length() != 0) {
|
||||
QPoint point = event->pos();
|
||||
double pointerxcoord = ui->curvePlot->xAxis->pixelToCoord(point.x());
|
||||
double pointerycoord = ui->curvePlot->yAxis->pixelToCoord(point.y());
|
||||
@ -115,6 +124,7 @@ bool editProfile::checkForNearbyPoints(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
return isNearbyPoint;
|
||||
}
|
||||
}
|
||||
|
||||
int editProfile::getDataIndex(QCPAbstractPlottable *plottable, int dataIndex)
|
||||
@ -145,6 +155,7 @@ int editProfile::getXcoordValue(int xcoord)
|
||||
|
||||
int editProfile::getYcoordValue(QMouseEvent *event)
|
||||
{
|
||||
if (qv_x.length() != 0) {
|
||||
//Gets the indices of points that match the current cursor location
|
||||
QPoint point = event->pos();
|
||||
double pointerycoord = ui->curvePlot->yAxis->pixelToCoord(point.y());
|
||||
@ -156,6 +167,7 @@ int editProfile::getYcoordValue(QMouseEvent *event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
getXcoordValue(xcoord);
|
||||
return ycoord;
|
||||
}
|
||||
@ -218,7 +230,7 @@ void editProfile::dragPoint(int index_x, int index_y, QMouseEvent* event)
|
||||
// Sleep here so we don't take up so much CPU time
|
||||
QThread::msleep(10);
|
||||
ui->curvePlot->clearItems();
|
||||
drawCoordtext(index_x, index_y);
|
||||
drawCoordtext();
|
||||
QPoint point = event->pos();
|
||||
qv_y[index_y] = round(ui->curvePlot->yAxis->pixelToCoord(point.y()));
|
||||
qv_x[index_x] = round(ui->curvePlot->xAxis->pixelToCoord(point.x()));
|
||||
@ -240,7 +252,7 @@ void editProfile::dragPoint(int index_x, int index_y, QMouseEvent* event)
|
||||
drawFillerLines();
|
||||
}
|
||||
|
||||
void editProfile::drawCoordtext(int index_x, int index_y)
|
||||
void editProfile::drawCoordtext()
|
||||
{
|
||||
QCPItemText *coordText = new QCPItemText(ui->curvePlot);
|
||||
if (draggingPoint) {
|
||||
@ -263,8 +275,10 @@ void editProfile::drawCoordtext(int index_x, int index_y)
|
||||
coordText->setText(xString + ", " + yString);
|
||||
}
|
||||
|
||||
if (!mouseDragging) {
|
||||
if (!draggingPoint) {
|
||||
ui->curvePlot->clearItems();
|
||||
coordText->position->setCoords(100, 100);
|
||||
coordText->setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,7 +309,7 @@ bool editProfile::detectRelease(QMouseEvent *event)
|
||||
resetMouseDragging();
|
||||
draggedIndicesUnset();
|
||||
draggingPointUnset();
|
||||
drawCoordtext(index_x, index_y);
|
||||
//drawCoordtext(index_x, index_y);
|
||||
return mousePressed;
|
||||
}
|
||||
|
||||
@ -343,58 +357,12 @@ double editProfile::getPixelLength(QMouseEvent *event)
|
||||
|
||||
void editProfile::on_pushButton_clicked()
|
||||
{
|
||||
MainWindow mw;
|
||||
ui->curvePlot->clearItems();
|
||||
qDebug() << mw.voltInt;
|
||||
qDebug() << index_x << index_y;
|
||||
}
|
||||
|
||||
void editProfile::on_saveButton_clicked()
|
||||
{
|
||||
|
||||
/*QFile file("C:/Users/Gnometech/Documents/rojekti/test.xml");
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
|
||||
document.setContent(&file);
|
||||
file.close();
|
||||
// Remove existing xpoints and ypoints attributes
|
||||
QDomElement root = document.firstChildElement();
|
||||
QDomNodeList ypoints =root.elementsByTagName("ypoints");
|
||||
QDomNode ypntnode = ypoints.item(0);
|
||||
QDomNodeList xpoints =root.elementsByTagName("xpoints");
|
||||
QDomNode xpntnode = xpoints.item(0);
|
||||
|
||||
QString xString;
|
||||
QString yString;
|
||||
// Add the curve points to strings
|
||||
for (int i=0; i<qv_x.length(); i++) {
|
||||
QString x = QString::number(ui->curvePlot->graph(0)->dataSortKey(i));
|
||||
QString y = QString::number(ui->curvePlot->graph(0)->dataMainValue(i));
|
||||
xString.append(x + ", ");
|
||||
yString.append(y + ", ");
|
||||
|
||||
if (ypntnode.isElement()) {
|
||||
QDomElement elem = ypntnode.toElement();
|
||||
if (elem.hasAttribute("ypoints")) {
|
||||
elem.removeAttribute("ypoints");
|
||||
elem.setAttribute("ypoints", yString);
|
||||
}
|
||||
}
|
||||
|
||||
if (xpntnode.isElement()) {
|
||||
QDomElement elem = xpntnode.toElement();
|
||||
elem.removeAttribute("xpoints");
|
||||
elem.setAttribute("xpoints", xString);
|
||||
}
|
||||
}
|
||||
|
||||
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream stream(&file);
|
||||
stream << document.toString();
|
||||
file.close();
|
||||
qDebug() << "valmis";
|
||||
}
|
||||
} */
|
||||
|
||||
QString xString;
|
||||
QString yString;
|
||||
for (int i=0; i<qv_x.length(); i++) {
|
||||
@ -404,13 +372,17 @@ void editProfile::on_saveButton_clicked()
|
||||
yString.append(y + ", ");
|
||||
|
||||
}
|
||||
MainWindow mw;
|
||||
QVariant xarray = xString;
|
||||
QVariant yarray = yString;
|
||||
qDebug() << xarray.toString() << yarray.toString();
|
||||
QSettings settings("nvfancurve");
|
||||
|
||||
settings.setValue("profile/curveXpoints", xarray);
|
||||
settings.setValue("profile/curveYpoints", yarray);
|
||||
QString xsetting = mw.currentProfile;
|
||||
QString ysetting = mw.currentProfile;
|
||||
ysetting.append("/ypoints");
|
||||
xsetting.append("/xpoints");
|
||||
settings.setValue(xsetting, xarray);
|
||||
settings.setValue(ysetting, yarray);
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ public:
|
||||
QVector<double> qv_x, qv_y;
|
||||
QVector<int> cpoints_x, cpoints_y;
|
||||
|
||||
|
||||
signals:
|
||||
void on_clickedPoint(QMouseEvent *event);
|
||||
void on_dragPoint(bool);
|
||||
@ -39,7 +38,8 @@ private slots:
|
||||
void clickedPoint(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
|
||||
//void getDataPoints();
|
||||
void on_saveButton_clicked();
|
||||
void drawCoordtext(int index_x, int index_y);
|
||||
void drawCoordtext();
|
||||
|
||||
double getPixelLength(QMouseEvent *event);
|
||||
bool initializeDragging(QMouseEvent *event);
|
||||
bool detectMove(QMouseEvent *event);
|
||||
|
@ -17,7 +17,7 @@
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QCustomPlot" name="curvePlot" native="true">
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>This graph defines the relation of fan speed to the GPU temperature.</p><p>To add a point, double click on the area.</p><p>To remove a point, click on it,</p><p>To move a point, drag it.</p></body></html></string>
|
||||
<string><html><head/><body><p>This graph defines the relation of fan speed to the GPU temperature.</p><p>To add a point, double click on the area.</p><p>To remove a point, click on it.</p><p>To move a point, drag it.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
389
mainwindow.cpp
389
mainwindow.cpp
@ -2,6 +2,7 @@
|
||||
#include "ui_mainwindow.h"
|
||||
#include "editprofile.h"
|
||||
#include "ui_editprofile.h"
|
||||
#include "newprofile.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@ -9,9 +10,39 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
checkForProfiles();
|
||||
loadProfileSettings();
|
||||
queryGPUSettings();
|
||||
enableFanControl();
|
||||
|
||||
ui->frequencySlider->setRange(-100, 1000);
|
||||
ui->frequencySpinBox->setRange(-100, 1000);
|
||||
ui->frequencySlider->setRange(defCoreClk + minCoreClkOfsInt, defCoreClk + maxCoreClkOfsInt);
|
||||
ui->frequencySpinBox->setRange(defCoreClk + minCoreClkOfsInt, defCoreClk + maxCoreClkOfsInt);
|
||||
ui->frequencySlider->setValue(defCoreClk + coreFreqOfsInt);
|
||||
ui->frequencySpinBox->setValue(defCoreClk + coreFreqOfsInt);
|
||||
|
||||
ui->powerLimSlider->setRange(minPowerLimInt, maxPowerLimInt);
|
||||
ui->powerLimSpinBox->setRange(minPowerLimInt, maxPowerLimInt);
|
||||
ui->powerLimSlider->setValue(curPowerLimInt);
|
||||
ui->powerLimSpinBox->setValue(curPowerLimInt);
|
||||
|
||||
ui->memClkSlider->setRange(defMemClk + minMemClkOfsInt, defMemClk + maxMemClkOfsInt);
|
||||
ui->memClkSpinBox->setRange(defMemClk + minMemClkOfsInt, defMemClk + maxMemClkOfsInt);
|
||||
ui->memClkSlider->setValue(curMaxMemClkInt);
|
||||
ui->memClkSpinBox->setValue(curMaxMemClkInt);
|
||||
|
||||
ui->voltageSlider->setRange(voltInt + minVoltOfsInt, voltInt + maxVoltOfsInt);
|
||||
ui->voltageSpinBox->setRange(voltInt + minVoltOfsInt, voltInt + maxVoltOfsInt);
|
||||
ui->voltageSlider->setValue(voltInt + voltOfsInt);
|
||||
ui->voltageSpinBox->setValue(voltInt + voltOfsInt);
|
||||
|
||||
ui->fanSlider->setValue(fanSpeed);
|
||||
ui->fanSpinBox->setValue(fanSpeed);
|
||||
ui->fanSlider->setRange(0, 100);
|
||||
ui->fanSpinBox->setRange(0, 100);
|
||||
|
||||
QTimer *fanUpdateTimer = new QTimer(this);
|
||||
connect(fanUpdateTimer, SIGNAL(timeout()), this, SLOT(fanSpeedUpdater()));
|
||||
connect(fanUpdateTimer, SIGNAL(timeout()), this, SLOT(tempUpdater()));
|
||||
fanUpdateTimer->start(2000);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -33,11 +64,27 @@ void MainWindow::on_actionEdit_current_profile_triggered(bool)
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
{
|
||||
qDebug() << currentProfile;
|
||||
queryGPUSettings();
|
||||
//queryGPUSettings();
|
||||
//loadProfileSettings();
|
||||
// checkForProfiles();
|
||||
//getGPUDriver();
|
||||
checkForRoot();
|
||||
}
|
||||
|
||||
void MainWindow::checkForRoot()
|
||||
{
|
||||
QProcess process;
|
||||
process.start("/bin/sh -c \"echo $EUID\"");
|
||||
process.waitForFinished();
|
||||
QString EUID = process.readLine();
|
||||
if (EUID.toInt() == 0) {
|
||||
isRoot = true;
|
||||
}
|
||||
qDebug() << isRoot;
|
||||
}
|
||||
void MainWindow::checkForProfiles()
|
||||
{
|
||||
qDebug() << "chkproffunc";
|
||||
// If there are no profiles, create one, then list all the entries whose isProfile is true in the profile selection combo box
|
||||
QSettings settings("nvfancurve");
|
||||
QStringList groups = settings.childGroups();
|
||||
@ -54,6 +101,8 @@ void MainWindow::checkForProfiles()
|
||||
}
|
||||
if (noProfiles) {
|
||||
settings.setValue("New Profile/isProfile", true);
|
||||
settings.setValue("General/currentProfile", "New Profile");
|
||||
currentProfile = "New Profile";
|
||||
}
|
||||
// Redefine child groups so it contains the newly created profile if it was made
|
||||
QStringList newgroups = settings.childGroups();
|
||||
@ -72,10 +121,47 @@ void MainWindow::on_profileComboBox_activated(const QString &arg1)
|
||||
// Change currentProfile to combobox selection
|
||||
currentProfile = arg1;
|
||||
}
|
||||
|
||||
void MainWindow::getGPUDriver()
|
||||
{
|
||||
QProcess process;
|
||||
process.start(queryForNvidiaProp);
|
||||
process.waitForFinished(-1);
|
||||
if (process.readAllStandardOutput().toInt() >= 1) {
|
||||
gpuDriver = "nvidia";
|
||||
}
|
||||
}
|
||||
void MainWindow::enableFanControl()
|
||||
{
|
||||
QProcess process;
|
||||
process.start("nvidia-settings -a GPUFanControlState=1");
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
void MainWindow::getGPUInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::fanSpeedUpdater()
|
||||
{
|
||||
QProcess process;
|
||||
process.start(nvFanQ);
|
||||
process.waitForFinished(-1);
|
||||
fanSpeed = process.readLine().toInt();
|
||||
ui->fanSlider->setValue(fanSpeed);
|
||||
ui->fanSpinBox->setValue(fanSpeed);
|
||||
|
||||
}
|
||||
void MainWindow::tempUpdater()
|
||||
{
|
||||
QProcess process;
|
||||
process.start(nvTempQ);
|
||||
process.waitForFinished(-1);
|
||||
temp = process.readLine().toInt();
|
||||
if (xCurvePoints.size() != 0) {
|
||||
generateFanPoint();
|
||||
}
|
||||
}
|
||||
void MainWindow::queryGPUSettings()
|
||||
{
|
||||
QString volt;
|
||||
@ -85,15 +171,25 @@ void MainWindow::queryGPUSettings()
|
||||
volt = process.readLine();
|
||||
volt.chop(1);
|
||||
voltInt = volt.toInt()/1000;
|
||||
qDebug() << voltInt;
|
||||
|
||||
QString voltOfs;
|
||||
process.start(nvVoltOfsQ);
|
||||
process.waitForFinished(-1);
|
||||
voltOfs = process.readLine();
|
||||
voltOfs.chop(1);
|
||||
voltOfsInt = voltOfs.toInt();
|
||||
qDebug() << voltOfsInt;
|
||||
voltOfsInt = voltOfs.toInt()/1000;
|
||||
|
||||
defVolt = voltInt - voltOfsInt;
|
||||
|
||||
process.start(nvVoltOfsLimQ);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<process.size(); i++) {
|
||||
if (process.readLine().toInt()/1000 > maxVoltOfsInt) {
|
||||
qDebug() << process.readLine();
|
||||
maxVoltOfsInt = process.readLine().toInt()/1000;
|
||||
}
|
||||
}
|
||||
qDebug() << "maxvolt on" << maxVoltOfsInt;
|
||||
|
||||
QString coreFreqOfs;
|
||||
process.start(nvCoreClkOfsQ);
|
||||
@ -101,22 +197,227 @@ void MainWindow::queryGPUSettings()
|
||||
coreFreqOfs = process.readLine();
|
||||
coreFreqOfs.chop(1);
|
||||
coreFreqOfsInt = coreFreqOfs.toInt();
|
||||
qDebug() << coreFreqOfsInt;
|
||||
|
||||
QString currentLimits;
|
||||
QString nvclockmax = "nvclockmax";
|
||||
QRegExp exp;
|
||||
process.start(nvCurrentLimitsQ);
|
||||
QString curMaxClk;
|
||||
process.start(nvCurMaxClkQ);
|
||||
process.waitForFinished(-1);
|
||||
currentLimits = process.readAll();
|
||||
currentLimits.remove(0, (currentLimits.lastIndexOf("perf=3")));
|
||||
//currentLimits.remove(0, (currentLimits.lastIndexOf("nvclockmax")));
|
||||
exp.setPattern(nvclockmax);
|
||||
//exp.setPatternSyntax(QRegExp::)
|
||||
qDebug() << currentLimits;
|
||||
curMaxClkInt = process.readLine().toInt();
|
||||
qDebug() << curMaxClkInt;
|
||||
|
||||
QString maxPowerLim;
|
||||
process.start(nvMaxPowerLimQ);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<process.size(); i++) {
|
||||
QString output = process.readLine();
|
||||
if (!output.contains("power")) {
|
||||
maxPowerLim = output;
|
||||
break;
|
||||
}
|
||||
}
|
||||
maxPowerLim.chop(3);
|
||||
maxPowerLimInt = maxPowerLim.toDouble();
|
||||
qDebug() << maxPowerLimInt;
|
||||
|
||||
QString minPowerLim;
|
||||
process.start(nvMinPowerLimQ);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<process.size(); i++) {
|
||||
QString output = process.readLine();
|
||||
if (!output.contains("power")) {
|
||||
minPowerLim = output;
|
||||
break;
|
||||
}
|
||||
}
|
||||
minPowerLim.chop(3);
|
||||
minPowerLimInt = minPowerLim.toDouble();
|
||||
qDebug() << minPowerLimInt;
|
||||
|
||||
QString curPowerLim;
|
||||
process.start(nvCurPowerLimQ);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<process.size(); i++) {
|
||||
QString output = process.readLine();
|
||||
if (!output.contains("power")) {
|
||||
curPowerLim = output;
|
||||
break;
|
||||
}
|
||||
}
|
||||
curPowerLim.chop(3);
|
||||
curPowerLimInt = curPowerLim.toDouble();
|
||||
qDebug() << curPowerLimInt;
|
||||
|
||||
QString clockLimits;
|
||||
process.start(nvClockLimQ);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<2; i++) {
|
||||
QString line = process.readLine();
|
||||
if (line.contains("-")) {
|
||||
minCoreClkOfsInt = line.toInt();
|
||||
} else {
|
||||
maxCoreClkOfsInt = line.toInt();
|
||||
}
|
||||
}
|
||||
qDebug() << minCoreClkOfsInt << maxCoreClkOfsInt;
|
||||
|
||||
// This gets the transfer rate, the clock speed is rate/2
|
||||
process.start(nvMemClkLimQ);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<2; i++) {
|
||||
QString line = process.readLine();
|
||||
if (line.contains("-")) {
|
||||
minMemClkOfsInt = line.toInt()/2;
|
||||
} else {
|
||||
maxMemClkOfsInt = line.toInt()/2;
|
||||
}
|
||||
}
|
||||
qDebug() << minMemClkOfsInt << maxMemClkOfsInt;
|
||||
|
||||
process.start(nvCurMaxMemClkQ);
|
||||
process.waitForFinished(-1);
|
||||
curMaxMemClkInt = process.readLine().toInt();
|
||||
qDebug() << curMaxMemClkInt;
|
||||
|
||||
process.start(nvCurMemClkOfsQ);
|
||||
process.waitForFinished(-1);
|
||||
memClkOfsInt = process.readLine().toInt()/2;
|
||||
qDebug() << memClkOfsInt;
|
||||
|
||||
process.start(nvFanQ);
|
||||
process.waitForFinished(-1);
|
||||
fanSpeed = process.readLine().toInt();
|
||||
qDebug() << fanSpeed;
|
||||
|
||||
// Since the maximum core clock reported is the same on negative offsets as on 0 offset add a check here
|
||||
if (0 >= coreFreqOfsInt) {
|
||||
defCoreClk = curMaxClkInt;
|
||||
} else {
|
||||
defCoreClk = curMaxClkInt - coreFreqOfsInt;
|
||||
}
|
||||
defMemClk = curMaxMemClkInt - memClkOfsInt;
|
||||
}
|
||||
void MainWindow::applyGPUSettings()
|
||||
{
|
||||
QProcess process;
|
||||
int offsetValue = ui->frequencySlider->value() - defCoreClk;
|
||||
QString input = nvCoreClkSet;
|
||||
input.append(QString::number(offsetValue));
|
||||
qDebug() << input;
|
||||
process.start(input);
|
||||
process.waitForFinished(-1);
|
||||
|
||||
offsetValue = ui->memClkSlider->value() - defMemClk;
|
||||
input = nvMemClkSet;
|
||||
input.append(QString::number(offsetValue*2));
|
||||
qDebug() << input;
|
||||
process.start(input);
|
||||
process.waitForFinished(-1);
|
||||
|
||||
int powerLimit = ui->powerLimSlider->value();
|
||||
input = nvPowerLimSet;
|
||||
if (!isRoot) {
|
||||
input.append(QString::number(powerLimit) +"'\"");
|
||||
input.prepend("/bin/sh -c \"kdesu -c ");
|
||||
process.start(input);
|
||||
process.waitForFinished(-1);
|
||||
} else {
|
||||
input.append(QString::number(powerLimit));
|
||||
process.start(input);
|
||||
process.waitForFinished(-1);
|
||||
qDebug() << "ran as root";
|
||||
}
|
||||
|
||||
offsetValue = ui->voltageSlider->value() - defVolt;
|
||||
input = nvVoltageSet;
|
||||
input.append(QString::number(offsetValue*1000));
|
||||
qDebug() << input;
|
||||
process.start(input);
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
void MainWindow::loadProfileSettings()
|
||||
{
|
||||
QSettings settings("nvfancurve");
|
||||
currentProfile = settings.value("General/currentProfile").toString();
|
||||
settings.beginGroup(currentProfile);
|
||||
// Check for existance of the setting so zeroes don't get appended to curve point vectors
|
||||
if (settings.contains("xpoints")) {
|
||||
QString xPointStr = settings.value("xpoints").toString();
|
||||
QString yPointStr = settings.value("ypoints").toString();
|
||||
xPointStr.prepend("/bin/sh -c \"echo ");
|
||||
xPointStr.append(grepStringToInt);
|
||||
QProcess process;
|
||||
process.start(xPointStr);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<process.size() +1; i++) {
|
||||
xCurvePoints.append(process.readLine().toInt());
|
||||
}
|
||||
yPointStr.prepend("/bin/sh -c \"echo ");
|
||||
yPointStr.append(grepStringToInt);
|
||||
process.start(yPointStr);
|
||||
process.waitForFinished(-1);
|
||||
for (int i=0; i<process.size() +1; i++) {
|
||||
yCurvePoints.append(process.readLine().toInt());
|
||||
}
|
||||
}
|
||||
qDebug() << xCurvePoints << yCurvePoints;
|
||||
}
|
||||
|
||||
void MainWindow::on_newProfile_closed()
|
||||
{
|
||||
qDebug() << "dialog closed";
|
||||
ui->profileComboBox->clear();
|
||||
QSettings settings ("nvfancurve");
|
||||
QString isProfile = "/isProfile";
|
||||
// Refresh the profile combo box
|
||||
QStringList newgroups = settings.childGroups();
|
||||
for (int i=0; i<newgroups.length(); i++) {
|
||||
// Make a query $profile/isProfile
|
||||
QString group = newgroups[i];
|
||||
QString query = group.append(isProfile);
|
||||
if (settings.value(query).toBool()) {
|
||||
ui->profileComboBox->addItem(newgroups[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
void MainWindow::saveProfileSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::generateFanPoint()
|
||||
{
|
||||
// Calculate the value for fan speed based on temperature
|
||||
// First check if the fan speed should be y[0] or y[final]
|
||||
int index = 0;
|
||||
if (temp <= xCurvePoints[0]) {
|
||||
targetFanSpeed = yCurvePoints[0];
|
||||
}
|
||||
if (temp >= xCurvePoints[xCurvePoints.size()-1]) {
|
||||
targetFanSpeed = yCurvePoints[yCurvePoints.size()-1];
|
||||
} else {
|
||||
// Get the index of the leftmost point of the interpolated interval by comparing it to temperature
|
||||
for (int i=0; i<xCurvePoints.size(); i++) {
|
||||
if (temp >= xCurvePoints[i] && temp <= xCurvePoints[i+1]) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Check if the change in x is zero to avoid dividing by it
|
||||
if (xCurvePoints[index] - xCurvePoints[index + 1] == 0) {
|
||||
targetFanSpeed = yCurvePoints[index+1];
|
||||
} else {
|
||||
targetFanSpeed = (((yCurvePoints[index + 1] - yCurvePoints[index]) * (temp - xCurvePoints[index])) / (xCurvePoints[index + 1] - xCurvePoints[index])) + yCurvePoints[index];
|
||||
}
|
||||
}
|
||||
qDebug() << targetFanSpeed << index << xCurvePoints << yCurvePoints;
|
||||
QProcess process;
|
||||
QString input = nvFanSpeedSet;
|
||||
input.append(QString::number(targetFanSpeed));
|
||||
qDebug() << input;
|
||||
process.start(input);
|
||||
process.waitForFinished(-1);
|
||||
}
|
||||
void MainWindow::on_frequencySlider_valueChanged(int value)
|
||||
{
|
||||
// Sets the input field value to slider value
|
||||
@ -128,3 +429,57 @@ void MainWindow::on_frequencySpinBox_valueChanged(int arg1)
|
||||
{
|
||||
ui->frequencySlider->setValue(arg1);
|
||||
}
|
||||
|
||||
void MainWindow::on_newProfile_clicked()
|
||||
{
|
||||
newProfile *newprof = new newProfile(this);
|
||||
newprof->setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(newprof, SIGNAL(destroyed(QObject*)), SLOT(on_newProfile_closed()));
|
||||
newprof->setModal(true);
|
||||
newprof->exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_powerLimSlider_valueChanged(int value)
|
||||
{
|
||||
ui->powerLimSpinBox->setValue(value);
|
||||
}
|
||||
|
||||
void MainWindow::on_powerLimSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
ui->powerLimSlider->setValue(arg1);
|
||||
}
|
||||
|
||||
void MainWindow::on_memClkSlider_valueChanged(int value)
|
||||
{
|
||||
ui->memClkSpinBox->setValue(value);
|
||||
}
|
||||
|
||||
void MainWindow::on_memClkSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
ui->memClkSlider->setValue(arg1);
|
||||
}
|
||||
|
||||
void MainWindow::on_voltageSlider_valueChanged(int value)
|
||||
{
|
||||
ui->voltageSpinBox->setValue(value);
|
||||
}
|
||||
|
||||
void MainWindow::on_voltageSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
ui->voltageSlider->setValue(arg1);
|
||||
}
|
||||
|
||||
void MainWindow::on_fanSlider_valueChanged(int value)
|
||||
{
|
||||
ui->fanSpinBox->setValue(value);
|
||||
}
|
||||
|
||||
void MainWindow::on_fanSpinBox_valueChanged(int arg1)
|
||||
{
|
||||
ui->fanSlider->setValue(arg1);
|
||||
}
|
||||
|
||||
void MainWindow::on_applyButton_clicked()
|
||||
{
|
||||
applyGPUSettings();
|
||||
}
|
||||
|
89
mainwindow.h
89
mainwindow.h
@ -6,6 +6,7 @@
|
||||
#include <QFileInfo>
|
||||
#include "editprofile.h"
|
||||
#include <QProcess>
|
||||
#include <NVCtrl/NVCtrl.h>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
@ -18,32 +19,108 @@ class MainWindow : public QMainWindow
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
QString settingsDir = "C:/Users/Gnometech/Documents/rojekti/";
|
||||
QString currentProfile = "profile";
|
||||
QString currentProfile;
|
||||
QString nvFanQ = "nvidia-settings -q GPUCurrentFanSpeed -t";
|
||||
QString nvVoltQ = "nvidia-settings -q GPUCurrentCoreVoltage -t";
|
||||
QString nvVoltOfsQ = "nvidia-settings -q GPUOverVoltageOffset -t";
|
||||
QString nvCoreClkOfsQ = "nvidia-settings -q GPUGraphicsClockOffset -t";
|
||||
QString nvCurrentLimitsQ = "nvidia-settings -q GPUPerfModes -t";
|
||||
QString nvVoltOfsLimQ = "/bin/sh -c \"nvidia-settings -a GPUOverVoltageOffset=99999999 | egrep -o '[0-9]{1,9}'\"";
|
||||
QString nvCoreClkOfsQ = "nvidia-settings -q GPUGraphicsClockOffset[3] -t";
|
||||
QString nvCurMaxClkQ = "/bin/sh -c \"nvidia-smi --query-supported-clocks=gr --format=csv | egrep -o '[0-9]{2,9}'\"";
|
||||
QString nvMaxPowerLimQ = "nvidia-smi --query-gpu=power.max_limit --format=csv";
|
||||
QString nvMinPowerLimQ = "nvidia-smi --query-gpu=power.min_limit --format=csv";
|
||||
QString nvCurPowerLimQ = "nvidia-smi --query-gpu=power.limit --format=csv";
|
||||
QString nvClockLimQ = "/bin/sh -c \"nvidia-settings -a GPUGraphicsClockOffset[3]=999999 | egrep -o '[-0-9]{2,9}'\"";
|
||||
QString nvMemClkLimQ = "/bin/sh -c \"nvidia-settings -a GPUMemoryTransferRateOffset[3]=999999 | egrep -o '[-0-9]{2,9}'\"";
|
||||
QString nvCurMaxMemClkQ = "/bin/sh -c \"nvidia-smi --query-supported-clocks=mem --format=csv | egrep -o '[0-9]{2,9}'\"";
|
||||
QString nvCurMemClkOfsQ = "nvidia-settings -q GPUMemoryTransferRateOffset[3] -t";
|
||||
QString nvTempQ = "nvidia-settings -q ThermalSensorReading -t";
|
||||
|
||||
QString nvCoreClkSet = "nvidia-settings -a GPUGraphicsClockOffset[3]=";
|
||||
QString nvMemClkSet = "nvidia-settings -a GPUMemoryTransferRateOffset[3]=";
|
||||
QString nvPowerLimSet = "'nvidia-smi -pl ";
|
||||
QString nvFanSpeedSet = "nvidia-settings -a GPUTargetFanSpeed=";
|
||||
QString nvVoltageSet = "nvidia-settings -a GPUOverVoltageOffset=";
|
||||
|
||||
QString grepStringToInt = " | egrep -o '[0-9]{0,100}'\"";
|
||||
|
||||
QString queryForNvidiaProp = "/bin/sh -c \"lspci -vnn | grep -c 'Kernel driver in use: nvidia'\"";
|
||||
|
||||
QString gpuDriver;
|
||||
QVector <int> xCurvePoints, yCurvePoints;
|
||||
|
||||
int voltInt;
|
||||
int voltOfsInt;
|
||||
int coreFreqOfsInt;
|
||||
|
||||
int maxPowerLimInt;
|
||||
int minPowerLimInt;
|
||||
int curPowerLimInt;
|
||||
|
||||
int minCoreClkOfsInt;
|
||||
int maxCoreClkOfsInt;
|
||||
int curMaxClkInt;
|
||||
int minMemClkOfsInt;
|
||||
int maxMemClkOfsInt;
|
||||
int minVoltOfsInt = 0;
|
||||
int maxVoltOfsInt = 0;
|
||||
int curMaxMemClkInt;
|
||||
int memClkOfsInt;
|
||||
int fanSpeed;
|
||||
int temp;
|
||||
int targetFanSpeed;
|
||||
|
||||
int defCoreClk;
|
||||
int defMemClk;
|
||||
int defVolt;
|
||||
|
||||
bool isRoot;
|
||||
public slots:
|
||||
void saveProfileSettings();
|
||||
void loadProfileSettings();
|
||||
void checkForProfiles();
|
||||
private slots:
|
||||
|
||||
void on_actionEdit_current_profile_triggered(bool checked);
|
||||
void on_pushButton_clicked();
|
||||
void checkForProfiles();
|
||||
|
||||
void on_profileComboBox_activated(const QString &arg1);
|
||||
void queryGPUSettings();
|
||||
void getGPUInfo();
|
||||
void on_frequencySlider_valueChanged(int value);
|
||||
void on_frequencySpinBox_valueChanged(int arg1);
|
||||
|
||||
void on_newProfile_clicked();
|
||||
|
||||
void on_powerLimSlider_valueChanged(int value);
|
||||
|
||||
void on_powerLimSpinBox_valueChanged(int arg1);
|
||||
|
||||
void on_newProfile_closed();
|
||||
void on_memClkSlider_valueChanged(int value);
|
||||
|
||||
void on_memClkSpinBox_valueChanged(int arg1);
|
||||
|
||||
void on_voltageSlider_valueChanged(int value);
|
||||
|
||||
void on_voltageSpinBox_valueChanged(int arg1);
|
||||
|
||||
void fanSpeedUpdater();
|
||||
void applyGPUSettings();
|
||||
void on_fanSlider_valueChanged(int value);
|
||||
|
||||
void on_fanSpinBox_valueChanged(int arg1);
|
||||
|
||||
void on_applyButton_clicked();
|
||||
|
||||
void getGPUDriver();
|
||||
void generateFanPoint();
|
||||
void checkForRoot();
|
||||
void tempUpdater();
|
||||
void enableFanControl();
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
bool noProfiles;
|
||||
bool noProfiles = true;
|
||||
QVector <int> compXPoints, compYPoints;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
196
mainwindow.ui
196
mainwindow.ui
@ -14,19 +14,6 @@
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<widget class="QLabel" name="profileNameLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>490</y>
|
||||
<width>261</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="profileComboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -73,6 +60,189 @@
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="newProfile">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>650</y>
|
||||
<width>31</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="powerLimSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>501</y>
|
||||
<width>271</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="powerLimSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>500</y>
|
||||
<width>71</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="memClkSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>440</y>
|
||||
<width>71</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="memClkSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>440</y>
|
||||
<width>271</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="voltageSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>381</y>
|
||||
<width>271</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="voltageSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>380</y>
|
||||
<width>71</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="clockFreqLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>530</y>
|
||||
<width>191</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clock Frequency (MHz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="powerLimLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>470</y>
|
||||
<width>141</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Power Limit (W)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="memClockLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>410</y>
|
||||
<width>151</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Memory Clock (MHz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="voltgeLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>350</y>
|
||||
<width>141</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Voltage (mV)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="fanSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>320</y>
|
||||
<width>271</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="fanSpinBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>351</x>
|
||||
<y>319</y>
|
||||
<width>71</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>290</y>
|
||||
<width>131</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fan Speed (%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>175</x>
|
||||
<y>650</y>
|
||||
<width>101</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
|
@ -1,14 +1,79 @@
|
||||
#include "newprofile.h"
|
||||
#include "ui_newprofile.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
newProfile::newProfile(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::newProfile)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
listProfiles();
|
||||
|
||||
connect(ui->profileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(editEntryName(QListWidgetItem*)));
|
||||
connect(this, SIGNAL(mousePressEvent(QMouseEvent*)), this, SLOT(rightClick(QMouseEvent*)));
|
||||
}
|
||||
|
||||
newProfile::~newProfile()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void newProfile::on_profileNameEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
newProfileName = arg1;
|
||||
}
|
||||
|
||||
void newProfile::on_saveButton_clicked()
|
||||
{
|
||||
MainWindow mw;
|
||||
QSettings settings("nvfancurve");
|
||||
newProfileName.append("/isProfile");
|
||||
qDebug() << newProfileName;
|
||||
settings.setValue(newProfileName, true);
|
||||
this->close();
|
||||
// Add saving the GPU default values here
|
||||
}
|
||||
|
||||
void newProfile::listProfiles()
|
||||
{
|
||||
QSettings settings("nvfancurve");
|
||||
QString isProfile = "/isProfile";
|
||||
QStringList groups = settings.childGroups();
|
||||
qDebug() << "testi";
|
||||
for (int i=0; i<groups.length(); i++) {
|
||||
// Make a query $profile/isProfile
|
||||
QString group = groups[i];
|
||||
QString query = group.append(isProfile);
|
||||
qDebug() << query;
|
||||
if (settings.value(query).toBool()) {
|
||||
qDebug() << groups[i];
|
||||
ui->profileList->addItem(groups[i]);
|
||||
}
|
||||
}
|
||||
// Make the items editable
|
||||
for (int i=0; i<ui->profileList->count(); i++) {
|
||||
ui->profileList->item(i)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
void newProfile::editEntryName(QListWidgetItem *item)
|
||||
{
|
||||
qDebug() << "item dblclicked";
|
||||
ui->profileList->editItem(item);
|
||||
}
|
||||
void newProfile::rightClick(QMouseEvent *event)
|
||||
{
|
||||
qDebug() << "press";
|
||||
}
|
||||
|
||||
void newProfile::on_cancelButton_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
void newProfile::on_addButton_pressed()
|
||||
{
|
||||
ui->profileList->addItem("");
|
||||
int itemCount = ui->profileList->count()-1;
|
||||
ui->profileList->item(itemCount)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
|
||||
ui->profileList->editItem(ui->profileList->item(itemCount));
|
||||
}
|
||||
|
17
newprofile.h
17
newprofile.h
@ -2,6 +2,9 @@
|
||||
#define NEWPROFILE_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QAbstractButton>
|
||||
#include <QSettings>
|
||||
#include <QListWidget>
|
||||
|
||||
namespace Ui {
|
||||
class newProfile;
|
||||
@ -15,8 +18,22 @@ public:
|
||||
explicit newProfile(QWidget *parent = nullptr);
|
||||
~newProfile();
|
||||
|
||||
signals:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private slots:
|
||||
void on_saveButton_clicked();
|
||||
void on_profileNameEdit_textChanged(const QString &arg1);
|
||||
void on_cancelButton_clicked();
|
||||
void listProfiles();
|
||||
void editEntryName(QListWidgetItem *item);
|
||||
|
||||
void on_addButton_pressed();
|
||||
|
||||
void rightClick(QMouseEvent *event);
|
||||
private:
|
||||
Ui::newProfile *ui;
|
||||
QString newProfileName;
|
||||
};
|
||||
|
||||
#endif // NEWPROFILE_H
|
||||
|
108
newprofile.ui
108
newprofile.ui
@ -1,71 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>newProfile</class>
|
||||
<widget name="newProfile" class="QDialog">
|
||||
<widget class="QDialog" name="newProfile">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>418</width>
|
||||
<height>534</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget name="buttonBox" class="QDialogButtonBox">
|
||||
<widget class="QListWidget" name="profileList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>240</y>
|
||||
<width>341</width>
|
||||
<x>50</x>
|
||||
<y>40</y>
|
||||
<width>311</width>
|
||||
<height>401</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>440</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>rm</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>440</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>add</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>440</y>
|
||||
<width>86</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>440</y>
|
||||
<width>86</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>newProfile</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>newProfile</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>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -28,16 +28,19 @@ SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
qcustomplot.cpp \
|
||||
editprofile.cpp
|
||||
editprofile.cpp \
|
||||
newprofile.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
qcustomplot.h \
|
||||
editprofile.h
|
||||
editprofile.h \
|
||||
newprofile.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
editprofile.ui
|
||||
editprofile.ui \
|
||||
newprofile.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
|
Loading…
Reference in New Issue
Block a user