Esempio n. 1
0
ProjectOperationHandler::ProjectOperationHandler(QQmlApplicationEngine* engine, QWidget* parent)
    : m_engine{ engine }
    , m_parent{ parent }
    , m_projectName{ "" }
    , m_projectLocation{ "" }
{
    QObject* rootObject = m_engine->rootObjects().first();
    QObject* createProjectSlide = rootObject->findChild<QObject*>("createProjectMainIdName");
    m_createProjectForm = rootObject->findChild<QObject*>("createProjectForm");

    QObject::connect(
        m_createProjectForm, SIGNAL(nameChanged(QString)),
        this, SLOT(nameChanged(QString)));
    QObject::connect(
        m_createProjectForm, SIGNAL(locationChanged(QString)),
        this, SLOT(locationChanged(QString)));
    QObject::connect(
        m_createProjectForm, SIGNAL(browseClicked()),
        this, SLOT(browseClicked()));
    QObject::connect(
        m_createProjectForm, SIGNAL(cancelClicked()),
        this, SLOT(cancelClicked()));
    QObject::connect(
        m_createProjectForm, SIGNAL(createClicked()),
        this, SLOT(createClicked()));

    QObject* form = m_createProjectForm->findChild<QObject*>("projectLocationInput"); 
    form->setProperty("text", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));

    QObject* mainPageForm = rootObject->findChild<QObject*>("mainPageForm", Qt::FindChildrenRecursively);
    QObject::connect(mainPageForm, SIGNAL(openProjectLocation(QString, QString)), this, SLOT(openProject(QString, QString)));
}
Esempio n. 2
0
LayerManager::LayerManager(Score* s, QWidget* parent)
   : QDialog(parent)
      {
      setObjectName("LayerManager");
      setupUi(this);
      setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);

      score = s;

      for (int i = 0; i < 31; ++i) {
            QTableWidgetItem* item = new QTableWidgetItem(score->layerTags()[i+1]);
            tags->setItem(i, 0, item);
            item = new QTableWidgetItem(score->layerTagComments()[i+1]);
            tags->setItem(i, 1, item);
            }

      layers->setRowCount(score->layer().size());
      int row = 0;
      foreach(const Layer& l, score->layer()) {
            QTableWidgetItem* item = new QTableWidgetItem(l.name);
            layers->setItem(row, 0, item);
            QString tagString;
            for (int i = 0; i < 31; ++i) {
                  uint mask = 1 << (i+1);
                  if (mask &  l.tags) {
                        if (!tagString.isEmpty())
                              tagString += ",";
                        tagString += tags->item(i, 0)->text();
                        }
                  }
            item = new QTableWidgetItem(tagString);
            layers->setItem(row, 1, item);
            ++row;
            }
      layers->setCurrentCell(score->currentLayer(), 0);

      connect(createButton, SIGNAL(clicked()), SLOT(createClicked()));
      connect(deleteButton, SIGNAL(clicked()), SLOT(deleteClicked()));
      connect(addTagButton, SIGNAL(clicked()), SLOT(addTagClicked()));
      connect(deleteTagButton, SIGNAL(clicked()), SLOT(deleteTagClicked()));

      MuseScore::restoreGeometry(this);
      }
AddIntervalDialog::AddIntervalDialog(Context *context) :
    context(context)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle(tr("Add Intervals"));
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    intervalMethodWidget = new QWidget();
    QHBoxLayout *intervalMethodLayout = new QHBoxLayout;
    QLabel *intervalMethodLabel = new QLabel(tr("Method: "), this);
    intervalMethodLayout->addWidget(intervalMethodLabel);
    QButtonGroup *methodButtonGroup = new QButtonGroup(this);
    methodFirst = new QRadioButton(tr("First"));
    methodFirst->setChecked(true);
    methodButtonGroup->addButton(methodFirst);
    intervalMethodLayout->addWidget(methodFirst);
    methodBestPower = new QRadioButton(tr("Peak Power"));
    methodButtonGroup->addButton(methodBestPower);
    intervalMethodLayout->addWidget(methodBestPower);
    //mainLayout->addLayout(intervalMethodLayout);
    intervalMethodWidget->setLayout(intervalMethodLayout);
    mainLayout->addWidget(intervalMethodWidget);

    intervalPeakPowerWidget = new QWidget();
    intervalPeakPowerTypeLayout = new QHBoxLayout;
    QLabel *intervalPeakPowerTypeLabel = new QLabel(tr("Type: "), this);
    intervalPeakPowerTypeLayout->addWidget(intervalPeakPowerTypeLabel);
    QButtonGroup *peakPowerTypeButtonGroup = new QButtonGroup(this);
    peakPowerStandard = new QRadioButton(tr("Standard"));
    peakPowerStandard->setChecked(true);
    peakPowerTypeButtonGroup->addButton(peakPowerStandard);
    intervalPeakPowerTypeLayout->addWidget(peakPowerStandard);
    peakPowerCustom = new QRadioButton(tr("Custom"));
    peakPowerTypeButtonGroup->addButton(peakPowerCustom);
    intervalPeakPowerTypeLayout->addWidget(peakPowerCustom);
    //mainLayout->addLayout(intervalPeakPowerTypeLayout);
    intervalPeakPowerWidget->setLayout(intervalPeakPowerTypeLayout);
    intervalPeakPowerWidget->hide();
    mainLayout->addWidget(intervalPeakPowerWidget);

    intervalTypeWidget = new QWidget();
    QHBoxLayout *intervalTypeLayout = new QHBoxLayout;
    QLabel *intervalTypeLabel = new QLabel(tr("Interval length: "), this);
    intervalTypeLayout->addWidget(intervalTypeLabel);
    QButtonGroup *typeButtonGroup = new QButtonGroup(this);
    typeTime = new QRadioButton(tr("By time"));
    typeTime->setChecked(true);
    typeButtonGroup->addButton(typeTime);
    intervalTypeLayout->addWidget(typeTime);
    typeDistance = new QRadioButton(tr("By distance"));
    typeButtonGroup->addButton(typeDistance);
    intervalTypeLayout->addWidget(typeDistance);
    //mainLayout->addLayout(intervalTypeLayout);
    intervalTypeWidget->setLayout(intervalTypeLayout);
    mainLayout->addWidget(intervalTypeWidget);

    intervalTimeWidget = new QWidget();
    QHBoxLayout *intervalTimeLayout = new QHBoxLayout;
    QLabel *intervalTimeLabel = new QLabel(tr("Time: "), this);
    intervalTimeLayout->addWidget(intervalTimeLabel);
    hrsSpinBox = new QDoubleSpinBox(this);
    hrsSpinBox->setDecimals(0);
    hrsSpinBox->setMinimum(0.0);
    hrsSpinBox->setSuffix(" hrs");
    hrsSpinBox->setSingleStep(1.0);
    hrsSpinBox->setAlignment(Qt::AlignRight);
    intervalTimeLayout->addWidget(hrsSpinBox);
    minsSpinBox = new QDoubleSpinBox(this);
    minsSpinBox->setDecimals(0);
    minsSpinBox->setRange(0.0, 59.0);
    minsSpinBox->setSuffix(" mins");
    minsSpinBox->setSingleStep(1.0);
    minsSpinBox->setWrapping(true);
    minsSpinBox->setAlignment(Qt::AlignRight);
    minsSpinBox->setValue(1.0);
    intervalTimeLayout->addWidget(minsSpinBox);
    secsSpinBox = new QDoubleSpinBox(this);
    secsSpinBox->setDecimals(0);
    secsSpinBox->setRange(0.0, 59.0);
    secsSpinBox->setSuffix(" secs");
    secsSpinBox->setSingleStep(1.0);
    secsSpinBox->setWrapping(true);
    secsSpinBox->setAlignment(Qt::AlignRight);
    intervalTimeLayout->addWidget(secsSpinBox);
    //mainLayout->addLayout(intervalLengthLayout);
    intervalTimeWidget->setLayout(intervalTimeLayout);
    mainLayout->addWidget(intervalTimeWidget);

    intervalDistanceWidget = new QWidget();
    QHBoxLayout *intervalDistanceLayout = new QHBoxLayout;
    QLabel *intervalDistanceLabel = new QLabel(tr("Distance: "), this);
    intervalDistanceLayout->addWidget(intervalDistanceLabel);
    kmsSpinBox = new QDoubleSpinBox(this);
    kmsSpinBox->setDecimals(0);
    kmsSpinBox->setRange(0.0, 999);
    kmsSpinBox->setValue(5.0);
    kmsSpinBox->setSuffix(" km");
    kmsSpinBox->setSingleStep(1.0);
    kmsSpinBox->setAlignment(Qt::AlignRight);
    intervalDistanceLayout->addWidget(kmsSpinBox);
    msSpinBox = new QDoubleSpinBox(this);
    msSpinBox->setDecimals(0);
    msSpinBox->setRange(0.0, 999);
    msSpinBox->setSuffix(" m");
    msSpinBox->setSingleStep(1.0);
    msSpinBox->setAlignment(Qt::AlignRight);
    intervalDistanceLayout->addWidget(msSpinBox);
    //mainLayout->addLayout(intervalDistanceLayout);
    intervalDistanceWidget->setLayout(intervalDistanceLayout);
    intervalDistanceWidget->hide();
    mainLayout->addWidget(intervalDistanceWidget);

    intervalCountWidget = new QWidget();
    QHBoxLayout *intervalCountLayout = new QHBoxLayout;
    QLabel *intervalCountLabel = new QLabel(tr("How many to find: "), this);
    intervalCountLayout->addWidget(intervalCountLabel);
    countSpinBox = new QDoubleSpinBox(this);
    countSpinBox->setDecimals(0);
    countSpinBox->setMinimum(1.0);
    countSpinBox->setValue(5.0); // lets default to the top 5 powers
    countSpinBox->setSingleStep(1.0);
    countSpinBox->setAlignment(Qt::AlignRight);
    intervalCountLayout->addWidget(countSpinBox);
    //mainLayout->addLayout(intervalCountLayout);
    intervalCountWidget->setLayout(intervalCountLayout);
    mainLayout->addWidget(intervalCountWidget);







    QLabel *resultsLabel = new QLabel(tr("Results:"), this);
    mainLayout->addWidget(resultsLabel);

    // user can select from the results to add
    // to the ride intervals
    resultsTable = new QTableWidget;
    mainLayout->addWidget(resultsTable);
    resultsTable->setColumnCount(5);
    resultsTable->setColumnHidden(3, true); // has start time in secs
    resultsTable->setColumnHidden(4, true); // has stop time in secs
    resultsTable->horizontalHeader()->hide();
//    resultsTable->verticalHeader()->hide();
    resultsTable->setShowGrid(false);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    createButton = new QPushButton(tr("&Create Intervals"), this);
    buttonLayout->addWidget(createButton);
    doneButton = new QPushButton(tr("&Done"), this);
    buttonLayout->addWidget(doneButton);
    addButton = new QPushButton(tr("&Add to Intervals"));
    buttonLayout->addWidget(addButton);
    mainLayout->addLayout(buttonLayout);

    connect(methodFirst, SIGNAL(clicked()), this, SLOT(methodFirstClicked()));
    connect(methodBestPower, SIGNAL(clicked()), this, SLOT(methodBestPowerClicked()));
    connect(peakPowerStandard, SIGNAL(clicked()), this, SLOT(peakPowerStandardClicked()));
    connect(peakPowerCustom, SIGNAL(clicked()), this, SLOT(peakPowerCustomClicked()));
    connect(typeTime, SIGNAL(clicked()), this, SLOT(typeTimeClicked()));
    connect(typeDistance, SIGNAL(clicked()), this, SLOT(typeDistanceClicked()));




    connect(createButton, SIGNAL(clicked()), this, SLOT(createClicked()));
    connect(doneButton, SIGNAL(clicked()), this, SLOT(doneClicked()));
    connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked()));
}