QuickLaunchButton::QuickLaunchButton(QuickLaunchAction * act, ILXQtPanelPlugin * plugin, QWidget * parent)
    : QToolButton(parent),
      mAct(act),
      mPlugin(plugin)
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setAcceptDrops(true);
    setAutoRaise(true);

    setDefaultAction(mAct);
    mAct->setParent(this);

    mMoveLeftAct = new QAction(XdgIcon::fromTheme("go-previous"), tr("Move left"), this);
    connect(mMoveLeftAct, SIGNAL(triggered()), this, SIGNAL(movedLeft()));

    mMoveRightAct = new QAction(XdgIcon::fromTheme("go-next"), tr("Move right"), this);
    connect(mMoveRightAct, SIGNAL(triggered()), this, SIGNAL(movedRight()));


    mDeleteAct = new QAction(XdgIcon::fromTheme("dialog-close"), tr("Remove from quicklaunch"), this);
    connect(mDeleteAct, SIGNAL(triggered()), this, SLOT(selfRemove()));
    addAction(mDeleteAct);
    mMenu = new QMenu(this);
    mMenu->addAction(mAct);
    mMenu->addSeparator();
    mMenu->addAction(mMoveLeftAct);
    mMenu->addAction(mMoveRightAct);
    mMenu->addSeparator();
    mMenu->addAction(mDeleteAct);


    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(this_customContextMenuRequested(const QPoint&)));
}
Exemple #2
0
View::View(VideoPlayer* player, Screen* screen) :
    QWidget(screen),
    ui(new Ui::View),
    overlayUi(new Ui::ViewOverlay),
    screen(screen),
    player(player),
    overlay(new QWidget),
    isMovable(false),
    awesome(0)
{
    // setup UI
    ui->setupUi(this);
    overlayUi->setupUi(overlay);

    overlay->setParent(this);

    ui->zoomedLabel->hide();

    QVBoxLayout* layout = new QVBoxLayout;
    ui->video->setLayout(layout);

    player->setWidget(ui->video);

    awesome = new QtAwesome(this);
    awesome->initFontAwesome();
    awesome->setDefaultOption("color", QColor(255,255,255));
    awesome->setDefaultOption("color-disabled", QColor(127,127,127));
    awesome->setDefaultOption("color-active", QColor(255,255,255));
    awesome->setDefaultOption("color-selected", QColor(255,255,255));

    ui->moveButton->setIcon(awesome->icon(fa::arrows));
    ui->settingsButton->setIcon(awesome->icon(fa::cog));
    ui->zoomButton->setIcon(awesome->icon(fa::expand));
    ui->removeButton->setIcon(awesome->icon(fa::times));

    overlayUi->moveUpButton->setIcon(awesome->icon(fa::arrowcircleup));
    overlayUi->moveDownButton->setIcon(awesome->icon(fa::arrowcircledown));
    overlayUi->moveLeftButton->setIcon(awesome->icon(fa::arrowcircleleft));
    overlayUi->moveRightButton->setIcon(awesome->icon(fa::arrowcircleright));

    connect(ui->moveButton, SIGNAL(toggled(bool)), this, SLOT(setMovable(bool)));
    connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(openSettings()));

    connect(overlayUi->settingsButton, SIGNAL(clicked()), this, SLOT(openSettings()));

    connect(ui->zoomButton, SIGNAL(toggled(bool)), this, SLOT(setZoomed(bool)));
    connect(ui->removeButton, SIGNAL(clicked()), this, SIGNAL(removed()));
    connect(overlayUi->moveUpButton, SIGNAL(clicked()), this, SIGNAL(movedUp()));
    connect(overlayUi->moveDownButton, SIGNAL(clicked()), this, SIGNAL(movedDown()));
    connect(overlayUi->moveLeftButton, SIGNAL(clicked()), this, SIGNAL(movedLeft()));
    connect(overlayUi->moveRightButton, SIGNAL(clicked()), this, SIGNAL(movedRight()));
}
void LXQtQuickLaunch::addButton(QuickLaunchAction* action)
{
    mLayout->setEnabled(false);
    QuickLaunchButton* btn = new QuickLaunchButton(action, mPlugin, this);
    mLayout->addWidget(btn);

    connect(btn, SIGNAL(switchButtons(QuickLaunchButton*,QuickLaunchButton*)), this, SLOT(switchButtons(QuickLaunchButton*,QuickLaunchButton*)));
    connect(btn, SIGNAL(buttonDeleted()), this, SLOT(buttonDeleted()));
    connect(btn, SIGNAL(movedLeft()), this, SLOT(buttonMoveLeft()));
    connect(btn, SIGNAL(movedRight()), this, SLOT(buttonMoveRight()));

    mLayout->removeWidget(mPlaceHolder);
    delete mPlaceHolder;
    mPlaceHolder = 0;
    mLayout->setEnabled(true);
    realign();
}
/*!
 * \breif Move the scene right
 */
void
ControlWidget::moveRight()
{
    emit movedRight();
}