Beispiel #1
1
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    QMenu *file;
    QMenu *edit;
    QMenu *effect;
    QMenu *tools;
    QMenu *help;
    QAction *newa = new QAction(tr("&New"), this);
    QAction *open = new QAction(tr("&Open"), this);
    QAction *save = new QAction(tr("&Save"), this);
    QAction *saveas = new QAction(tr("&Save as"), this);
    QAction *import = new QAction(tr("&Import sample"), this);
    QAction *quit = new QAction(tr("&Quit"), this);
    QAction *play = new QAction(tr("&Play"), this);
    QAction *stop = new QAction(tr("&Stop"), this);
    QAction *pause = new QAction(tr("&Pause"), this);
    QAction *record= new QAction(tr("&Record"), this);
    QAction *zoomin  = new QAction(tr("Zoom in"), this);
    QAction *zoomout = new QAction(tr("Zoom out"), this);
    QAction *settings = new QAction(tr("&Settings"), this);
    QToolBar *toolbar = addToolBar("Main ToolBar");
    QLCDNumber *lcd = new QLCDNumber();
    QLabel * play_v = new QLabel(), * rec_v = new QLabel();
    QSlider * play_slider = new QSlider(Qt::Horizontal), * rec_slider = new QSlider(Qt::Horizontal);
    wave = new Wave();
    fileName = "";
    changed = false;
    newa->setIcon(QIcon::fromTheme("document-new"));
    newa->setShortcut(tr("CTRL+N"));
    open->setIcon(QIcon::fromTheme("document-open"));
    open->setShortcut(tr("CTRL+O"));
    save->setIcon(QIcon::fromTheme("document-save"));
    save->setShortcut(tr("CTRL+S"));
    saveas->setIcon(QIcon::fromTheme("document-save-as"));
    import->setIcon(QIcon::fromTheme("audio-x-generic"));
    zoomin->setIcon(QIcon::fromTheme("zoom-in"));
    zoomin->setShortcut(tr("CTRL+Up"));
    zoomout->setIcon(QIcon::fromTheme("zoom-out"));
    zoomout->setShortcut(tr("CTRL+Down"));
    play->setIcon(QIcon::fromTheme("media-playback-start"));
    play->setShortcut(tr("Space"));
    play->setCheckable(true);
    stop->setIcon(QIcon::fromTheme("media-playback-stop"));
    pause->setIcon(QIcon::fromTheme("media-playback-pause"));
    record->setIcon(QIcon::fromTheme("media-record"));
    record->setShortcut(tr("Ctrl+Space"));
    record->setCheckable(true);
    quit->setIcon(QIcon::fromTheme("application-exit"));
    quit->setShortcut(tr("CTRL+Q"));
    lcd->setDigitCount(8);
    lcd->display("00:00:00");
    lcd->setStyleSheet("background: black; color: #00FF00");
    lcd->setFixedSize(100, 30);
    play_v->setText(tr("Playback volume:"));
    rec_v->setText(tr("Record volume:"));
    play_slider->setMaximumWidth(50);
    play_slider->setRange(0, 100);
    rec_slider->setMaximumWidth(50);
    rec_slider->setRange(0, 100);
    file = menuBar()->addMenu(tr("&File"));
    file->addAction(newa);
    file->addAction(open);
    file->addAction(save);
    file->addAction(saveas);
    file->addSeparator();
    file->addAction(import);
    file->addSeparator();
    file->addAction(quit);
    edit = menuBar()->addMenu(tr("&Edit"));
    effect = menuBar()->addMenu(tr("&Effects"));
    tools = menuBar()->addMenu(tr("&Tools"));
    settings->setIcon(QIcon::fromTheme("multimedia-volume-control"));
    tools->addAction(settings);
    help = menuBar()->addMenu(tr("&Help"));

    toolbar->addAction(newa);
    toolbar->addAction(open);
    toolbar->addAction(save);
    toolbar->addSeparator();
    toolbar->addAction(import);
    toolbar->addAction(zoomin);
    toolbar->addAction(zoomout);
    toolbar->addSeparator();
    toolbar->addAction(stop);
    toolbar->addAction(pause);
    toolbar->addAction(play);
    toolbar->addAction(record);
    toolbar->addSeparator();
    toolbar->addWidget(play_v);
    toolbar->addWidget(play_slider);
    toolbar->addWidget(rec_v);
    toolbar->addWidget(rec_slider);
    toolbar->addWidget(lcd);
    connect(newa, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(open, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(save, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(saveas, SIGNAL(triggered()), this, SLOT(saveFileAs()));
    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));

    connect(zoomin, SIGNAL(triggered()), this, SLOT(zoomIn()));
    connect(zoomout, SIGNAL(triggered()), this, SLOT(zoomOut()));

    connect(settings, SIGNAL(triggered()), this, SLOT(settings()));
    setCentralWidget(wave);
    float * buffer;
    buffer = (float*)malloc(44100*sizeof(float));
    for (unsigned int i=0; i<44100; i++)
    {
        buffer[i]=sin(1*(2*M_PI)*i/44100);
    }
    wave->setSampleRate(44100);
    wave->setBytesPerSecond(1000);
    wave->setBuffer(buffer, 44100);
}
Beispiel #2
0
void BoardingTable::init() {

    Line l;

    QStringList names = l.getCapteursNames();
    QStringList values = l.getValueNames();
    for(int i=1;i<=names.size();i++) {

        QGroupBox* g = new QGroupBox(names[i-1]);
        QGridLayout* l = new QGridLayout;

        g->setLayout(l);

        capteurs_layouts.append(l);
        m_container->addWidget(g, (int)((i-1)/2) , (i-1)%2);
    }

    for(int c=0;c<capteurs_layouts.size();c++) {
        for(int v = 0; v < 10; v++) {
            if(values[c*10+v] != "-1") {
                QLabel *l = new QLabel(values[c*10+v]);
                capteurs_layouts[c]->addWidget(l,v,0);

                QLCDNumber *lcd = new QLCDNumber(8);
                lcd->display(42);
                valeurs.append(lcd);
                capteurs_layouts[c]->addWidget(lcd,v,1);

            }
        }
    }
}
Beispiel #3
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	QMainWindow *window = new QMainWindow();    
    
        window->setWindowTitle(QString::fromUtf8("QLCDnumber Show Milliseconds Time"));
        window->resize(800, 250);
	QWidget* centralWidget = new QWidget();
	
	QVBoxLayout* verticalLayout = new QVBoxLayout();
	centralWidget->setLayout(verticalLayout);
        
	QLCDNumber *number = new QLCDNumber();	
	
	verticalLayout->addWidget(number);
	
	
	number->setFixedSize(-800, 245);
	number->setDigitCount(12);
	number->display(QTime::currentTime().toString(QString("hh:mm:ss.zzz")));
	
	
	window->setCentralWidget(centralWidget);
	window->show();
	return app.exec();
}
Beispiel #4
0
QObject *PluginFactory::create( const QString &mimeType, const QUrl &url,
                                const QStringList &argumentNames, const QStringList &argumentValues ) const
{
    qDebug() << "create" << mimeType << "for url" << url;
    QLCDNumber *lcd = new QLCDNumber();
    lcd->display(123);

    return lcd;
}
void MainWindow::onMotorPowerChange(FlightControl::Motor motor, float power)
{
	QLCDNumber* lcd;
	switch (motor) {
		case FlightControl::MotorX1: lcd = m_ui->motor_x1; break;
		case FlightControl::MotorX2: lcd = m_ui->motor_x2; break;
		case FlightControl::MotorY1: lcd = m_ui->motor_y1; break;
		case FlightControl::MotorY2: lcd = m_ui->motor_y2; break;
		case FlightControl::MotorAll: lcd = m_ui->motor_all; break;
	}
	lcd->display(power);
}
Beispiel #6
0
LCDRange::LCDRange(QWidget *parent)
    :QWidget(parent)
{
    QLCDNumber *lcd = new QLCDNumber(2);
    lcd->setSegmentStyle(QLCDNumber::Flat);
    //lcd->setSegmentStyle(QLCDNumber::Filled);
    lcd->setNumDigits(3);
    lcd->display(5);

    QSlider *slider = new QSlider(Qt::Horizontal);
    slider->setRange(0, 199);
    //slider->sizeHint();
    //slider->minimumSizeHint();
    slider->setValue(5);

    connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
    connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(lcd);
    layout->addWidget(slider);
    setLayout(layout);
}
Beispiel #7
0
int main(int argc, char **argv) {
  QApplication app(argc, argv);

  QDial *dial = new QDial();
  dial->show();

  QLCDNumber *lcdnumber = new QLCDNumber();
  lcdnumber->display(12345);
  lcdnumber->show();

  QSlider *slider = new QSlider(Qt::Horizontal);
  slider->show();
  
  QHBoxLayout *hbox = new QHBoxLayout();
  QPushButton *button = new QPushButton("Push Me");
  QLineEdit *input = new QLineEdit();
  hbox->addWidget(button);
  hbox->addWidget(input);
  QWidget *widget = new QWidget();
  widget->setLayout(hbox);
  widget->show();

  return app.exec();
}
void DataWidget::setValue(double value)
{
    switch (_dataDescription->widget)
    {
    case DATA_WIDGET_PLOT:
	{
            QwtPlot *widget = qobject_cast<QwtPlot*> (_internalWidget);
            if (widget != 0)
            {
                _curveData->xData->append(_mainWindow->effectiveRunningTime());
                _curveData->yData->append(value);
#if QWT_VERSION >= 0x060000
                _curve->setRawSamples(_curveData->xData->data(),
                                      _curveData->yData->data(), _curveData->xData->size());
#else
#  warning Old version of qwt being used, data aggregator will not work.
#endif
                widget->replot();
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_LCD:
	{
            QLCDNumber *widget = qobject_cast<QLCDNumber*> (_internalWidget);
            if (widget != 0)
            {
                widget->display(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_LEVEL:
	{
            QwtThermo *widget = qobject_cast<QwtThermo*> (_internalWidget);
            if (widget != 0)
            {
                widget->setValue(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_DIAL:
	{
            QwtDial *widget = qobject_cast<QwtDial*> (_internalWidget);
            if (widget != 0)
            {
                widget->setValue(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    default:
        ;
    }

    emit valueChanged(value, _dataDescription->id);
}