Пример #1
0
void CMainWindow::on_actOpenFile_triggered(bool) {
    if(!isOpenFileUnsaved || QMessageBox::question(this, tr("Confirmation"), tr("Current file not save, open other ?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
        QString fileName = QFileDialog::getOpenFileName(this, tr("Open qtdrum file"), QString(), tr("qtdum file (*.qdr)"));

        if(!fileName.isEmpty()) {
            QFile file(fileName);

            if(file.open(QIODevice::ReadOnly)) {
                QTextStream stream(&file);
                QString fileContent;

                fileContent = stream.readAll();

                if(loadFile(fileContent)) {
                    QFileInfo fileInfo(file);

                    isOpenFileUnsaved = false;
                    setOpenFileName(fileInfo.fileName(), fullOpenFileName);
                }

                 file.close();
            }else {
                QMessageBox::critical(this, tr("Error"), tr("Unable to load file"));
                return;
            }
        }
    }
}
Пример #2
0
int Dialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setInteger(); break;
        case 1: setDouble(); break;
        case 2: setItem(); break;
        case 3: setText(); break;
        case 4: setColor(); break;
        case 5: setFont(); break;
        case 6: setExistingDirectory(); break;
        case 7: setOpenFileName(); break;
        case 8: setOpenFileNames(); break;
        case 9: setSaveFileName(); break;
        case 10: criticalMessage(); break;
        case 11: informationMessage(); break;
        case 12: questionMessage(); break;
        case 13: warningMessage(); break;
        case 14: errorMessage(); break;
        default: ;
        }
        _id -= 15;
    }
    return _id;
}
Пример #3
0
void CMainWindow::on_actNewFile_triggered(bool) {
    if(!isOpenFileUnsaved || QMessageBox::question(this, tr("Confirmation"), tr("Current file not save, create new ?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
        isOpenFileUnsaved = false;
        setOpenFileName("unamed.qdr", "unamed.qdr");

        drumWidget->clear();
    }
}
Пример #4
0
/*!
  Default Constructor for LoadPage class
*/
LoadPage::LoadPage(QWidget *parent) : QWizardPage(parent)
{
     setTitle(tr("Configuration Wizard"));
     setSubTitle(tr("Select a user database to load..."));
     fileToLoad = new QLineEdit;
     btnLoadFile = new QPushButton("Load file...");
     QGridLayout *layout = new QGridLayout;
     layout->addWidget(fileToLoad, 0, 0);
     layout->addWidget(btnLoadFile, 0, 1);
     setLayout(layout);
     connect(btnLoadFile, SIGNAL(clicked()), this, SLOT(setOpenFileName()));

}
Пример #5
0
int TextureEffectPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setOpenFileName(); break;
        case 1: checkboxGroupStateChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: checkboxVideoStateChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: comboObjectsChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Пример #6
0
void CMainWindow::on_actSaveAs_triggered(bool) {
    QString fileName = QFileDialog::getSaveFileName(this, tr("Open qtdrum file"), fullOpenFileName, tr("qtdum file (*.qdr)"), 0, QFileDialog::DontConfirmOverwrite);

    if(!fileName.isEmpty()) {
        QFileInfo fileInfo(fileName);

        if(fileInfo.completeSuffix().isEmpty()) {
            fileName += ".qdr";
            fileInfo = QFileInfo(fileName);
        }

        if(saveFile(fileName)) {
            isOpenFileUnsaved = false;
            setOpenFileName(fileInfo.fileName(), fileName);
        }
    }
}
Пример #7
0
Dialogs::Dialogs(QWidget *parent)
   : QWidget(parent), ui(new Ui::Dialogs)
{
   ui->setupUi(this);
   setWindowTitle(tr("Standard Dialogs"));

   ui->native_checkBox->setChecked(true);

   // signals
   connect(ui->integer_pushButton,    SIGNAL(clicked()), this, SLOT(setInteger()));
   connect(ui->double_pushButton,     SIGNAL(clicked()), this, SLOT(setDouble()));
   connect(ui->getItem_pushButton,    SIGNAL(clicked()), this, SLOT(setItem()));
   connect(ui->getText_pushButton,    SIGNAL(clicked()), this, SLOT(setText()));

   connect(ui->dir_pushButton,        SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
   connect(ui->openFile_pushButton,   SIGNAL(clicked()), this, SLOT(setOpenFileName()));
   connect(ui->openFiles_pushButton,  SIGNAL(clicked()), this, SLOT(setOpenFileNames()));

   connect(ui->critical_pushButton,   SIGNAL(clicked()), this, SLOT(criticalMessage()));
   connect(ui->info_pushButton,       SIGNAL(clicked()), this, SLOT(informationMessage()));
   connect(ui->quest_pushButton,      SIGNAL(clicked()), this, SLOT(questionMessage()));
   connect(ui->warn_pushButton,       SIGNAL(clicked()), this, SLOT(warningMessage()));
   connect(ui->error_pushButton,      SIGNAL(clicked()), this, SLOT(errorMessage()));
}
Пример #8
0
void deviceWidget::loadFirmware()
{
    myDevice->verticalGroupBox_loaded->setVisible(false);
    myDevice->groupCustom->setVisible(false);

    filename = setOpenFileName();

    if (filename.isEmpty()) {
        status("Empty filename", STATUSICON_FAIL);
        return;
    }

    QFile file(filename);
    if (!file.open(QIODevice::ReadOnly)) {
        status("Can't open file", STATUSICON_FAIL);
        return;
    }

    loadedFW = file.readAll();
    myDevice->youdont->setVisible(false);
    myDevice->youdont->setChecked(false);
    QByteArray desc = loadedFW.right(100);
    QPixmap px;
    if(loadedFW.length()>m_dfu->devices[deviceID].SizeOfCode)
        myDevice->lblCRCL->setText(tr("Can't calculate, file too big for device"));
    else
        myDevice->lblCRCL->setText( QString::number(DFUObject::CRCFromQBArray(loadedFW,m_dfu->devices[deviceID].SizeOfCode)));
    //myDevice->lblFirmwareSizeL->setText(QString("Firmware size: ")+QVariant(loadedFW.length()).toString()+ QString(" bytes"));
    if (populateLoadedStructuredDescription(desc))
    {
        myDevice->youdont->setChecked(true);
        myDevice->verticalGroupBox_loaded->setVisible(true);
        myDevice->groupCustom->setVisible(false);
        if(myDevice->lblCRC->text()==myDevice->lblCRCL->text())
        {
            myDevice->statusLabel->setText(tr("The board has the same firmware as loaded. No need to update"));
            px.load(QString(":/uploader/images/warning.svg"));
        }
        else if(myDevice->lblDevName->text()!=myDevice->lblBrdNameL->text())
        {
            myDevice->statusLabel->setText(tr("WARNING: the loaded firmware is for different hardware. Do not update!"));
            px.load(QString(":/uploader/images/error.svg"));
        }
        else if(QDateTime::fromString(onBoardDescription.gitDate)>QDateTime::fromString(LoadedDescription.gitDate))
        {
            myDevice->statusLabel->setText(tr("The board has newer firmware than loaded. Are you sure you want to update?"));
            px.load(QString(":/uploader/images/warning.svg"));
        }
        else if(!LoadedDescription.gitTag.startsWith("RELEASE",Qt::CaseSensitive))
        {
            myDevice->statusLabel->setText(tr("The loaded firmware is untagged or custom build. Update only if it was received from a trusted source (official website or your own build)"));
            px.load(QString(":/uploader/images/warning.svg"));
        }
        else
        {
            myDevice->statusLabel->setText(tr("This is the tagged officially released OpenPilot firmware"));
            px.load(QString(":/uploader/images/gtk-info.svg"));
        }
    }
    else
    {
        myDevice->statusLabel->setText(tr("WARNING: the loaded firmware was not packaged with the OpenPilot format. Do not update unless you know what you are doing"));
        px.load(QString(":/uploader/images/error.svg"));
        myDevice->youdont->setChecked(false);
        myDevice->youdont->setVisible(true);
        myDevice->verticalGroupBox_loaded->setVisible(false);
        myDevice->groupCustom->setVisible(true);
    }
    myDevice->statusIcon->setPixmap(px);
    //myDevice->updateButton->setEnabled(true);

}
Пример #9
0
Dialog::Dialog(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    QToolBox *toolbox = new QToolBox;
    mainLayout->addWidget(toolbox);

    errorMessageDialog = new QErrorMessage(this);

    int frameStyle = QFrame::Sunken | QFrame::Panel;

    integerLabel = new QLabel;
    integerLabel->setFrameStyle(frameStyle);
    QPushButton *integerButton =
            new QPushButton(tr("QInputDialog::get&Int()"));

    doubleLabel = new QLabel;
    doubleLabel->setFrameStyle(frameStyle);
    QPushButton *doubleButton =
            new QPushButton(tr("QInputDialog::get&Double()"));

    itemLabel = new QLabel;
    itemLabel->setFrameStyle(frameStyle);
    QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));

    textLabel = new QLabel;
    textLabel->setFrameStyle(frameStyle);
    QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));

    multiLineTextLabel = new QLabel;
    multiLineTextLabel->setFrameStyle(frameStyle);
    QPushButton *multiLineTextButton = new QPushButton(tr("QInputDialog::get&MultiLineText()"));

    colorLabel = new QLabel;
    colorLabel->setFrameStyle(frameStyle);
    QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));

    fontLabel = new QLabel;
    fontLabel->setFrameStyle(frameStyle);
    QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));

    directoryLabel = new QLabel;
    directoryLabel->setFrameStyle(frameStyle);
    QPushButton *directoryButton =
            new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));

    openFileNameLabel = new QLabel;
    openFileNameLabel->setFrameStyle(frameStyle);
    QPushButton *openFileNameButton =
            new QPushButton(tr("QFileDialog::get&OpenFileName()"));

    openFileNamesLabel = new QLabel;
    openFileNamesLabel->setFrameStyle(frameStyle);
    QPushButton *openFileNamesButton =
            new QPushButton(tr("QFileDialog::&getOpenFileNames()"));

    saveFileNameLabel = new QLabel;
    saveFileNameLabel->setFrameStyle(frameStyle);
    QPushButton *saveFileNameButton =
            new QPushButton(tr("QFileDialog::get&SaveFileName()"));

    criticalLabel = new QLabel;
    criticalLabel->setFrameStyle(frameStyle);
    QPushButton *criticalButton =
            new QPushButton(tr("QMessageBox::critica&l()"));

    informationLabel = new QLabel;
    informationLabel->setFrameStyle(frameStyle);
    QPushButton *informationButton =
            new QPushButton(tr("QMessageBox::i&nformation()"));

    questionLabel = new QLabel;
    questionLabel->setFrameStyle(frameStyle);
    QPushButton *questionButton =
            new QPushButton(tr("QMessageBox::&question()"));

    warningLabel = new QLabel;
    warningLabel->setFrameStyle(frameStyle);
    QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));

    errorLabel = new QLabel;
    errorLabel->setFrameStyle(frameStyle);
    QPushButton *errorButton =
            new QPushButton(tr("QErrorMessage::showM&essage()"));

    connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
    connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
    connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
    connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
    connect(multiLineTextButton, SIGNAL(clicked()), this, SLOT(setMultiLineText()));
    connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
    connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
    connect(directoryButton, SIGNAL(clicked()),
            this, SLOT(setExistingDirectory()));
    connect(openFileNameButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileName()));
    connect(openFileNamesButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileNames()));
    connect(saveFileNameButton, SIGNAL(clicked()),
            this, SLOT(setSaveFileName()));
    connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
    connect(informationButton, SIGNAL(clicked()),
            this, SLOT(informationMessage()));
    connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
    connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
    connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));

    QWidget *page = new QWidget;
    QGridLayout *layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->setColumnMinimumWidth(1, 250);
    layout->addWidget(integerButton, 0, 0);
    layout->addWidget(integerLabel, 0, 1);
    layout->addWidget(doubleButton, 1, 0);
    layout->addWidget(doubleLabel, 1, 1);
    layout->addWidget(itemButton, 2, 0);
    layout->addWidget(itemLabel, 2, 1);
    layout->addWidget(textButton, 3, 0);
    layout->addWidget(textLabel, 3, 1);
    layout->addWidget(multiLineTextButton, 4, 0);
    layout->addWidget(multiLineTextLabel, 4, 1);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
    toolbox->addItem(page, tr("Input Dialogs"));

    const QString doNotUseNativeDialog = tr("Do not use native dialog");

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(colorButton, 0, 0);
    layout->addWidget(colorLabel, 0, 1);
    colorDialogOptionsWidget = new DialogOptionsWidget;
    colorDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QColorDialog::DontUseNativeDialog);
    colorDialogOptionsWidget->addCheckBox(tr("Show alpha channel") , QColorDialog::ShowAlphaChannel);
    colorDialogOptionsWidget->addCheckBox(tr("No buttons") , QColorDialog::NoButtons);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
    layout->addWidget(colorDialogOptionsWidget, 2, 0, 1 ,2);

    toolbox->addItem(page, tr("Color Dialog"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(fontButton, 0, 0);
    layout->addWidget(fontLabel, 0, 1);
    fontDialogOptionsWidget = new DialogOptionsWidget;
    fontDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QFontDialog::DontUseNativeDialog);
    fontDialogOptionsWidget->addCheckBox(tr("No buttons") , QFontDialog::NoButtons);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 1, 0);
    layout->addWidget(fontDialogOptionsWidget, 2, 0, 1 ,2);
    toolbox->addItem(page, tr("Font Dialog"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(directoryButton, 0, 0);
    layout->addWidget(directoryLabel, 0, 1);
    layout->addWidget(openFileNameButton, 1, 0);
    layout->addWidget(openFileNameLabel, 1, 1);
    layout->addWidget(openFileNamesButton, 2, 0);
    layout->addWidget(openFileNamesLabel, 2, 1);
    layout->addWidget(saveFileNameButton, 3, 0);
    layout->addWidget(saveFileNameLabel, 3, 1);
    fileDialogOptionsWidget = new DialogOptionsWidget;
    fileDialogOptionsWidget->addCheckBox(doNotUseNativeDialog, QFileDialog::DontUseNativeDialog);
    fileDialogOptionsWidget->addCheckBox(tr("Show directories only"), QFileDialog::ShowDirsOnly);
    fileDialogOptionsWidget->addCheckBox(tr("Do not resolve symlinks"), QFileDialog::DontResolveSymlinks);
    fileDialogOptionsWidget->addCheckBox(tr("Do not confirm overwrite"), QFileDialog::DontConfirmOverwrite);
    fileDialogOptionsWidget->addCheckBox(tr("Do not use sheet"), QFileDialog::DontUseSheet);
    fileDialogOptionsWidget->addCheckBox(tr("Readonly"), QFileDialog::ReadOnly);
    fileDialogOptionsWidget->addCheckBox(tr("Hide name filter details"), QFileDialog::HideNameFilterDetails);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 4, 0);
    layout->addWidget(fileDialogOptionsWidget, 5, 0, 1 ,2);
    toolbox->addItem(page, tr("File Dialogs"));

    page = new QWidget;
    layout = new QGridLayout(page);
    layout->setColumnStretch(1, 1);
    layout->addWidget(criticalButton, 0, 0);
    layout->addWidget(criticalLabel, 0, 1);
    layout->addWidget(informationButton, 1, 0);
    layout->addWidget(informationLabel, 1, 1);
    layout->addWidget(questionButton, 2, 0);
    layout->addWidget(questionLabel, 2, 1);
    layout->addWidget(warningButton, 3, 0);
    layout->addWidget(warningLabel, 3, 1);
    layout->addWidget(errorButton, 4, 0);
    layout->addWidget(errorLabel, 4, 1);
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding), 5, 0);
    toolbox->addItem(page, tr("Message Boxes"));

    setWindowTitle(tr("Standard Dialogs"));
}
Пример #10
0
Dialog::Dialog(QWidget *parent)
	: QDialog(parent)
{
	errorMessageDialog = new QErrorMessage(this);
	
	int frameStyle = QFrame::Sunken | QFrame::Panel;
	
	integerLabel = new QLabel;
	integerLabel->setFrameStyle(frameStyle);
	
	QPushButton *integerButton = new QPushButton(tr("QInputDialog::get&Integer()"));
	
	doubleLabel = new QLabel;
	doubleLabel->setFrameStyle(frameStyle);
	QPushButton *doubleButton = new QPushButton(tr("QInputDialog::get&Double()"));
	
	itemLabel = new QLabel;
	itemLabel->setFrameStyle(frameStyle);
	QPushButton *itemButton = new QPushButton(tr("QInputDialog::getIte&m()"));
	
	textLabel = new QLabel;
	textLabel->setFrameStyle(frameStyle);
	QPushButton *textButton = new QPushButton(tr("QInputDialog::get&Text()"));
	
	colorLabel= new QLabel;
	colorLabel->setFrameStyle(frameStyle);
	QPushButton *colorButton = new QPushButton(tr("QColorDialog::get&Color()"));
	
	fontLabel = new QLabel;
	fontLabel->setFrameStyle(frameStyle);
	QPushButton *fontButton = new QPushButton(tr("QFontDialog::get&Font()"));
	
	directoryLabel = new QLabel;
	directoryLabel->setFrameStyle(frameStyle);
	QPushButton *directoryButton = new QPushButton(tr("QFileDialog::getE&xistingDirectory()"));

	openFileNameLabel = new QLabel;
	openFileNameLabel->setFrameStyle(frameStyle);
	QPushButton *openFileNameButton = new QPushButton(tr("QFileDialog::get&OpenFileName()"));
	
	openFileNamesLabel = new QLabel;
	openFileNamesLabel->setFrameStyle(frameStyle);
	QPushButton *openFileNamesButton = new QPushButton(tr("QFileDialog::&getOpenFileNames()"));

	
	saveFileNameLabel = new QLabel;
	saveFileNameLabel->setFrameStyle(frameStyle);
	QPushButton *saveFileNameButton = new QPushButton(tr("QFileDialog::get&SaveFileName()"));

	criticalLabel = new QLabel;
	criticalLabel->setFrameStyle(frameStyle);
	QPushButton *criticalButton = new QPushButton(tr("QMessageBox::critica&l()"));

	informationLabel = new QLabel;
	informationLabel->setFrameStyle(frameStyle);
	QPushButton *informationButton = new QPushButton(tr("QMessageBox::i&nformation()"));

	questionLabel = new QLabel;
	questionLabel->setFrameStyle(frameStyle);
	QPushButton *questionButton = new QPushButton(tr("QMessageBox::&question()"));

	warningLabel = new QLabel;
	warningLabel->setFrameStyle(frameStyle);
	QPushButton *warningButton = new QPushButton(tr("QMessageBox::&warning()"));
	
	errorLabel = new QLabel;
	errorLabel->setFrameStyle(frameStyle);
	QPushButton *errorButton = new QPushButton(tr("QMessageBox::&error()"));
	
	connect(integerButton, SIGNAL(clicked()), this, SLOT(setInteger()));
	connect(doubleButton, SIGNAL(clicked()), this, SLOT(setDouble()));
	connect(itemButton, SIGNAL(clicked()), this, SLOT(setItem()));
	connect(textButton, SIGNAL(clicked()), this, SLOT(setText()));
	connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
	connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
	connect(directoryButton, SIGNAL(clicked()), this, SLOT(setExistingDirectory()));
	connect(openFileNameButton, SIGNAL(clicked()), this, SLOT(setOpenFileName()));
	connect(openFileNamesButton, SIGNAL(clicked()), this, SLOT(setOpenFileNames()));
	connect(saveFileNameButton, SIGNAL(clicked()), this, SLOT(setSaveFileName()));
	connect(criticalButton, SIGNAL(clicked()), this, SLOT(criticalMessage()));
	connect(informationButton, SIGNAL(clicked()), this, SLOT(informationMessage()));
	connect(questionButton, SIGNAL(clicked()), this, SLOT(questionMessage()));
	connect(warningButton, SIGNAL(clicked()), this, SLOT(warningMessage()));
	connect(errorButton, SIGNAL(clicked()), this, SLOT(errorMessage()));

	native = new QCheckBox(this);
	native->setText("Use native file dialog");
	native->setChecked(true);

#ifndef Q_WS_WIN
#ifndef Q_OS_MAC

	native->hide();
#endif
#endif

	QGridLayout *layout = new QGridLayout;
	layout->setColumnStretch(1, 1);		
	layout->setColumnMinimumWidth(1, 250);
	layout->addWidget(integerButton, 0, 0);
	layout->addWidget(integerLabel, 0, 1);
	layout->addWidget(doubleButton, 1, 0);
	layout->addWidget(doubleLabel, 1, 1);
	layout->addWidget(itemButton, 2, 0);
	layout->addWidget(itemLabel, 2, 1);
	layout->addWidget(textButton, 3, 0);
	layout->addWidget(textLabel, 3, 1);
	layout->addWidget(colorButton, 4, 0);
	layout->addWidget(colorLabel, 4, 1);
	layout->addWidget(fontButton, 5, 0);
	layout->addWidget(fontLabel, 5, 1);
	layout->addWidget(directoryButton, 6, 0);
	layout->addWidget(directoryLabel, 6, 1);
	layout->addWidget(openFileNameButton, 7, 0);
	layout->addWidget(openFileNameLabel, 7, 1);
	layout->addWidget(openFileNamesButton, 8, 0);
	layout->addWidget(openFileNamesLabel, 8, 1);
	layout->addWidget(saveFileNameButton, 9, 0);
	layout->addWidget(saveFileNameLabel, 9, 1);
	layout->addWidget(criticalButton, 10, 0);
	layout->addWidget(criticalLabel, 10, 1);
	layout->addWidget(informationButton, 11, 0);
	layout->addWidget(informationLabel, 11, 1);
	layout->addWidget(questionButton, 12, 0);
	layout->addWidget(questionLabel, 12, 1);
	layout->addWidget(warningButton, 13, 0);
	layout->addWidget(warningLabel, 13, 1);
	layout->addWidget(errorButton, 14, 0);
	layout->addWidget(errorLabel, 14, 1);

	layout->addWidget(native, 15, 0);

	setLayout(layout);

	setWindowTitle("Standard Dialogs");
}
Пример #11
0
FaxPanel::FaxPanel(QWidget *parent)
    : XLet(parent), m_mainwindow(parent)
{
    // qDebug() << Q_FUNC_INFO << parent;
    setTitle( tr("Fax") );

    QVBoxLayout * vlayout = new QVBoxLayout(this);

    //
    QGroupBox * groupBox1 = new QGroupBox( tr("Choose Destination Number") );
    groupBox1->setAlignment( Qt::AlignLeft );
    QHBoxLayout * hbox1 = new QHBoxLayout( groupBox1 );

    QLabel * lblfax = new QLabel(tr("Fax Number"), this);
    m_destination = new QLineEdit(this);
    QPushButton * directory = new QPushButton( tr("Directory"), this);
    connect(directory, SIGNAL(clicked()),
            this, SLOT(dirLookup()));
    connect(m_destination, SIGNAL(textChanged(const QString &)),
            this, SLOT(destNumberChanged(const QString &)));
    hbox1->addWidget(lblfax);
    hbox1->addWidget(m_destination);
    hbox1->addWidget(directory);
    lblfax->setObjectName("fax");

    //
    QGroupBox * groupBox2 = new QGroupBox( tr("Choose File to Send") );
    groupBox2->setAlignment( Qt::AlignLeft );
    QHBoxLayout * hbox2 = new QHBoxLayout( groupBox2 );
    m_openFileNameLabel = new FileNameLineEdit(this);
    connect(m_openFileNameLabel, SIGNAL(textChanged(const QString &)),
            this, SLOT(fileNameChanged(const QString &)));
    QPushButton * openFileNamesButton = new QPushButton( tr("Browse"), this);
    connect(openFileNamesButton, SIGNAL(clicked()),
            this, SLOT(setOpenFileName()));
    hbox2->addWidget(m_openFileNameLabel);
    hbox2->addWidget(openFileNamesButton);

    //
    QGroupBox * groupBox3 = new QGroupBox( tr("Hide the Number ?") );
    groupBox3->setAlignment( Qt::AlignLeft );
    QHBoxLayout * hbox3 = new QHBoxLayout( groupBox3 );

    m_maskornot = new QCheckBox(tr("Hide Number"), this);
    //int previous_hide = b_engine->getSettings()->value("faxhistory/hidenumber", 0).toUInt();
    //m_maskornot->setCheckState((Qt::CheckState)previous_hide);
    m_maskornot->setCheckState(Qt::Unchecked);
    hbox3->addStretch(1);
    hbox3->addWidget(m_maskornot);
    hbox3->addStretch(1);

    //
    QGroupBox * groupBox4 = new QGroupBox( tr("Send your File") );
    groupBox4->setAlignment( Qt::AlignLeft );
    QHBoxLayout * hbox4 = new QHBoxLayout( groupBox4 );

    m_sendButton = new QPushButton( tr("Send"), this);
    m_sendButton->setEnabled(false);
    connect(m_sendButton, SIGNAL(clicked()),
            this, SLOT(sendFax()));
    hbox4->addStretch(1);
    hbox4->addWidget(m_sendButton);
    hbox4->addStretch(1);

    vlayout->addWidget(groupBox1);
    vlayout->addWidget(groupBox2);
    //vlayout->addWidget(groupBox3);
    vlayout->addWidget(groupBox4);
    vlayout->addStretch(1);

    // connect signals / slots
    connect( b_engine, SIGNAL(ackFax(const QString &, const QString &)),
             this, SLOT(popupMsg(const QString &, const QString &)) );
}
Пример #12
0
CMainWindow::CMainWindow(QWidget *parent) : QMainWindow(parent) {
    setupUi(this);

    pads = emptyList()  << SPad(QString::fromUtf8("Bass Drum 2"), 35, QByteArray("1000000110100000"))
                        << SPad(QString::fromUtf8("Bass Drum 1"), 36, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Side Stick/Rimshot"), 37, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Snare Drum 1"), 38, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Hand Clap"), 39, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Snare Drum 2"), 40, QByteArray("0000100000001000"))
                        << SPad(QString::fromUtf8("Low Tom 2"), 41, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Closed Hi-hat"), 42, QByteArray("1010100010101000"))
                        << SPad(QString::fromUtf8("Low Tom 1"), 43, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Pedal Hi-hat"), 44, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Mid Tom 2"), 45, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Open Hi-hat"), 46, QByteArray("0000001000000010"))
                        << SPad(QString::fromUtf8("Mid Tom 1"), 47, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("High Tom 2"), 48, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Crash Cymbal 1"), 49, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("High Tom 1"), 50, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Ride Cymbal 1"), 51, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Splash Cymbal"), 55, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Crash Cymbal 2"), 57, QByteArray("0000000000000000"))
                        << SPad(QString::fromUtf8("Ride Cymbal 2"), 59, QByteArray("0000000000000000"))
                        ;

    setStyleSheet("QMainWindow { background-color: #efefef; }");

    settings = new QSettings("clebail", "qtdrum");

    spNbBeat->setMinimum(MIN_BEAT);
    spNbBeat->setMaximum(MAX_BEAT);
    spNbDiv->setMinimum(MIN_DIV);
    spNbDiv->setMaximum(MAX_DIV);

    ssTemps->setSegmentColor(QColor(0x93, 0x65, 0xb8));
    taTimer->setSegmentColor(QColor(0x1f, 0xb5, 0xac));

    cbMidiPort->addItems(CDrumKit::getInstance()->getMidiPorts());

    drumWidget->addPads(&pads);

    playing = false;
    timerParams.drumWidget = drumWidget;

    realTimeTimer = new QTimer(this);
    realTimeTimer->setInterval(ONE_SECOND);
    connect(realTimeTimer, SIGNAL(timeout()), this, SLOT(onRealTimeTimer()));

    isOpenFileUnsaved = false;
    setOpenFileName("unamed.qdr", "unamed.qdr");

    CDrumKit::getInstance()->init(cbMidiPort->currentIndex());

    connect(&timerParams, SIGNAL(tempsUpdate(int)), this, SLOT(onTempsUpdate(int)));

    bells = new Phonon::MediaObject(this);
    bellsOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
    Phonon::createPath(bells, bellsOutput);

    qApp->installEventFilter(this);
}
Пример #13
0
void DeviceWidget::loadFirmware()
{
    QString file = setOpenFileName();

    loadFirmware(file);
}