Пример #1
0
void ShortcutButton::addShortcut(QPushButton *shortcutButton)
{
    QWidget *parent = this;
    // Destroy shortcut dialog, if its shortcut button is deleted.
    if (shortcutButton != NULL)
        parent = shortcutButton;

    ShortcutDialog *dialog = new ShortcutDialog(parent);
    dialog->setExpectModifier(m_expectModifier);

    if (dialog->exec() == QDialog::Accepted) {
        const QKeySequence shortcut = dialog->shortcut();
        const QString text = shortcut.toString(QKeySequence::NativeText);
        if ( shortcut.isEmpty() || shortcuts().contains(shortcut) ) {
            if (shortcutButton == NULL || shortcutButton->text() != text ) {
                if (shortcutButton != NULL)
                    emit shortcutRemoved(shortcutButton->text());
                delete shortcutButton;
            }
        } else {
            if (shortcutButton != NULL) {
                if ( shortcutButton->text() != text ) {
                    emit shortcutRemoved(shortcutButton->text());
                    shortcutButton->setText(text);
                    emit shortcutAdded(text);
                }
            } else {
                addShortcut(text);
            }
        }
    }
}
Пример #2
0
void ShortcutButton::addShortcut(QPushButton *shortcutButton)
{
    QWidget *parent = this;
    // Destroy shortcut dialog, if its shortcut button is deleted.
    if (shortcutButton != nullptr)
        parent = shortcutButton;

    auto dialog = new ShortcutDialog(parent);
    if (dialog->exec() == QDialog::Rejected)
        return;

    const QKeySequence newShortcut = dialog->shortcut();
    const QKeySequence oldShortcut = shortcutButton
            ? shortcutForButton(*shortcutButton)
            : QKeySequence();

    if (oldShortcut == newShortcut)
        return;

    // Remove shortcut button if shortcut is removed, unrecognized or already set.
    if ( newShortcut.isEmpty() || shortcuts().contains(newShortcut) ) {
        if (shortcutButton) {
            delete shortcutButton;
            emit shortcutRemoved(oldShortcut);
        }
    } else if (shortcutButton) {
        emit shortcutRemoved(oldShortcut);
        setButtonShortcut(shortcutButton, newShortcut);
        emit shortcutAdded(newShortcut);
    } else {
        addShortcut(newShortcut);
    }
}
Пример #3
0
QAction* ShortcutBar::addShortcut(const QString &name,
                                  const QString &command,
                                  const QString &icon)
{
  QIcon _icon = QIcon::fromTheme(icon);
  return addShortcut(name, command, &_icon);
}
Пример #4
0
StartTab::StartTab(MainWindow *mainWindow)
{
	setBackgroundRole(QPalette::Base);
	setAutoFillBackground(true);

	QGridLayout *gridLayout = new QGridLayout(this);
	gridLayout->setAlignment(Qt::AlignCenter);
	gridLayout->setMargin(10);
	gridLayout->setSpacing(15);

	QAbstractButton *button =
		addShortcut(i18n("&1 Play File"), QIcon::fromTheme(QLatin1String("video-x-generic"), QIcon(":video-x-generic")), this);
	button->setShortcut(Qt::Key_1);
	button->setWhatsThis(i18n("Open dialog to play a file"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(open()));
	gridLayout->addWidget(button, 0, 0);

	button = addShortcut(i18n("&2 Play Audio CD"), QIcon::fromTheme(QLatin1String("media-optical-audio"), QIcon(":media-optical-audio")), this);
	button->setShortcut(Qt::Key_2);
	button->setWhatsThis(i18n("Start playing an audio CD. It assumes that the CD is already there at the CD driver"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(openAudioCd()));
	gridLayout->addWidget(button, 0, 1);

	button = addShortcut(i18n("&3 Play Video CD"), QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), this);
	button->setShortcut(Qt::Key_3);
	button->setWhatsThis(i18n("Start playing a Video CD. It assumes that the CD is already there at the CD driver"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(openVideoCd()));
	gridLayout->addWidget(button, 0, 2);

	button = addShortcut(i18n("&4 Play DVD"), QIcon::fromTheme(QLatin1String("media-optical"), QIcon(":media-optical")), this);
	button->setShortcut(Qt::Key_4);
	button->setWhatsThis(i18n("Start playing a DVD. It assumes that the DVD is already there at the DVD driver"));
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(openDvd()));
	gridLayout->addWidget(button, 1, 0);

#if HAVE_DVB == 1
	button = addShortcut(i18n("&5 Digital TV"), QIcon::fromTheme(QLatin1String("video-television"), QIcon(":video-television")), this);
	button->setShortcut(Qt::Key_5);
	button->setWhatsThis("Open the Digital TV live view window. If the TV channels are already scanned, it will start playing the last channel");
	connect(button, SIGNAL(clicked()), mainWindow, SLOT(playDvb()));
	gridLayout->addWidget(button, 1, 1);
#endif /* HAVE_DVB == 1 */
}
Пример #5
0
void MainWindow::setShortcuts() {
    // Global shortcuts
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_W), this, SLOT(showHide()), "Show/Hide");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_P), this, SLOT(showHide()), "Show/Hide");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_X), &player_, SLOT(play()), "Play");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_C), &player_, SLOT(playPause()),
                      "Play/Pause");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_A), &player_, SLOT(prev()), "Prev");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Z), &player_, SLOT(next()), "Next");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_V), &player_, SLOT(stop()), "Stop");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_PageUp), this, SLOT(increaseVolume()),
                      "Increase volume");
    addGlobalShortcut(QKeySequence(Qt::META + Qt::Key_PageDown), this, SLOT(decreaseVolume()),
                      "Decrease volume");

    // App shortcuts
    addShortcut(QKeySequence(Qt::CTRL + Qt::Key_J), SLOT(focusFilter()));
    //     addShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), SLOT(removeActivePlaylist()));
    addShortcut(QKeySequence(Qt::CTRL + Qt::Key_D), SLOT(showHideConsole()),
                Qt::ApplicationShortcut);
}
KeyboardProfileDialog::KeyboardProfileDialog(const QString &profile, const QHash<QString, KeyboardProfile> &profiles, QWidget *parent) : Dialog(parent),
	m_profile(profile),
	m_isModified(profiles[profile].isModified),
	m_ui(new Ui::KeyboardProfileDialog)
{
	m_ui->setupUi(this);

	QStandardItemModel *model(new QStandardItemModel(this));
	const QVector<ActionsManager::ActionDefinition> definitions(ActionsManager::getActionDefinitions());
	for (int i = 0; i < definitions.count(); ++i)
	{
		QStandardItem *item(new QStandardItem(definitions.at(i).icon, QCoreApplication::translate("actions", (definitions.at(i).description.isEmpty() ? definitions.at(i).text : definitions.at(i).description).toUtf8().constData())));
		item->setData(definitions.at(i).identifier, Qt::UserRole);
		item->setToolTip(ActionsManager::getActionName(definitions.at(i).identifier));
		item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren);

		if (profiles[profile].shortcuts.contains(definitions.at(i).identifier))
		{
			QStringList shortcuts;

			for (int j = 0; j < profiles[profile].shortcuts[definitions.at(i).identifier].count(); ++j)
			{
				shortcuts.append(profiles[profile].shortcuts[definitions.at(i).identifier].at(j).toString());
			}

			item->setData(shortcuts.join(QLatin1Char(' ')), (Qt::UserRole + 1));
		}

		model->appendRow(item);
	}

	model->setHorizontalHeaderLabels(QStringList({tr("Action")}));
	model->sort(0);

	m_ui->actionsViewWidget->setModel(model);
	m_ui->shortcutsViewWidget->setModel(new QStandardItemModel(this));
	m_ui->shortcutsViewWidget->setItemDelegate(new KeyboardShortcutDelegate(this));
	m_ui->titleLineEdit->setText(profiles[profile].title);
	m_ui->descriptionLineEdit->setText(profiles[profile].description);
	m_ui->versionLineEdit->setText(profiles[profile].version);
	m_ui->authorLineEdit->setText(profiles[profile].author);

	connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->actionsViewWidget, SLOT(setFilterString(QString)));
	connect(m_ui->actionsViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActionsActions()));
	connect(m_ui->shortcutsViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateShortcutsActions()));
	connect(m_ui->addShortcutButton, SIGNAL(clicked()), this, SLOT(addShortcut()));
	connect(m_ui->removeShortcutButton, SIGNAL(clicked()), this, SLOT(removeShortcut()));
}
Пример #7
0
ShortcutButton::ShortcutButton(const QKeySequence &defaultShortcut, QWidget *parent)
    : QWidget(parent)
    , m_defaultShortcut(defaultShortcut)
    , m_layout(new QHBoxLayout(this))
    , m_buttonAddShortcut(new QPushButton(this))
    , m_expectModifier(false)
{
    m_layout->setMargin(0);
    m_layout->setSpacing(2);
    m_layout->setAlignment(Qt::AlignRight);

    m_layout->addWidget(m_buttonAddShortcut);

    m_buttonAddShortcut->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
    connect( m_buttonAddShortcut, SIGNAL(clicked()),
             this, SLOT(onButtonAddShortcutClicked()) );

    addShortcut(m_defaultShortcut);

    setFocusPolicy(Qt::WheelFocus);
}
Пример #8
0
ShortcutButton::ShortcutButton(QWidget *parent)
    : QWidget(parent)
    , m_defaultShortcut()
    , m_layout(new QHBoxLayout(this))
    , m_buttonAddShortcut(new QPushButton(this))
{
    m_layout->setMargin(0);
    m_layout->setSpacing(2);
    m_layout->setAlignment(Qt::AlignRight);

    m_buttonAddShortcut->setFlat(true);
    m_buttonAddShortcut->setToolTip( tr("Add shortcut") );
    const int h = m_buttonAddShortcut->sizeHint().height();
    m_buttonAddShortcut->setMaximumSize(h, h);
    m_layout->addWidget(m_buttonAddShortcut);
    setFocusProxy(m_buttonAddShortcut);

    connect( m_buttonAddShortcut, &QAbstractButton::clicked,
             this, &ShortcutButton::onButtonAddShortcutClicked );

    addShortcut(m_defaultShortcut);
}
Пример #9
0
ShortcutButton::ShortcutButton(QWidget *parent)
    : QWidget(parent)
    , m_defaultShortcut()
    , m_layout(new QHBoxLayout(this))
    , m_buttonAddShortcut(new QPushButton(this))
    , m_expectModifier(false)
{
    m_layout->setMargin(0);
    m_layout->setSpacing(2);
    m_layout->setAlignment(Qt::AlignRight);

    m_buttonAddShortcut->setFlat(true);
    m_buttonAddShortcut->setToolTip( tr("Add shortcut") );
    m_layout->addWidget(m_buttonAddShortcut);

    connect( m_buttonAddShortcut, SIGNAL(clicked()),
             this, SLOT(onButtonAddShortcutClicked()) );

    addShortcut(m_defaultShortcut);

    setFocusPolicy(Qt::WheelFocus);
}
Пример #10
0
PhotoView::Actions::Actions( PhotoView * photoView ):
    _photoView( photoView )
{
    //
    // Zoom
    //

    noZoom = createAction( tr( "No Zoom (100% / &1:1)" ), Qt::Key_1, NoZoom );
    CONNECT_ACTION( noZoom, photoView, setZoomMode() );

    zoomIn = createAction( tr( "Zoom In (Enlarge)" ), Qt::Key_Plus );
    CONNECT_ACTION( zoomIn, photoView, zoomIn() );

    zoomOut = createAction( tr( "Zoom Out (Shrink)" ), Qt::Key_Minus );
    CONNECT_ACTION( zoomOut, photoView, zoomOut() );

    zoomFitImage = createAction( tr( "Zoom to &Fit Window" ), Qt::Key_F, ZoomFitImage );
    addShortcut( zoomFitImage, Qt::Key_M );
    CONNECT_ACTION( zoomFitImage, photoView, setZoomMode() );

    zoomFitWidth = createAction( tr( "Zoom to Fit Window &Width" ), Qt::Key_W, ZoomFitWidth );
    CONNECT_ACTION( zoomFitWidth, photoView, setZoomMode() );

    zoomFitHeight = createAction( tr( "Zoom to Fit Window &Height" ), Qt::Key_H, ZoomFitHeight );
    CONNECT_ACTION( zoomFitHeight, photoView, setZoomMode() );

    zoomFitBest = createAction( tr( "&Best Zoom for Window Width or Height" ), Qt::Key_B, ZoomFitBest );
    CONNECT_ACTION( zoomFitBest, photoView, setZoomMode() );

    //
    // Navigation
    //

    loadNext = createAction( tr( "Load &Next Image" ), Qt::Key_Space, NavigateNext );
    addShortcut( loadNext, Qt::Key_PageDown );
    CONNECT_ACTION( loadNext, photoView, navigate() );

    loadPrevious = createAction( tr( "Load &Previous Image" ), Qt::Key_Backspace, NavigatePrevious );
    addShortcut( loadPrevious, Qt::Key_PageUp );
    CONNECT_ACTION( loadPrevious, photoView, navigate() );

    loadFirst = createAction( tr( "Load &First Image" ), Qt::Key_Home, NavigateFirst );
    CONNECT_ACTION( loadFirst, photoView, navigate() );

    loadLast = createAction( tr( "Load &Last Image" ), Qt::Key_End, NavigateLast );
    CONNECT_ACTION( loadLast, photoView, navigate() );


    //
    // Misc
    //

    forceReload = createAction( tr( "Force &Reload" ), Qt::Key_F5 );
    CONNECT_ACTION( forceReload, photoView, forceReload() );

    toggleFullscreen = createAction( tr( "Toggle F&ullscreen" ), Qt::Key_Return );
    CONNECT_ACTION( toggleFullscreen, photoView, toggleFullscreen() );

    quit = createAction( tr ( "&Quit" ), Qt::Key_Q );
    addShortcut( quit, Qt::Key_Escape );
    CONNECT_ACTION( quit, qApp, quit() );
}
Пример #11
0
void ShortcutButton::onButtonAddShortcutClicked()
{
    addShortcut(NULL);
}
Пример #12
0
void ShortcutButton::onButtonAddShortcutClicked()
{
    addShortcut(nullptr);
}
Пример #13
0
void ShortcutButton::onShortcutButtonClicked()
{
    QPushButton *button = qobject_cast<QPushButton*>(sender());
    Q_ASSERT(button != nullptr);
    addShortcut(button);
}
Пример #14
0
void System::handleMenu(MAEvent &event) {
  int menuId = event.optionsBoxButtonIndex;
  int fontSize = _output->getFontSize();
  int menuItem = _systemMenu[menuId];
  delete [] _systemMenu;
  _systemMenu = NULL;

  switch (menuItem) {
  case MENU_SOURCE:
    showSystemScreen(true);
    break;
  case MENU_CONSOLE:
    showSystemScreen(false);
    break;
  case MENU_KEYPAD:
    maShowVirtualKeyboard();
    break;
  case MENU_RESTART:
    setRestart();
    break;
  case MENU_BACK:
    setBack();
    break;
  case MENU_ZOOM_UP:
    if (_fontScale > FONT_MIN) {
      _fontScale -= FONT_SCALE_INTERVAL;
      fontSize = (_initialFontSize * _fontScale / 100);
    }
    break;
  case MENU_ZOOM_DN:
    if (_fontScale < FONT_MAX) {
      _fontScale += FONT_SCALE_INTERVAL;
      fontSize = (_initialFontSize * _fontScale / 100);
    }
    break;
  case MENU_COPY:
  case MENU_CUT:
    if (get_focus_edit() != NULL) {
      char *text = get_focus_edit()->copy(menuItem == MENU_CUT);
      if (text) {
        setClipboardText(text);
        free(text);
        _output->redraw();
      }
    }
    break;
  case MENU_PASTE:
    if (get_focus_edit() != NULL) {
      char *text = getClipboardText();
      get_focus_edit()->paste(text);
      _output->redraw();
      free(text);
    }
    break;
  case MENU_SELECT_ALL:
    if (get_focus_edit() != NULL) {
      get_focus_edit()->selectAll();
      _output->redraw();
    }
    break;
  case MENU_CTRL_MODE:
    if (get_focus_edit() != NULL) {
      bool controlMode = get_focus_edit()->getControlMode();
      get_focus_edit()->setControlMode(!controlMode);
    }
    break;
  case MENU_EDITMODE:
    opt_ide = (opt_ide == IDE_NONE ? IDE_INTERNAL : IDE_NONE);
    break;
  case MENU_AUDIO:
    opt_mute_audio = !opt_mute_audio;
    break;
  case MENU_SCREENSHOT:
    ::screen_dump();
    break;
  case MENU_UNDO:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('z');
    break;
  case MENU_REDO:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('y');
    break;
  case MENU_SAVE:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('s');
    break;
  case MENU_RUN:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_F(9);
    break;
  case MENU_DEBUG:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_F(5);
    break;
  case MENU_OUTPUT:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_CTRL('o');
    break;
  case MENU_HELP:
    event.type = EVENT_TYPE_KEY_PRESSED;
    event.key = SB_KEY_F(1);
    break;
  case MENU_SHORTCUT:
    if (!_activeFile.empty()) {
      addShortcut(_activeFile.c_str());
    }
    break;
  case MENU_SHARE:
    if (!_activeFile.empty()) {
      share(_activeFile.c_str());
    }
    break;
  case MENU_COMPLETION_0:
    completeKeyword(0);
    break;
  case MENU_COMPLETION_1:
    completeKeyword(1);
    break;
  case MENU_COMPLETION_2:
    completeKeyword(2);
    break;
  case MENU_COMPLETION_3:
    completeKeyword(3);
    break;
  }

  if (fontSize != _output->getFontSize()) {
    // restart the shell
    _output->setFontSize(fontSize);
    setRestart();
  }

  if (!isRunning()) {
    _output->flush(true);
  }
}
Пример #15
0
    OrbitCameraController::OrbitCameraController(QWidget* widget)
        : CameraController(widget)
        , mInitialized(false)
        , mNaviPrimary(false)
        , mNaviSecondary(false)
        , mFast(false)
        , mFastAlternate(false)
        , mLeft(false)
        , mRight(false)
        , mUp(false)
        , mDown(false)
        , mRollLeft(false)
        , mRollRight(false)
        , mPickingMask(~0)
        , mCenter(0,0,0)
        , mDistance(0)
        , mOrbitSpeed(osg::PI / 4)
        , mOrbitSpeedMult(4)
        , mConstRoll(false)
    {
        CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget);
        naviPrimaryShortcut->enable(false);
        connect(naviPrimaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviPrimary(bool)));

        addShortcut(naviPrimaryShortcut);

        CSMPrefs::Shortcut* naviSecondaryShortcut = new CSMPrefs::Shortcut("scene-navi-secondary", widget);
        naviSecondaryShortcut->enable(false);
        connect(naviSecondaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviSecondary(bool)));

        addShortcut(naviSecondaryShortcut);

        CSMPrefs::Shortcut* upShortcut = new CSMPrefs::Shortcut("orbit-up", "scene-speed-modifier",
            CSMPrefs::Shortcut::SM_Detach, widget);
        upShortcut->enable(false);
        connect(upShortcut, SIGNAL(activated(bool)), this, SLOT(up(bool)));
        connect(upShortcut, SIGNAL(secondary(bool)), this, SLOT(alternateFast(bool)));

        addShortcut(upShortcut);

        CSMPrefs::Shortcut* leftShortcut = new CSMPrefs::Shortcut("orbit-left", widget);
        leftShortcut->enable(false);
        connect(leftShortcut, SIGNAL(activated(bool)), this, SLOT(left(bool)));

        addShortcut(leftShortcut);

        CSMPrefs::Shortcut* downShortcut = new CSMPrefs::Shortcut("orbit-down", widget);
        downShortcut->enable(false);
        connect(downShortcut, SIGNAL(activated(bool)), this, SLOT(down(bool)));

        addShortcut(downShortcut);

        CSMPrefs::Shortcut* rightShortcut = new CSMPrefs::Shortcut("orbit-right", widget);
        rightShortcut->enable(false);
        connect(rightShortcut, SIGNAL(activated(bool)), this, SLOT(right(bool)));

        addShortcut(rightShortcut);

        CSMPrefs::Shortcut* rollLeftShortcut = new CSMPrefs::Shortcut("orbit-roll-left", widget);
        rollLeftShortcut->enable(false);
        connect(rollLeftShortcut, SIGNAL(activated(bool)), this, SLOT(rollLeft(bool)));

        addShortcut(rollLeftShortcut);

        CSMPrefs::Shortcut* rollRightShortcut = new CSMPrefs::Shortcut("orbit-roll-right", widget);
        rollRightShortcut->enable(false);
        connect(rollRightShortcut, SIGNAL(activated(bool)), this, SLOT(rollRight(bool)));

        addShortcut(rollRightShortcut);

        CSMPrefs::Shortcut* speedModeShortcut = new CSMPrefs::Shortcut("orbit-speed-mode", widget);
        speedModeShortcut->enable(false);
        connect(speedModeShortcut, SIGNAL(activated()), this, SLOT(swapSpeedMode()));

        addShortcut(speedModeShortcut);
    }
Пример #16
0
    FreeCameraController::FreeCameraController(QWidget* widget)
        : CameraController(widget)
        , mLockUpright(false)
        , mModified(false)
        , mNaviPrimary(false)
        , mNaviSecondary(false)
        , mFast(false)
        , mFastAlternate(false)
        , mLeft(false)
        , mRight(false)
        , mForward(false)
        , mBackward(false)
        , mRollLeft(false)
        , mRollRight(false)
        , mUp(LocalUp)
        , mLinSpeed(1000)
        , mRotSpeed(osg::PI / 2)
        , mSpeedMult(8)
    {
        CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget);
        naviPrimaryShortcut->enable(false);
        connect(naviPrimaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviPrimary(bool)));

        addShortcut(naviPrimaryShortcut);

        CSMPrefs::Shortcut* naviSecondaryShortcut = new CSMPrefs::Shortcut("scene-navi-secondary", widget);
        naviSecondaryShortcut->enable(false);
        connect(naviSecondaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviSecondary(bool)));

        addShortcut(naviSecondaryShortcut);

        CSMPrefs::Shortcut* forwardShortcut = new CSMPrefs::Shortcut("free-forward", "scene-speed-modifier",
            CSMPrefs::Shortcut::SM_Detach, widget);
        forwardShortcut->enable(false);
        connect(forwardShortcut, SIGNAL(activated(bool)), this, SLOT(forward(bool)));
        connect(forwardShortcut, SIGNAL(secondary(bool)), this, SLOT(alternateFast(bool)));

        addShortcut(forwardShortcut);

        CSMPrefs::Shortcut* leftShortcut = new CSMPrefs::Shortcut("free-left", widget);
        leftShortcut->enable(false);
        connect(leftShortcut, SIGNAL(activated(bool)), this, SLOT(left(bool)));

        addShortcut(leftShortcut);

        CSMPrefs::Shortcut* backShortcut = new CSMPrefs::Shortcut("free-backward", widget);
        backShortcut->enable(false);
        connect(backShortcut, SIGNAL(activated(bool)), this, SLOT(backward(bool)));

        addShortcut(backShortcut);

        CSMPrefs::Shortcut* rightShortcut = new CSMPrefs::Shortcut("free-right", widget);
        rightShortcut->enable(false);
        connect(rightShortcut, SIGNAL(activated(bool)), this, SLOT(right(bool)));

        addShortcut(rightShortcut);

        CSMPrefs::Shortcut* rollLeftShortcut = new CSMPrefs::Shortcut("free-roll-left", widget);
        rollLeftShortcut->enable(false);
        connect(rollLeftShortcut, SIGNAL(activated(bool)), this, SLOT(rollLeft(bool)));

        addShortcut(rollLeftShortcut);

        CSMPrefs::Shortcut* rollRightShortcut = new CSMPrefs::Shortcut("free-roll-right", widget);
        rollRightShortcut->enable(false);
        connect(rollRightShortcut, SIGNAL(activated(bool)), this, SLOT(rollRight(bool)));

        addShortcut(rollRightShortcut);

        CSMPrefs::Shortcut* speedModeShortcut = new CSMPrefs::Shortcut("free-speed-mode", widget);
        speedModeShortcut->enable(false);
        connect(speedModeShortcut, SIGNAL(activated()), this, SLOT(swapSpeedMode()));

        addShortcut(speedModeShortcut);
    }
Пример #17
0
void ShortcutButton::addShortcut(const QString &shortcutPortableText)
{
    QKeySequence shortcut(shortcutPortableText, QKeySequence::PortableText);
    if ( !shortcut.isEmpty() )
        addShortcut(shortcut);
}
Пример #18
0
void ShortcutButton::resetShortcuts()
{
    clearShortcuts();
    addShortcut(m_defaultShortcut);
}
Пример #19
0
UIImageOverview::UIImageOverview(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::UIImageOverview)
{
    QClipboard *clipboard = QApplication::clipboard();

    requestHandler = new RequestHandler(this);
    iParser = 0;
    oParser = 0;
    _cachedResult = false;

    pendingThumbnails.clear();

    ui->setupUi(this);

#ifndef __DEBUG__
    ui->btnDebug->hide();
#endif

    timer = new QTimer(this);
    settings = new QSettings("settings.ini", QSettings::IniFormat);

    thumbnailsizeLocked = false;
    closeWhenFinished = false;
    downloading = false;

    deleteFileAction = new QAction(QString("Delete File"), this);
    deleteFileAction->setIcon(QIcon(":/icons/resources/remove.png"));
    reloadFileAction = new QAction("Reload File", this);
    reloadFileAction->setIcon(QIcon(":/icons/resources/reload.png"));
    openFileAction = new QAction("Open File", this);
    openFileAction->setIcon(QIcon(":/icons/resources/open.png"));

    ui->progressBar->setMinimum(1);
    ui->progressBar->setMaximum(-1);
    ui->progressBar->setValue(0);
    ui->progressBar->setEnabled(true);
    ui->progressBar->setVisible(false);
    ui->progressBar->setFormat("%p%");

    if (QUrl(clipboard->text()).isValid() && pluginManager->isSupported(clipboard->text())) {
        ui->leURI->setText(clipboard->text());
    }

    connect(requestHandler, SIGNAL(responseError(QUrl, int)), this, SLOT(errorHandler(QUrl, int)));
    connect(requestHandler, SIGNAL(response(QUrl, QByteArray, bool)), this, SLOT(processRequestResponse(QUrl, QByteArray, bool)));

    connect(ui->leSavepath, SIGNAL(textChanged(QString)), this, SIGNAL(directoryChanged(QString)));
    connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(openFile()));

    connect(deleteFileAction, SIGNAL(triggered()), this, SLOT(deleteFile()));
    connect(reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFile()));
    connect(openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));

    connect(timer, SIGNAL(timeout()), this, SLOT(triggerRescan()));
    connect(folderShortcuts, SIGNAL(shortcutsChanged()), this, SLOT(fillShortcutComboBox()));
    connect(ui->cbFolderShortcuts, SIGNAL(currentIndexChanged(QString)), this, SLOT(selectShortcut(QString)));
    connect(ui->leSavepath, SIGNAL(textChanged(QString)), this, SLOT(checkForFolderShortcut(QString)));
    connect(ui->btnAddShortcut, SIGNAL(clicked()), this, SLOT(addShortcut()));

    // Connections for key bindings
    connect(ui->listWidget, SIGNAL(openItem()), this, SLOT(openFile()));
    connect(ui->listWidget, SIGNAL(deleteItem()), this, SLOT(deleteFile()));
    connect(ui->listWidget, SIGNAL(reloadItem()), this, SLOT(reloadFile()));

    connect(tnt, SIGNAL(thumbnailAvailable(QString,QString)), this, SLOT(addThumbnail(QString,QString)));

    setTabTitle("idle");

    loadSettings();
    fillShortcutComboBox();
    expectedThumbnailCount = 0;
    thumbnailCount = 0;
}