mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-20 11:38:26 -06:00
Code cleanup
This commit is contained in:
parent
7f5c0b6e41
commit
fdd88eaeb2
142
editprofile.cpp
142
editprofile.cpp
@ -60,14 +60,12 @@ editProfile::editProfile(QWidget *parent) :
|
||||
ui->curvePlot->xAxis->setRange(x_lower, (x_upper+5));
|
||||
ui->curvePlot->yAxis->setRange(y_lower, (y_upper+5));
|
||||
|
||||
//connect(ui->curvePlot, SIGNAL(on_clickedGraph(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent*)), SLOT(getDataIndex(QCPAbstractPlottable *plottable, int dataIndex)));
|
||||
connect(ui->curvePlot, SIGNAL(mouseDoubleClick(QMouseEvent*)), SLOT(clickedGraph(QMouseEvent*)));
|
||||
//connect(ui->curvePlot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(getPixelLength(QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(plottableClick(QCPAbstractPlottable*,int,QMouseEvent*)), SLOT(clickedPoint(QCPAbstractPlottable*,int,QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(mousePress(QMouseEvent*)), SLOT(detectPress(QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(detectMove(QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(mouseRelease(QMouseEvent*)), SLOT(detectRelease(QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(getYcoordValue(QMouseEvent*)));
|
||||
connect(ui->curvePlot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(getClosestCoords(QMouseEvent*)));
|
||||
|
||||
// Load the existing points to the graph
|
||||
MainWindow mw;
|
||||
@ -77,6 +75,9 @@ editProfile::editProfile(QWidget *parent) :
|
||||
}
|
||||
ui->curvePlot->graph(0)->setData(qv_x, qv_y);
|
||||
drawFillerLines();
|
||||
|
||||
QCPItemText *text = new QCPItemText(ui->curvePlot);
|
||||
coordText = text;
|
||||
}
|
||||
|
||||
editProfile::~editProfile()
|
||||
@ -94,6 +95,8 @@ void editProfile::addPoint(double x, double y)
|
||||
if ((x_lower<=x) && (x<=x_upper) && (y_lower<=y) && (y<=y_upper) && !duplicatePoint) {
|
||||
qv_x.append(x);
|
||||
qv_y.append(y);
|
||||
index_y = qv_y.size()-1;
|
||||
index_x = qv_x.size()-1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,30 +173,22 @@ bool editProfile::checkForDuplicatePoint(int x, int y)
|
||||
}
|
||||
return duplicatePoint;
|
||||
}
|
||||
|
||||
int editProfile::getXcoordValue(int xcoord)
|
||||
void editProfile::getClosestCoords(QMouseEvent *event)
|
||||
{
|
||||
getXPointIndex(xcoord, ycoord);
|
||||
return 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());
|
||||
double pointerxcoord = ui->curvePlot->xAxis->pixelToCoord(point.x());
|
||||
for (int i=0; i<qv_y.length(); i++) {
|
||||
if ((abs(pointerxcoord - qv_x[i]) < selectionPrecision) && abs(pointerycoord - qv_y[i]) < selectionPrecision) {
|
||||
xcoord = qv_x[i];
|
||||
ycoord = qv_y[i];
|
||||
break;
|
||||
// Get the coordinates of the point that the mouse is over
|
||||
if (qv_y.size() > 0) {
|
||||
QPoint cursor = event->pos();
|
||||
double pointerycoord = ui->curvePlot->yAxis->pixelToCoord(cursor.y());
|
||||
double pointerxcoord = ui->curvePlot->xAxis->pixelToCoord(cursor.x());
|
||||
for (int i=0; i<qv_y.size(); i++) {
|
||||
if (sqrt(abs(pointerxcoord - qv_x[i]) * (abs(pointerxcoord - qv_x[i])) + abs(pointerycoord - qv_y[i]) * abs(pointerycoord - qv_y[i])) < selectionPrecision) {
|
||||
xcoord = qv_x[i];
|
||||
ycoord = qv_y[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
getXcoordValue(xcoord);
|
||||
return ycoord;
|
||||
getPointIndices();
|
||||
}
|
||||
|
||||
bool editProfile::detectMove(QMouseEvent *event)
|
||||
@ -221,40 +216,28 @@ bool editProfile::initializeDragging(QMouseEvent *event)
|
||||
checkForNearbyPoints(event);
|
||||
if (isNearbyPoint || draggingPoint) {
|
||||
dragPoint(index_x, index_y, event);
|
||||
draggingPointSet();
|
||||
draggingPoint = true;
|
||||
}
|
||||
return mouseDragging;
|
||||
}
|
||||
|
||||
int editProfile::getXPointIndex(int xcoord, int ycoord)
|
||||
void editProfile::getPointIndices()
|
||||
{
|
||||
// Gets the indices of the point that the mouse has hovered over
|
||||
if (qv_x.length() > 0) {
|
||||
for (int i=0; i<qv_x.length(); i++) {
|
||||
if (qv_y.size() > 0) {
|
||||
for (int i=0; i<qv_y.size(); i++) {
|
||||
if ((qv_x[i] == xcoord) && (qv_y[i] == ycoord)) {
|
||||
index_x = i;
|
||||
index_y = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
getYPointIndex(index_y);
|
||||
return index_x;
|
||||
}
|
||||
}
|
||||
|
||||
int editProfile::getYPointIndex(int index_y)
|
||||
{
|
||||
qDebug() << index_x << index_y;
|
||||
return index_y;
|
||||
}
|
||||
|
||||
void editProfile::dragPoint(int index_x, int index_y, QMouseEvent* event)
|
||||
{
|
||||
// Moves the selected point by index
|
||||
// Sleep here so we don't take up so much CPU time
|
||||
QThread::msleep(10);
|
||||
ui->curvePlot->clearItems();
|
||||
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()));
|
||||
@ -271,31 +254,11 @@ void editProfile::dragPoint(int index_x, int index_y, QMouseEvent* event)
|
||||
if (qv_y[index_y] < y_lower) {
|
||||
qv_y[index_y] = y_lower;
|
||||
}
|
||||
|
||||
ui->curvePlot->graph(0)->setData(qv_x, qv_y);
|
||||
drawFillerLines();
|
||||
}
|
||||
|
||||
void editProfile::drawCoordtext()
|
||||
{
|
||||
// Display the coordinates
|
||||
QPalette palette;
|
||||
palette.setCurrentColorGroup(QPalette::Active);
|
||||
QColor textColor = palette.color(QPalette::Text);
|
||||
|
||||
QCPItemText *coordText = new QCPItemText(ui->curvePlot);
|
||||
if (draggingPoint) {
|
||||
if (qv_x[index_x] > x_upper) {
|
||||
qv_x[index_x] = x_upper;
|
||||
}
|
||||
if (qv_x[index_x] < x_lower) {
|
||||
qv_x[index_x] = x_lower;
|
||||
}
|
||||
if (qv_y[index_y] > y_upper) {
|
||||
qv_y[index_y] = y_upper;
|
||||
}
|
||||
if (qv_y[index_y] < y_lower) {
|
||||
qv_y[index_y] = y_lower;
|
||||
}
|
||||
coordText->position->setType(QCPItemPosition::ptPlotCoords);
|
||||
coordText->position->setCoords(qv_x[index_x], qv_y[index_y] + 4);
|
||||
QString xString = QString::number(qv_x[index_x]);
|
||||
@ -303,11 +266,9 @@ void editProfile::drawCoordtext()
|
||||
coordText->setText(xString + ", " + yString);
|
||||
coordText->setColor(textColor);
|
||||
|
||||
} else {
|
||||
ui->curvePlot->removeItem(coordText);
|
||||
}
|
||||
ui->curvePlot->graph(0)->setData(qv_x, qv_y);
|
||||
drawFillerLines();
|
||||
}
|
||||
|
||||
void editProfile::drawFillerLines()
|
||||
{
|
||||
// Draw the filler lines separately so they don't interfere with the main data. graph(1) = leftward line, graph(2) = rightward line
|
||||
@ -326,7 +287,6 @@ void editProfile::drawFillerLines()
|
||||
|
||||
ui->curvePlot->graph(2)->setData(rightLineX, rightLineY);
|
||||
rePlot();
|
||||
|
||||
}
|
||||
void editProfile::detectRelease(QMouseEvent *event)
|
||||
{
|
||||
@ -334,57 +294,14 @@ void editProfile::detectRelease(QMouseEvent *event)
|
||||
mouseMoving = false;
|
||||
mouseDragging = false;
|
||||
draggingPoint = false;
|
||||
//draggedIndicesUnset();
|
||||
//draggingPointUnset();
|
||||
drawCoordtext();
|
||||
}
|
||||
|
||||
bool editProfile::draggingPointUnset()
|
||||
{
|
||||
draggingPoint = false;
|
||||
return draggingPoint;
|
||||
}
|
||||
|
||||
bool editProfile::draggingPointSet()
|
||||
{
|
||||
draggingPoint = true;
|
||||
return draggingPoint;
|
||||
}
|
||||
bool editProfile::draggedIndicesSet()
|
||||
{
|
||||
indicesSet = true;
|
||||
return indicesSet;
|
||||
}
|
||||
|
||||
bool editProfile::draggedIndicesUnset()
|
||||
{
|
||||
indicesSet = false;
|
||||
return indicesSet;
|
||||
}
|
||||
bool editProfile::resetMouseMove()
|
||||
{
|
||||
mouseMoving = false;
|
||||
return mouseMoving;
|
||||
}
|
||||
|
||||
bool editProfile::resetMouseDragging()
|
||||
{
|
||||
mouseDragging = false;
|
||||
return mouseDragging;
|
||||
}
|
||||
|
||||
double editProfile::getPixelLength(QMouseEvent *event)
|
||||
{
|
||||
QPoint point = event->pos();
|
||||
qDebug() << ui->curvePlot->graph(0)->selectTest(point, 2);
|
||||
qDebug() << pixelLength;
|
||||
return pixelLength;
|
||||
coordText->setText("");
|
||||
rePlot();
|
||||
}
|
||||
|
||||
void editProfile::on_pushButton_clicked()
|
||||
{
|
||||
qDebug() << draggingPoint;
|
||||
drawCoordtext();
|
||||
coordText->setText("");
|
||||
}
|
||||
|
||||
void editProfile::on_saveButton_clicked()
|
||||
@ -409,7 +326,6 @@ void editProfile::on_saveButton_clicked()
|
||||
xsetting.append("/xpoints");
|
||||
settings.setValue(xsetting, xarray);
|
||||
settings.setValue(ysetting, yarray);
|
||||
|
||||
}
|
||||
|
||||
void editProfile::on_clearButton_clicked()
|
||||
|
@ -31,29 +31,17 @@ private slots:
|
||||
void addPoint(double x, double y);
|
||||
void on_pushButton_clicked();
|
||||
void clickedPoint(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event);
|
||||
//void getDataPoints();
|
||||
void on_saveButton_clicked();
|
||||
void drawCoordtext();
|
||||
|
||||
double getPixelLength(QMouseEvent *event);
|
||||
bool initializeDragging(QMouseEvent *event);
|
||||
bool detectMove(QMouseEvent *event);
|
||||
bool detectPress(QMouseEvent *event);
|
||||
void detectRelease(QMouseEvent *event);
|
||||
bool checkForDuplicatePoint(int x, int y);
|
||||
int getDataIndex(QCPAbstractPlottable *plottable, int dataIndex);
|
||||
int getYcoordValue(QMouseEvent *event);
|
||||
int getXcoordValue(int xcoord);
|
||||
int getXPointIndex(int xcoord, int ycoord);
|
||||
int getYPointIndex(int index_y);
|
||||
bool resetMouseMove();
|
||||
bool resetMouseDragging();
|
||||
void getClosestCoords(QMouseEvent *event);
|
||||
void getPointIndices();
|
||||
bool checkForNearbyPoints(QMouseEvent *event);
|
||||
bool draggedIndicesSet();
|
||||
bool draggedIndicesUnset();
|
||||
void dragPoint(int index_x, int index_y, QMouseEvent *event);
|
||||
bool draggingPointSet();
|
||||
bool draggingPointUnset();
|
||||
void drawFillerLines();
|
||||
void on_clearButton_clicked();
|
||||
|
||||
@ -66,7 +54,7 @@ private:
|
||||
QVector<double> rightLineY;
|
||||
QVector<int> curvepoints;
|
||||
QPair<int, int> curvepoint;
|
||||
//QCPItemText *coordText;
|
||||
QCPItemText *coordText;
|
||||
int x_lower = 0;
|
||||
int x_upper = 100;
|
||||
int y_lower = 0;
|
||||
|
@ -57,7 +57,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabHandler(int)));
|
||||
connect(monitorUpdater, SIGNAL(timeout()), SLOT(updateMonitor()));
|
||||
|
||||
plotCmds powerdrawplot;
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -156,65 +155,45 @@ void MainWindow::setupGraphMonitorTab()
|
||||
plotWidget->setLayout(plotLayout);
|
||||
|
||||
// Define the structs
|
||||
//plotCmdsList[0].valueq = mon.temp.toDouble();
|
||||
plotCmdsList[0].plot = tempPlot;
|
||||
plotCmdsList[0].vector = qv_temp;
|
||||
plotCmdsList[0].layout = tempLayout;
|
||||
plotCmdsList[0].widget = tempWidget;
|
||||
//plotCmdsList[0].mintext = tempMinText;
|
||||
//plotCmdsList[0].maxtext = tempMaxText;
|
||||
|
||||
//plotCmdsList[1].valueq = mon.powerdraw.toDouble();
|
||||
plotCmdsList[1].plot = powerDrawPlot;
|
||||
plotCmdsList[1].vector = qv_powerDraw;
|
||||
plotCmdsList[1].layout = powerDrawLayout;
|
||||
plotCmdsList[1].widget = powerDrawWidget;
|
||||
//plotCmdsList[1].mintext = powerDrawMinText;
|
||||
//plotCmdsList[1].maxtext = powerDrawMaxText;
|
||||
|
||||
//plotCmdsList[2].valueq = mon.coreclock.toDouble();
|
||||
plotCmdsList[2].plot = coreClkPlot;
|
||||
plotCmdsList[2].vector = qv_coreClk;
|
||||
plotCmdsList[2].layout = coreClkLayout;
|
||||
plotCmdsList[2].widget = coreClkWidget;
|
||||
//plotCmdsList[2].mintext = coreClkMinText;
|
||||
//plotCmdsList[2].maxtext = coreClkMaxText;
|
||||
|
||||
//plotCmdsList[3].valueq = mon.memclock.toDouble();
|
||||
plotCmdsList[3].plot = memClkPlot;
|
||||
plotCmdsList[3].vector = qv_memClk;
|
||||
plotCmdsList[3].layout = memClkLayout;
|
||||
plotCmdsList[3].widget = memClkWidget;
|
||||
//plotCmdsList[3].mintext = memClkMinText;
|
||||
//plotCmdsList[3].maxtext = memClkMaxText;
|
||||
|
||||
plotCmdsList[4].plot = coreUtilPlot;
|
||||
plotCmdsList[4].vector = qv_coreUtil;
|
||||
plotCmdsList[4].layout = coreUtilLayout;
|
||||
plotCmdsList[4].widget = coreUtilWidget;
|
||||
//plotCmdsList[4].mintext = coreUtilMinText;
|
||||
//plotCmdsList[4].maxtext = coreUtilMaxText;
|
||||
|
||||
plotCmdsList[5].plot = memUtilPlot;
|
||||
plotCmdsList[5].vector = qv_memUtil;
|
||||
plotCmdsList[5].layout = memUtilLayout;
|
||||
plotCmdsList[5].widget = memUtilWidget;
|
||||
//plotCmdsList[5].mintext = memUtilMinText;
|
||||
//plotCmdsList[6].maxtext = memUtilMaxText;
|
||||
|
||||
plotCmdsList[6].plot = voltagePlot;
|
||||
plotCmdsList[6].vector = qv_voltage;
|
||||
plotCmdsList[6].layout = voltageLayout;
|
||||
plotCmdsList[6].widget = voltageWidget;
|
||||
//plotCmdsList[7].mintext = voltageMinText;
|
||||
//plotCmdsList[7].maxtext = voltageMaxText;
|
||||
|
||||
plotCmdsList[7].plot = fanSpeedPlot;
|
||||
plotCmdsList[7].vector = qv_fanSpeed;
|
||||
plotCmdsList[7].layout = fanSpeedLayout;
|
||||
plotCmdsList[7].widget = fanSpeedWidget;
|
||||
//plotCmdsList[7].mintext = fanMinText;
|
||||
//plotCmdsList[7].maxtext = fanMaxText;
|
||||
|
||||
plotCmdsList[0].valueq = mon.temp.toDouble();
|
||||
plotCmdsList[1].valueq = mon.powerdraw.toDouble();
|
||||
@ -224,7 +203,7 @@ void MainWindow::setupGraphMonitorTab()
|
||||
plotCmdsList[5].valueq = mon.memutil.toDouble();
|
||||
plotCmdsList[6].valueq = mon.voltage.toDouble();
|
||||
plotCmdsList[7].valueq = fanSpeed;
|
||||
// Get the main widget backgorund palette and use the colors for the plots
|
||||
// Get the main widget palette and use it for the graphs
|
||||
QPalette palette;
|
||||
palette.setCurrentColorGroup(QPalette::Active);
|
||||
QColor color = palette.color(QPalette::Background);
|
||||
@ -282,16 +261,9 @@ void MainWindow::setupGraphMonitorTab()
|
||||
sublo->addElement(plotCmdsList[i].mintext);
|
||||
sublo->addElement(plotCmdsList[i].maxtext);
|
||||
|
||||
//QCPLayoutGrid *sublo = new QCPLayoutGrid;
|
||||
//plotCmdsList[i].plot->plotLayout()->addElement(0, 0, sublo);
|
||||
//sublo->setMargins(QMargins(5 ,5, 5, 5));
|
||||
//sublo->addElement(plotCmdsList[i].mintext);
|
||||
//sublo->addElement(plotCmdsList[i].maxtext);
|
||||
//plotCmdsList[i].maxtext->setTextColor(textColor);
|
||||
//plotCmdsList[i].mintext->setTextColor(textColor);
|
||||
//plotCmdsList[i].plot->plotLayout()->addElement(plotCmdsList[i].maxtext);
|
||||
//plotCmdsList[i].maxtext->setText("Max: " + QString::number(plotCmdsList[i].valueq));
|
||||
//plotCmdsList[i].mintext->setText("Min: " + QString::number(plotCmdsList[i].valueq));
|
||||
QCPItemText *text = new QCPItemText(plotCmdsList[i].plot);
|
||||
text->setColor(textColor);
|
||||
plotCmdsList[i].valText = text;
|
||||
|
||||
// Set the y-range
|
||||
plotCmdsList[i].plot->yAxis->setRange(plotCmdsList[i].valueq -plotCmdsList[i].valueq*0.1, plotCmdsList[i].valueq + plotCmdsList[i].valueq*0.1);
|
||||
@ -307,6 +279,8 @@ void MainWindow::setupGraphMonitorTab()
|
||||
mouseTracer->setPen(tracerPen);
|
||||
//connect(r, SIGNAL(mouseMove(QMouseEvent*)), SLOT(plotHovered(QMouseEvent*)));
|
||||
connect(plotCmdsList[i].plot, SIGNAL(mouseMove(QMouseEvent*)), SLOT(plotHovered(QMouseEvent*)));
|
||||
|
||||
connect(plotCmdsList[i].plot, SIGNAL(leaveEvent(QEvent *event)), SLOT(clearPlotTracer(QEvent *event)));
|
||||
}
|
||||
|
||||
tempPlot->yAxis->setLabel("Temperature (°C)");
|
||||
@ -325,7 +299,7 @@ void MainWindow::setupGraphMonitorTab()
|
||||
lo->addWidget(plotScrollArea);
|
||||
ui->monitorTab->setLayout(lo);
|
||||
|
||||
connect(plotHoverUpdater, SIGNAL(timeout()), SLOT(plotHovered()));
|
||||
//connect(plotHoverUpdater, SIGNAL(timeout()), SLOT(plotHovered()));
|
||||
}
|
||||
void MainWindow::updateMonitor()
|
||||
{
|
||||
@ -451,29 +425,42 @@ void MainWindow::plotHovered(QMouseEvent *event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
//int xindex = round(plotCmdsList[plotIndex].plot->xAxis->pixelToCoord(cursor.x())) ;
|
||||
double pointerxcoord = plotCmdsList[plotIndex].plot->xAxis->pixelToCoord(cursor.x());
|
||||
//double pointerycoord = plotCmdsList[plotIndex].plot->yAxis->pixelToCoord(cursor.y());
|
||||
qDebug() << pointerxcoord << plotVectorSize;
|
||||
plotCmdsList[plotIndex].tracer->position->setCoords(pointerxcoord, plotCmdsList[plotIndex].plot->yAxis->range().upper);
|
||||
// Find the y-value for the corresponding coordinate
|
||||
//double ycoord = plotCmdsList[plotIndex].vector[xindex];
|
||||
//qDebug() << xindex;
|
||||
//qDebug() << plotCmdsList[plotIndex].plot->plottableAt(event->pos());
|
||||
//QPointF pixelPos = QCPAbstractPlottable1D<>()
|
||||
//int pointerxint = round(pointerxcoord);
|
||||
int valIndex = 0;
|
||||
if (!qv_time.isEmpty()) {
|
||||
if (!qv_time.isEmpty() && pointerxcoord > -plotVectorSize*1.01 && pointerxcoord <= 0 + plotVectorSize*0.01) {
|
||||
double deltax = abs(qv_time[0] - pointerxcoord);
|
||||
for (int i=0; i<plotCmdsList[plotIndex].vector.size(); i++) {
|
||||
double deltax = abs(qv_time[0] - pointerxcoord);
|
||||
if (abs(qv_time[i] - pointerxcoord) < deltax) {
|
||||
deltax = abs(qv_time[i] - pointerxcoord);
|
||||
valIndex = i;
|
||||
}
|
||||
}
|
||||
//qDebug() << plotCmdsList[plotIndex].vector[valIndex];
|
||||
//QCPItemText *text = new QCPItemText(plotCmdsList[plotIndex].plot);
|
||||
plotCmdsList[plotIndex].valText->setText(QString::number(plotCmdsList[plotIndex].vector[valIndex]));
|
||||
// Make the text stay inside the plot
|
||||
if (pointerxcoord > -plotVectorSize*0.06) {
|
||||
plotCmdsList[plotIndex].valText->position->setCoords(-plotVectorSize*0.06, plotCmdsList[plotIndex].plot->yAxis->range().upper - plotCmdsList[plotIndex].plot->yAxis->range().size()*0.05);
|
||||
} else if (pointerxcoord < -plotVectorSize*0.94) {
|
||||
plotCmdsList[plotIndex].valText->position->setCoords(-plotVectorSize*0.94, plotCmdsList[plotIndex].plot->yAxis->range().upper - plotCmdsList[plotIndex].plot->yAxis->range().size()*0.05);
|
||||
} else {
|
||||
plotCmdsList[plotIndex].valText->position->setCoords(pointerxcoord, plotCmdsList[plotIndex].plot->yAxis->range().upper - plotCmdsList[plotIndex].plot->yAxis->range().size()*0.05);
|
||||
}
|
||||
//plotCmdsList[plotIndex].widget->setToolTip("test");
|
||||
//QToolTip::showText(cursor, QString::number(plotCmdsList[plotIndex].vector[valIndex]), plotCmdsList[plotIndex].plot);
|
||||
//QToolTip::sh
|
||||
|
||||
qDebug() << "inside the plot";
|
||||
QThread::msleep(5);
|
||||
} else {
|
||||
// If the cursor is not within the x-range, clear the text
|
||||
plotCmdsList[plotIndex].valText->setText("");
|
||||
}
|
||||
qDebug() << plotCmdsList[plotIndex].vector[valIndex];
|
||||
plotCmdsList[plotIndex].plot->update();
|
||||
plotCmdsList[plotIndex].plot->replot();
|
||||
QThread::msleep(5);
|
||||
}
|
||||
void MainWindow::checkForProfiles()
|
||||
{
|
||||
@ -560,10 +547,6 @@ void MainWindow::resetTimer()
|
||||
resettimer->setSingleShot(true);
|
||||
resettimer->start(10000);
|
||||
}
|
||||
void MainWindow::resetStatusLabel()
|
||||
{
|
||||
ui->statusLabel->clear();
|
||||
}
|
||||
void MainWindow::resetChanges()
|
||||
{
|
||||
// If the settings haven't been applied in 10 seconds, reset all values to their latest values
|
||||
@ -800,9 +783,9 @@ void MainWindow::applyGPUSettings()
|
||||
}
|
||||
}
|
||||
if (hadErrors) {
|
||||
ui->statusLabel->setText(errorText);
|
||||
ui->statusBar->showMessage(errorText, 5000);
|
||||
} else {
|
||||
ui->statusLabel->setText("Settings applied");
|
||||
ui->statusBar->showMessage("Settings applied", 5000);
|
||||
}
|
||||
resettimer->stop();
|
||||
}
|
||||
@ -856,9 +839,9 @@ void MainWindow::loadProfileSettings()
|
||||
fanControlMode = settings.value("fanControlMode").toInt();
|
||||
ui->fanModeComboBox->setCurrentIndex(fanControlMode);
|
||||
}
|
||||
ui->statusLabel->setText("Profile settings loaded.");
|
||||
statusLabelResetTimer->start(7000);
|
||||
statusLabelResetTimer->setSingleShot(true);
|
||||
ui->statusBar->showMessage("Profile settings loaded.", 7000);
|
||||
//statusLabelResetTimer->start(7000);
|
||||
//statusLabelResetTimer->setSingleShot(true);
|
||||
connect(statusLabelResetTimer, SIGNAL(timeout()), SLOT(resetStatusLabel()));
|
||||
qDebug() << xCurvePoints << yCurvePoints;
|
||||
}
|
||||
@ -989,10 +972,6 @@ void MainWindow::on_applyButton_clicked()
|
||||
saveProfileSettings();
|
||||
applyFanMode();
|
||||
setupMonitorTab();
|
||||
//ui->statusLabel->setText("Settings applied.");
|
||||
statusLabelResetTimer->start(7000);
|
||||
statusLabelResetTimer->setSingleShot(true);
|
||||
connect(statusLabelResetTimer, SIGNAL(timeout()), SLOT(resetStatusLabel()));
|
||||
}
|
||||
void MainWindow::on_editFanCurveButton_pressed()
|
||||
{
|
||||
|
18
mainwindow.h
18
mainwindow.h
@ -137,7 +137,7 @@ private slots:
|
||||
|
||||
void on_editProfile_closed();
|
||||
void applyFanMode();
|
||||
void resetStatusLabel();
|
||||
//void resetStatusLabel();
|
||||
void enableFanUpdater();
|
||||
void setupMonitorTab();
|
||||
void updateMonitor();
|
||||
@ -148,6 +148,11 @@ private slots:
|
||||
void tabHandler(int index);
|
||||
void setupGraphMonitorTab();
|
||||
void plotHovered(QMouseEvent *event);
|
||||
/*void leaveEvent(QEvent *event) {
|
||||
QWidget::leaveEvent(event);
|
||||
QApplication::sendEvent(tempPlot, event);
|
||||
}*/
|
||||
//void leaveEvent(QEvent *event);
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
bool noProfiles = true;
|
||||
@ -237,6 +242,7 @@ private:
|
||||
QCPTextElement *mintext;
|
||||
QCPTextElement *maxtext;
|
||||
QCPItemTracer *tracer;
|
||||
QCPItemText *valText;
|
||||
};
|
||||
int counter = 0;
|
||||
// The maximum size of plot data vectors (range +1)
|
||||
@ -251,5 +257,15 @@ private:
|
||||
plotCmds voltageplot;
|
||||
plotCmds fanspeedplot;
|
||||
QVector <plotCmds> plotCmdsList;
|
||||
|
||||
|
||||
};
|
||||
class plotWidgets : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
//void leaveEvent(QEvent *event);
|
||||
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -240,7 +240,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>471</width>
|
||||
<height>539</height>
|
||||
<height>560</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2"/>
|
||||
@ -251,13 +251,6 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
|
Loading…
Reference in New Issue
Block a user