mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-24 09:10:16 -06:00
start adding monitor graphs
This commit is contained in:
parent
b400a64677
commit
aaf49aa678
@ -16,6 +16,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
queryDriverSettings();
|
||||
getGPUName();
|
||||
setupMonitorTab();
|
||||
setupGraphMonitorTab();
|
||||
tabHandler(ui->tabWidget->currentIndex());
|
||||
|
||||
ui->frequencySlider->setRange(minCoreClkOfsInt, maxCoreClkOfsInt);
|
||||
@ -132,6 +133,50 @@ void MainWindow::setupMonitorTab()
|
||||
QString curMaxMemClk = QString::number(defMemClk + latestMemClkOfs) + " MHz";
|
||||
curmaxmemclk->setText(1, curMaxMemClk);
|
||||
}
|
||||
void MainWindow::setupGraphMonitorTab()
|
||||
{
|
||||
// Create a widget that contains all the plots
|
||||
QWidget *plotWidget = new QWidget;
|
||||
|
||||
// Scroll area for the plots
|
||||
QScrollArea *plotScrollArea = new QScrollArea;
|
||||
|
||||
// Layout for the plots
|
||||
QVBoxLayout *plotLayout = new QVBoxLayout(plotWidget);
|
||||
|
||||
// Add this plot
|
||||
QCustomPlot *tempPlot = new QCustomPlot;
|
||||
tempPlot->setMinimumHeight(1200);
|
||||
//tempPlot->setMaximumHeight(200);
|
||||
tempPlot->setMinimumWidth(200);
|
||||
|
||||
QCustomPlot *powerDrawPlot = new QCustomPlot;
|
||||
powerDrawPlot->setMinimumHeight(200);
|
||||
powerDrawPlot->setMaximumHeight(200);
|
||||
powerDrawPlot->setMinimumWidth(200);
|
||||
|
||||
// Widget for this plot
|
||||
QWidget *tempWidget = new QWidget;
|
||||
QWidget *powerDrawWidget = new QWidget;
|
||||
|
||||
// Layout for this widget
|
||||
QVBoxLayout *tempLayout = new QVBoxLayout(tempWidget);
|
||||
tempLayout->addWidget(tempPlot);
|
||||
plotLayout->addWidget(tempWidget);
|
||||
|
||||
QVBoxLayout *powerDrawLayout = new QVBoxLayout(powerDrawWidget);
|
||||
powerDrawLayout->addWidget(powerDrawPlot);
|
||||
plotLayout->addWidget(powerDrawWidget);
|
||||
|
||||
// Set the layout containing the scroll area as the widget for the tab
|
||||
plotScrollArea->setWidget(plotWidget);
|
||||
plotScrollArea->setWidgetResizable(true);
|
||||
|
||||
// Add scroll area to a layout so we can set it as the widget for the tab
|
||||
QVBoxLayout *lo = new QVBoxLayout;
|
||||
lo->addWidget(plotScrollArea);
|
||||
ui->monitorTab->setLayout(lo);
|
||||
}
|
||||
void MainWindow::updateMonitor()
|
||||
{
|
||||
monitor mon;
|
||||
@ -475,7 +520,6 @@ void MainWindow::applyGPUSettings()
|
||||
} else {
|
||||
ui->statusLabel->setText("Settings applied");
|
||||
}
|
||||
|
||||
resettimer->stop();
|
||||
}
|
||||
|
||||
@ -487,7 +531,7 @@ void MainWindow::loadProfileSettings()
|
||||
// Check for existance of the setting so zeroes don't get appended to curve point vectors
|
||||
if (settings.contains("xpoints")) {
|
||||
QString xPointStr = "/bin/sh -c \"echo " + settings.value("xpoints").toString() + grepStringToInt;
|
||||
QString yPointStr = "/bin/sh -c \"echo " + settings.value("xpoints").toString() + grepStringToInt;
|
||||
QString yPointStr = "/bin/sh -c \"echo " + settings.value("ypoints").toString() + grepStringToInt;
|
||||
QProcess process;
|
||||
process.start(xPointStr);
|
||||
process.waitForFinished(-1);
|
||||
|
@ -145,10 +145,12 @@ private slots:
|
||||
void checkForProfiles();
|
||||
void on_fanModeComboBox_currentIndexChanged(int index);
|
||||
void tabHandler(int index);
|
||||
void setupGraphMonitorTab();
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
bool noProfiles = true;
|
||||
QVector <int> compXPoints, compYPoints;
|
||||
QVector <double> qv_time, qv_temp;
|
||||
|
||||
QTimer *resettimer = new QTimer(this);
|
||||
QTimer *fanUpdateTimer = new QTimer(this);
|
||||
@ -156,7 +158,6 @@ private:
|
||||
QTimer *fanUpdaterDisablerTimer = new QTimer(this);
|
||||
QTimer *monitorUpdater = new QTimer(this);
|
||||
|
||||
|
||||
QTreeWidgetItem *gputemp = new QTreeWidgetItem;
|
||||
QTreeWidgetItem *powerdraw = new QTreeWidgetItem;
|
||||
QTreeWidgetItem *voltage = new QTreeWidgetItem;
|
||||
|
@ -14,21 +14,14 @@
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="perfEditorTab">
|
||||
<attribute name="title">
|
||||
@ -206,17 +199,6 @@
|
||||
<attribute name="title">
|
||||
<string>Graph Monitor</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCustomPlot" name="widget" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCustomPlot" name="widget_2" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="monitorListTab">
|
||||
<attribute name="title">
|
||||
@ -246,32 +228,36 @@
|
||||
<attribute name="title">
|
||||
<string>Page</string>
|
||||
</attribute>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>60</y>
|
||||
<width>341</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>337</width>
|
||||
<height>367</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>471</width>
|
||||
<height>539</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
@ -322,14 +308,6 @@
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QCustomPlot</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qcustomplot.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -10,7 +10,8 @@ newProfile::newProfile(QWidget *parent) :
|
||||
listProfiles();
|
||||
|
||||
connect(ui->profileList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(editEntryName(QListWidgetItem*)));
|
||||
connect(this, SIGNAL(mousePressEvent(QMouseEvent*)), this, SLOT(rightClick(QMouseEvent*)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
newProfile::~newProfile()
|
||||
@ -25,12 +26,9 @@ void newProfile::on_profileNameEdit_textChanged(const QString &arg1)
|
||||
|
||||
void newProfile::on_saveButton_clicked()
|
||||
{
|
||||
MainWindow mw;
|
||||
QSettings settings("nvfancurve");
|
||||
newProfileName.append("/isProfile");
|
||||
qDebug() << newProfileName;
|
||||
settings.setValue(newProfileName, true);
|
||||
this->close();
|
||||
// for loop here
|
||||
settings.beginGroup(newProfileName);
|
||||
// Add saving the GPU default values here
|
||||
}
|
||||
|
||||
@ -59,6 +57,9 @@ void newProfile::listProfiles()
|
||||
void newProfile::editEntryName(QListWidgetItem *item)
|
||||
{
|
||||
qDebug() << "item dblclicked";
|
||||
SignalItemDelegate *delegate = new SignalItemDelegate(ui->profileList);
|
||||
connect(delegate, &SignalItemDelegate::editStarted,[](){qDebug("edit started");});
|
||||
connect(delegate, &SignalItemDelegate::editFinished,[](){qDebug("edit finished");});
|
||||
ui->profileList->editItem(item);
|
||||
}
|
||||
void newProfile::rightClick(QMouseEvent *event)
|
||||
@ -72,6 +73,10 @@ void newProfile::on_cancelButton_clicked()
|
||||
}
|
||||
void newProfile::on_addButton_pressed()
|
||||
{
|
||||
SignalItemDelegate *delegate = new SignalItemDelegate(ui->profileList);
|
||||
connect(delegate, &SignalItemDelegate::editStarted,[](){qDebug("edit started");});
|
||||
connect(delegate, &SignalItemDelegate::editFinished,[](){qDebug("edit finished");});
|
||||
ui->profileList->setItemDelegate(delegate);
|
||||
ui->profileList->addItem("");
|
||||
int itemCount = ui->profileList->count()-1;
|
||||
ui->profileList->item(itemCount)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
|
||||
|
19
newprofile.h
19
newprofile.h
@ -5,6 +5,7 @@
|
||||
#include <QAbstractButton>
|
||||
#include <QSettings>
|
||||
#include <QListWidget>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
namespace Ui {
|
||||
class newProfile;
|
||||
@ -35,5 +36,21 @@ private:
|
||||
Ui::newProfile *ui;
|
||||
QString newProfileName;
|
||||
};
|
||||
|
||||
// New class for editing so we can detect when the editing has finished
|
||||
class SignalItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(SignalItemDelegate)
|
||||
public:
|
||||
explicit SignalItemDelegate(QObject* parent = Q_NULLPTR):QStyledItemDelegate(parent){
|
||||
QObject::connect(this,&SignalItemDelegate::closeEditor,this,&SignalItemDelegate::editFinished);
|
||||
}
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE {
|
||||
void editStarted();
|
||||
return QStyledItemDelegate::setEditorData(editor,index);
|
||||
}
|
||||
Q_SIGNALS:
|
||||
void editStarted();
|
||||
void editFinished();
|
||||
};
|
||||
#endif // NEWPROFILE_H
|
||||
|
@ -13,68 +13,39 @@
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QListWidget" name="profileList">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<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="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</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>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QListWidget" name="profileList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="text">
|
||||
<string>add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="text">
|
||||
<string>rm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Loading…
Reference in New Issue
Block a user