Show main.cpp syntax highlighted
#include <qapplication.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include "plot.h"
class MainWindow: public QMainWindow
{
public:
MainWindow(QWidget * = NULL);
private:
Plot *d_plot;
};
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent)
{
d_plot = new Plot(this);
setCentralWidget(d_plot);
QToolBar *toolBar = new QToolBar(this);
QToolButton *btnSpectrogram = new QToolButton(toolBar);
QToolButton *btnContour = new QToolButton(toolBar);
#if QT_VERSION >= 0x040000
btnSpectrogram->setText("Spectrogram");
//btnSpectrogram->setIcon(QIcon());
btnSpectrogram->setCheckable(true);
btnSpectrogram->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
toolBar->addWidget(btnSpectrogram);
btnContour->setText("Contour");
//btnContour->setIcon(QIcon());
btnContour->setCheckable(true);
btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
toolBar->addWidget(btnContour);
#else
btnSpectrogram->setTextLabel("Spectrogram");
//btnSpectrogram->setPixmap(zoom_xpm);
btnSpectrogram->setToggleButton(true);
btnSpectrogram->setUsesTextLabel(true);
btnContour->setTextLabel("Contour");
//btnContour->setPixmap(zoom_xpm);
btnContour->setToggleButton(true);
btnContour->setUsesTextLabel(true);
#endif
addToolBar(toolBar);
connect(btnSpectrogram, SIGNAL(toggled(bool)),
d_plot, SLOT(showSpectrogram(bool)));
connect(btnContour, SIGNAL(toggled(bool)),
d_plot, SLOT(showContour(bool)));
#if QT_VERSION >= 0x040000
btnSpectrogram->setChecked(true);
btnContour->setChecked(false);
#else
btnSpectrogram->setOn(true);
btnContour->setOn(false);
#endif
}
int main(int argc, char **argv)
{
QApplication a(argc, argv);
MainWindow mainWindow;
#if QT_VERSION < 0x040000
a.setMainWidget(&mainWindow);
#endif
mainWindow.resize(600,400);
mainWindow.show();
return a.exec();
}
See more files for this project here
Marsyas (Music Analysis, Retrieval and Synthesis for Audio Signals) is a framework for developing systems for audio processing. It provides an general architecture for connecting audio, soundfiles, signal processing blocks and machine learning.
Project homepage:
http://sourceforge.net/projects/marsyas
Programming language(s): C++
License: other
moc/
moc_plot.cpp
main.cpp
plot.cpp
plot.h
spectrogram.pro