Ejemplo n.º 1
0
void QmlToolBar::setAnimationSpeed(qreal slowdownFactor)
{
    m_emitSignals = false;
    if (slowdownFactor != 0) {
        m_animationSpeed = slowdownFactor;

        if (slowdownFactor == 1.0f) {
            ui->defaultAnimSpeedAction->setChecked(true);
        } else if (slowdownFactor == 2.0f) {
            ui->halfAnimSpeedAction->setChecked(true);
        } else if (slowdownFactor == 4.0f) {
            ui->fourthAnimSpeedAction->setChecked(true);
        } else if (slowdownFactor == 8.0f) {
            ui->eighthAnimSpeedAction->setChecked(true);
        } else if (slowdownFactor == 10.0f) {
            ui->tenthAnimSpeedAction->setChecked(true);
        }
        updatePlayAction();
    } else {
        ui->menuPauseAction->setChecked(true);
        updatePauseAction();
    }

    m_emitSignals = true;
}
Ejemplo n.º 2
0
void ImageViewer::updateToolButtons()
{
    const bool isSvg = d->file->type() == ImageViewerFile::TypeSvg;
    d->ui_toolbar.toolButtonExportImage->setEnabled(isSvg);
    d->ui_toolbar.toolButtonMultiExportImages->setEnabled(isSvg);
    updatePauseAction();
}
Ejemplo n.º 3
0
void QmlToolBar::activatePlayOnClick()
{
    if (m_isRunning) {
        updatePauseAction();
    } else {
        updatePlayAction();
    }
}
Ejemplo n.º 4
0
TableEditor::TableEditor(QWidget *parent): Editor(parent)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    setLayout(layout);

    // toolbar
    _toolbar = new QWidget(this);
    layout->addWidget(_toolbar);
    _ui_toolbar = new Ui::TableEditorToolbar;
    _ui_toolbar->setupUi(_toolbar);
    _ui_toolbar->firstPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allLeft")));
    _ui_toolbar->previousPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/left")));
    _ui_toolbar->nextPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/right")));
    _ui_toolbar->lastPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allRight")));

    _ui_toolbar->refreshButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/refresh")));

    _ui_toolbar->addRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/add")));
    _ui_toolbar->deleteRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/remove")));

    _ui_toolbar->commitButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/checked")));
    _ui_toolbar->rollbackButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/rollback")));

    _ui_toolbar->dumpDataButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/export")));

    _tableView = new QTableView(this);
    _tableModel = new QSqlTableModel(_tableView /* TODO database connection */);
    _tableView->setModel(_tableModel);
    layout->addWidget(_tableView);

    // connections
    connect(_ui_toolbar->commitButton, SIGNAL(clicked()), _tableModel, SLOT(submitAll()));
    connect(_ui_toolbar->rollbackButton, SIGNAL(clicked()), _tableModel, SLOT(revertAll()));
    connect(_ui_toolbar->addRowButton, SIGNAL(clicked()), this, SLOT(addRow()));
    connect(_ui_toolbar->deleteRowButton, SIGNAL(clicked()), this, SLOT(deleteRows()));
    connect(_ui_toolbar->refreshButton, SIGNAL(clicked()), _tableModel, SLOT(select()));



    connect(_ui_toolbar->toolButtonExportImage, SIGNAL(clicked()),_imageView, SLOT(exportImage()));
    connect(_ui_toolbar->toolButtonZoomIn, SIGNAL(clicked()),_imageView,SLOT(zoomIn()));
    connect(_ui_toolbar->toolButtonZoomOut, SIGNAL(clicked()),_imageView, SLOT(zoomOut()));
    connect(_ui_toolbar->toolButtonFitToScreen, SIGNAL(clicked()),_imageView, SLOT(fitToScreen()));
    connect(_ui_toolbar->toolButtonOriginalSize, SIGNAL(clicked()),_imageView, SLOT(resetToOriginalSize()));
    connect(_ui_toolbar->toolButtonBackground, SIGNAL(toggled()),_imageView, SLOT(setViewBackground()));
    connect(_ui_toolbar->toolButtonOutline, SIGNAL(toggled()),_imageView, SLOT(setViewOutline()));
    connect(_ui_toolbar->toolButtonPlayPause, SIGNAL(clicked()),this, SLOT(playToggled()));
    connect(_file, SIGNAL(imageSizeChanged()),this, SLOT(imageSizeUpdated()));
    connect(_file, SIGNAL(openFinished()),_imageView, SLOT(createScene()));
    connect(_file, SIGNAL(openFinished()),this, SLOT(updateToolButtons()));
    connect(_file, SIGNAL(aboutToReload()),_imageView, SLOT(reset()));
    connect(_file, SIGNAL(reloadFinished()),_imageView, SLOT(createScene()));
    connect(_file, SIGNAL(isPausedChanged()),this, SLOT(updatePauseAction()));
    connect(_imageView, SIGNAL(scaleFactorChanged()),this, SLOT(scaleFactorUpdate()));
}
Ejemplo n.º 5
0
QmlToolBar::QmlToolBar(QWidget *parent)
    : QToolBar(parent)
    , m_emitSignals(true)
    , m_isRunning(false)
    , m_animationSpeed(1.0f)
    , m_previousAnimationSpeed(0.0f)
    , ui(new Ui)
{
    ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png"));
    ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png"));

    ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/observermode-24.png")),
                                 tr("Observer Mode"), this);
    ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this);
    ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this);
    ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")),
                                    tr("Select (Marquee)"), this);
    ui->zoom = new QAction(QIcon(QLatin1String(":/qml/images/zoom-24.png")), tr("Zoom"), this);
    ui->colorPicker = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-24.png")),
                                  tr("Color Picker"), this);
    ui->toQml = new QAction(QIcon(QLatin1String(":/qml/images/to-qml-24.png")),
                            tr("Apply Changes to QML Viewer"), this);
    ui->fromQml = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-24.png")),
                              tr("Apply Changes to Document"), this);
    ui->designmode->setCheckable(true);
    ui->designmode->setChecked(false);

    ui->play->setCheckable(false);
    ui->select->setCheckable(true);
    ui->selectMarquee->setCheckable(true);
    ui->zoom->setCheckable(true);
    ui->colorPicker->setCheckable(true);

    setWindowTitle(tr("Tools"));

    addAction(ui->designmode);
    addAction(ui->play);
    addSeparator();

    addAction(ui->select);
    // disabled because multi selection does not do anything useful without design mode
    //addAction(ui->selectMarquee);
    addSeparator();
    addAction(ui->zoom);
    addAction(ui->colorPicker);
    //addAction(ui->fromQml);

    ui->colorBox = new ToolBarColorBox(this);
    ui->colorBox->setMinimumSize(24, 24);
    ui->colorBox->setMaximumSize(28, 28);
    ui->colorBox->setColor(Qt::black);
    addWidget(ui->colorBox);

    setWindowFlags(Qt::Tool);

    QMenu *playSpeedMenu = new QMenu(this);
    QActionGroup *playSpeedMenuActions = new QActionGroup(this);
    playSpeedMenuActions->setExclusive(true);
    playSpeedMenu->addAction(tr("Animation Speed"));
    playSpeedMenu->addSeparator();
    ui->defaultAnimSpeedAction = playSpeedMenu->addAction(tr("1x"), this,
                                                          SLOT(changeToDefaultAnimSpeed()));
    ui->defaultAnimSpeedAction->setCheckable(true);
    ui->defaultAnimSpeedAction->setChecked(true);
    playSpeedMenuActions->addAction(ui->defaultAnimSpeedAction);

    ui->halfAnimSpeedAction = playSpeedMenu->addAction(tr("0.5x"), this,
                                                       SLOT(changeToHalfAnimSpeed()));
    ui->halfAnimSpeedAction->setCheckable(true);
    playSpeedMenuActions->addAction(ui->halfAnimSpeedAction);

    ui->fourthAnimSpeedAction = playSpeedMenu->addAction(tr("0.25x"), this,
                                                         SLOT(changeToFourthAnimSpeed()));
    ui->fourthAnimSpeedAction->setCheckable(true);
    playSpeedMenuActions->addAction(ui->fourthAnimSpeedAction);

    ui->eighthAnimSpeedAction = playSpeedMenu->addAction(tr("0.125x"), this,
                                                         SLOT(changeToEighthAnimSpeed()));
    ui->eighthAnimSpeedAction->setCheckable(true);
    playSpeedMenuActions->addAction(ui->eighthAnimSpeedAction);

    ui->tenthAnimSpeedAction = playSpeedMenu->addAction(tr("0.1x"), this,
                                                        SLOT(changeToTenthAnimSpeed()));
    ui->tenthAnimSpeedAction->setCheckable(true);
    playSpeedMenuActions->addAction(ui->tenthAnimSpeedAction);

    ui->menuPauseAction = playSpeedMenu->addAction(tr("Pause"), this, SLOT(updatePauseAction()));
    ui->menuPauseAction->setCheckable(true);
    ui->menuPauseAction->setIcon(ui->pauseIcon);
    playSpeedMenuActions->addAction(ui->menuPauseAction);
    ui->play->setMenu(playSpeedMenu);

    connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool)));

    connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));

    connect(ui->play, SIGNAL(triggered()), SLOT(activatePlayOnClick()));

    connect(ui->zoom, SIGNAL(triggered()), SLOT(activateZoomOnClick()));
    connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
    connect(ui->select, SIGNAL(triggered()), SLOT(activateSelectToolOnClick()));
    connect(ui->selectMarquee, SIGNAL(triggered()), SLOT(activateMarqueeSelectToolOnClick()));

    connect(ui->toQml, SIGNAL(triggered()), SLOT(activateToQml()));
    connect(ui->fromQml, SIGNAL(triggered()), SLOT(activateFromQml()));
}
Ejemplo n.º 6
0
void ImageViewer::updateToolButtons()
{
    d->ui_toolbar.toolButtonExportImage->setEnabled(d->file->type() == ImageViewerFile::TypeSvg);
    updatePauseAction();
}