mirror of https://github.com/saitohirga/WSJT-X.git
Simplify and clean up some code in refspec.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7286 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
efb89c194d
commit
bb5d65dcfe
|
@ -1,44 +1,3 @@
|
||||||
/***************************************************************************
|
|
||||||
** **
|
|
||||||
** QCustomPlot, an easy to use, modern plotting widget for Qt **
|
|
||||||
** Copyright (C) 2011-2016 Emanuel Eichhammer **
|
|
||||||
** **
|
|
||||||
** This program is free software: you can redistribute it and/or modify **
|
|
||||||
** it under the terms of the GNU General Public License as published by **
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or **
|
|
||||||
** (at your option) any later version. **
|
|
||||||
** **
|
|
||||||
** This program is distributed in the hope that it will be useful, **
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
|
|
||||||
** GNU General Public License for more details. **
|
|
||||||
** **
|
|
||||||
** You should have received a copy of the GNU General Public License **
|
|
||||||
** along with this program. If not, see http://www.gnu.org/licenses/. **
|
|
||||||
** **
|
|
||||||
****************************************************************************
|
|
||||||
** Author: Emanuel Eichhammer **
|
|
||||||
** Website/Contact: http://www.qcustomplot.com/ **
|
|
||||||
** Date: 13.09.16 **
|
|
||||||
** Version: 2.0.0-beta **
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************************************
|
|
||||||
** **
|
|
||||||
** This is the example code for QCustomPlot. **
|
|
||||||
** **
|
|
||||||
** It demonstrates basic and some advanced capabilities of the widget. The interesting code is inside **
|
|
||||||
** the "setup(...)Demo" functions of MainWindow. **
|
|
||||||
** **
|
|
||||||
** In order to see a demo in action, call the respective "setup(...)Demo" function inside the **
|
|
||||||
** MainWindow constructor. Alternatively you may call setupDemo(i) where i is the index of the demo **
|
|
||||||
** you want (for those, see MainWindow constructor comments). All other functions here are merely a **
|
|
||||||
** way to easily create screenshots of all demos for the website. I.e. a timer is set to successively **
|
|
||||||
** setup all the demos and make a screenshot of the window area and save it in the ./screenshots **
|
|
||||||
** directory. **
|
|
||||||
** **
|
|
||||||
*************************************************************************************************************/
|
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -51,6 +10,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
#define NPTS 3456
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -59,7 +19,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setGeometry(400, 250, 542, 390);
|
setGeometry(400, 250, 542, 390);
|
||||||
|
|
||||||
setupDemo(0);
|
setupPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -67,24 +27,16 @@ MainWindow::~MainWindow()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupDemo(int demoIndex)
|
void MainWindow::setupPlot()
|
||||||
{
|
{
|
||||||
switch (demoIndex)
|
plotspec(ui->customPlot);
|
||||||
{
|
setWindowTitle("Reference Spectrum");
|
||||||
case 0: setupQuadraticDemo(ui->customPlot); break;
|
|
||||||
}
|
|
||||||
setWindowTitle("QCustomPlot: "+demoName);
|
|
||||||
statusBar()->clearMessage();
|
statusBar()->clearMessage();
|
||||||
currentDemoIndex = demoIndex;
|
|
||||||
ui->customPlot->replot();
|
ui->customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupQuadraticDemo(QCustomPlot *customPlot)
|
void MainWindow::plotspec(QCustomPlot *customPlot)
|
||||||
{
|
{
|
||||||
demoName = "Reference Spectrum";
|
|
||||||
|
|
||||||
#define NPTS 3456
|
|
||||||
|
|
||||||
QVector<double> x(NPTS), y1(NPTS), y2(NPTS), y3(NPTS), y4(NPTS);
|
QVector<double> x(NPTS), y1(NPTS), y2(NPTS), y3(NPTS), y4(NPTS);
|
||||||
ifstream inFile;
|
ifstream inFile;
|
||||||
double ymin=1.0e30;
|
double ymin=1.0e30;
|
||||||
|
@ -96,6 +48,7 @@ void MainWindow::setupQuadraticDemo(QCustomPlot *customPlot)
|
||||||
if(y2[i]>ymax) ymax=y2[i];
|
if(y2[i]>ymax) ymax=y2[i];
|
||||||
if(y2[i]<ymin) ymin=y2[i];
|
if(y2[i]<ymin) ymin=y2[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
customPlot->addGraph();
|
customPlot->addGraph();
|
||||||
customPlot->graph(0)->setData(x, y2);
|
customPlot->graph(0)->setData(x, y2);
|
||||||
customPlot->xAxis->setLabel("Frequency (Hz)");
|
customPlot->xAxis->setLabel("Frequency (Hz)");
|
||||||
|
|
|
@ -1,50 +1,9 @@
|
||||||
/***************************************************************************
|
|
||||||
** **
|
|
||||||
** QCustomPlot, an easy to use, modern plotting widget for Qt **
|
|
||||||
** Copyright (C) 2011-2016 Emanuel Eichhammer **
|
|
||||||
** **
|
|
||||||
** This program is free software: you can redistribute it and/or modify **
|
|
||||||
** it under the terms of the GNU General Public License as published by **
|
|
||||||
** the Free Software Foundation, either version 3 of the License, or **
|
|
||||||
** (at your option) any later version. **
|
|
||||||
** **
|
|
||||||
** This program is distributed in the hope that it will be useful, **
|
|
||||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
|
|
||||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
|
|
||||||
** GNU General Public License for more details. **
|
|
||||||
** **
|
|
||||||
** You should have received a copy of the GNU General Public License **
|
|
||||||
** along with this program. If not, see http://www.gnu.org/licenses/. **
|
|
||||||
** **
|
|
||||||
****************************************************************************
|
|
||||||
** Author: Emanuel Eichhammer **
|
|
||||||
** Website/Contact: http://www.qcustomplot.com/ **
|
|
||||||
** Date: 13.09.16 **
|
|
||||||
** Version: 2.0.0-beta **
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/************************************************************************************************************
|
|
||||||
** **
|
|
||||||
** This is the example code for QCustomPlot. **
|
|
||||||
** **
|
|
||||||
** It demonstrates basic and some advanced capabilities of the widget. The interesting code is inside **
|
|
||||||
** the "setup(...)Demo" functions of MainWindow. **
|
|
||||||
** **
|
|
||||||
** In order to see a demo in action, call the respective "setup(...)Demo" function inside the **
|
|
||||||
** MainWindow constructor. Alternatively you may call setupDemo(i) where i is the index of the demo **
|
|
||||||
** you want (for those, see MainWindow constructor comments). All other functions here are merely a **
|
|
||||||
** way to easily create screenshots of all demos for the website. I.e. a timer is set to successively **
|
|
||||||
** setup all the demos and make a screenshot of the window area and save it in the ./screenshots **
|
|
||||||
** directory. **
|
|
||||||
** **
|
|
||||||
*************************************************************************************************************/
|
|
||||||
|
|
||||||
#ifndef MAINWINDOW_H
|
#ifndef MAINWINDOW_H
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "qcustomplot.h" // the header file of QCustomPlot. Don't forget to add it to your project, if you use an IDE, so it gets compiled.
|
#include "qcustomplot.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
@ -58,15 +17,11 @@ public:
|
||||||
explicit MainWindow(QWidget *parent = 0);
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
void setupDemo(int demoIndex);
|
void setupPlot();
|
||||||
void setupQuadraticDemo(QCustomPlot *customPlot);
|
void plotspec(QCustomPlot *customPlot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QString demoName;
|
|
||||||
QTimer dataTimer;
|
|
||||||
QCPItemTracer *itemDemoPhaseTracer;
|
|
||||||
int currentDemoIndex;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 3.2.2, 2016-11-03T18:30:53. -->
|
<!-- Written by QtCreator 3.2.2, 2016-11-03T19:08:08. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|
Loading…
Reference in New Issue