void OcularDialog::initAboutText()
{
	//BM: Most of the text for now is the original contents of the About widget.
	QString html = "<html><head><title></title></head><body>";

	html += "<h2>" + q_("Oculars Plug-in") + "</h2><table width=\"90%\">";
	html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + OCULARS_PLUGIN_VERSION + "</td></tr>";
	html += "<tr><td><strong>" + q_("Authors") + ":</strong></td><td>Timothy Reaves &lt;[email protected]&gt;<br />Bogdan Marinov</td></tr>";
	html += "</table>";

	//Overview
	html += "<h2>" + q_("Overview") + "</h2>";

	html += "<p>" + q_("This plugin is intended to simulate what you would see through an eyepiece.  This configuration dialog can be used to add, modify, or delete eyepieces and telescopes, as well as CCD Sensors.  Your first time running the app will populate some samples to get your started.") + "</p>";
	html += "<p>" + q_("You can choose to scale the image you see on the screen.  This is intended to show you a better comparison of what one eyepiece/telescope combination will be like as compared to another.  The same eyepiece in two different telescopes of differing focal length will produce two different exit circles, changing the view someone.  The trade-off of this is that, with the image scaled, a good deal of the screen can be wasted.  Therefore I recommend that you leave it off, unless you feel you have a need of it.") + "</p>";
	html += "<p>" + q_("You can toggle a crosshair in the view.  Ideally, I wanted this to be aligned to North.  I've been unable to do so.  So currently it aligns to the top of the screen.") + "</p>";
	html += "<p>" + QString(q_("You can toggle a Telrad finder; this can only be done when you have not turned on the Ocular view.  This feature draws three concentric circles of 0.5%1, 2.0%1, and 4.0%1, helping you see what you would expect to see with the naked eye through the Telrad (or similar) finder.")).arg(QChar(0x00B0)) + "</p>";
	html += "<p>" + q_("If you find any issues, please let me know.  Enjoy!") + "</p>";

	//Keys
	html += "<h2>" + q_("Hot Keys") + "</h2>";
	html += "<p>" + q_("The plug-in's key bindings can be edited in the General Tab.") + "</p>";

	StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
	Q_ASSERT(gui);
	QAction* actionOcular = gui->getGuiAction("actionShow_Ocular");
	Q_ASSERT(actionOcular);
	QAction* actionMenu = gui->getGuiAction("actionShow_Ocular_Menu");
	Q_ASSERT(actionMenu);
	QKeySequence ocularShortcut = actionOcular->shortcut();
	QString ocularString = ocularShortcut.toString(QKeySequence::NativeText);
	ocularString = Qt::escape(ocularString);
	if (ocularString.isEmpty())
		ocularString = q_("[no key defined]");
	QKeySequence menuShortcut = actionMenu->shortcut();
	QString menuString = menuShortcut.toString(QKeySequence::NativeText);
	menuString = Qt::escape(menuString);
	if (menuString.isEmpty())
		menuString = q_("[no key defined]");

	html += "<ul>";
	html += "<li>";
	html += QString("<strong>%1:</strong> %2").arg(ocularString).arg(q_("Switches on/off the ocular overlay."));
	html += "</li>";
	
	html += "<li>";
	html += QString("<strong>%1:</strong> %2").arg(menuString).arg(q_("Opens the pop-up navigation menu."));
	html += "</li>";
	html += "</ul>";
	html += "</body></html>";

	QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
	ui->textBrowser->document()->setDefaultStyleSheet(htmlStyleSheet);

	ui->textBrowser->setHtml(html);
}
Esempio n. 2
0
//-------------------------------------
void HotkeysController::applyPreferences() {
  QAction *actions[] = {
      m_mainWindow->ui()->actionPlayPause, m_mainWindow->ui()->actionNext,
      m_mainWindow->ui()->actionPrevious,
      m_mainWindow->ui()->actionAdd_to_favorites,
  };
  qDebug() << "Hotkeys : updating Qxt global shortcuts";
  for (int i = 0; i < 4; ++i) {
    QAction *action = actions[i];
    QxtGlobalShortcut *shortcut = m_shortcuts[i];
    if (shortcut->setShortcut(action->shortcut()))
      qDebug() << "Global shortcut updated: " << action->shortcut() << ":"
               << action->objectName();
  }
}
void QInputOutputDicomdirWidget::createContextMenuQStudyTreeWidget()
{
    QAction *action;

    action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/view.png"), tr("&View"), this, SLOT(view()));
    action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::ViewSelectedStudies));
    (void) new QShortcut(action->shortcut(), this, SLOT(view()));

    action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieve.png"), tr("&Import"), this, SLOT(retrieveSelectedStudies()));
    action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::ImportToLocalDatabaseSelectedDICOMDIRStudies));
    (void) new QShortcut(action->shortcut(), this, SLOT(retrieveSelectedStudies()));

    // Especifiquem que es el menu del dicomdir
    m_studyTreeWidget->setContextMenu(& m_contextMenuQStudyTreeWidget);
}
Esempio n. 4
0
void PropertiesDialog::setupShortcuts()
{
    QList< QString > shortcutKeys = Properties::Instance()->actions.keys();
    int shortcutCount = shortcutKeys.count();

    shortcutsWidget->setRowCount( shortcutCount );

    for( int x=0; x < shortcutCount; x++ )
    {
        QString keyValue = shortcutKeys.at(x);
        QAction *keyAction = Properties::Instance()->actions[keyValue];

        QTableWidgetItem *itemName = new QTableWidgetItem( tr(keyValue.toStdString().c_str()) );
        QTableWidgetItem *itemShortcut = new QTableWidgetItem( keyAction->shortcut().toString() );

        itemName->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );

        shortcutsWidget->setItem(x, 0, itemName);
        shortcutsWidget->setItem(x, 1, itemShortcut);
    }

    shortcutsWidget->resizeColumnsToContents();
/*
    connect(shortcutsWidget, SIGNAL(currentChanged(int, int)),
            this, SLOT(recordAction(int, int)));
    connect(shortcutsWidget, SIGNAL(valueChanged(int, int)),
            this, SLOT(validateAction(int, int)));
*/
}
/*! \reimp */
QString QAccessibleWidget::actionText(int action, Text t, int child) const
{
    if (action == DefaultAction)
        action = SetFocus;

    if (action > 0 && !child) {
        QAction *act = widget()->actions().value(action - 1);
        if (act) {
            switch (t) {
            case Name:
                return act->text();
            case Description:
                return act->toolTip();
#ifndef QT_NO_SHORTCUT
            case Accelerator:
                return act->shortcut().toString();
#endif
            default:
                break;
            }
        }
    }

    return QAccessibleObject::actionText(action, t, child);
}
Esempio n. 6
0
void ShortcutsImpl::slotDefault()
{
    QMainWindow *dial = new QMainWindow;
    Ui::Main ui;
    ui.setupUi(dial);

    QList<QObject*> childrens = dial->children();
    QListIterator<QObject*> iterator(childrens);

    while( iterator.hasNext() )
    {
        QObject *object = iterator.next();
        QAction *action = qobject_cast<QAction*>(object);

        if (action)
        {
            QString text = action->text().remove("&");
            QString shortcut = action->shortcut();
            QList<QTableWidgetItem *> listFind = table->findItems(text , Qt::MatchExactly);
            if( listFind.count() )
                table->item(table->row(listFind.first()), 1)->setText(shortcut);
        }
    }

    delete dial;
}
Esempio n. 7
0
void ActionsEditor::loadFromConfig(QObject *o, QSettings *set) {
	qDebug("ActionsEditor::loadFromConfig");

	set->beginGroup("actions");

	QAction *action;
	QString accelText;

	QList<QAction *> actions = o->findChildren<QAction *>();
	for (int n=0; n < actions.count(); n++) {
		action = static_cast<QAction*> (actions[n]);
		if (!action->objectName().isEmpty() && !action->inherits("QWidgetAction")) {
#if USE_MULTIPLE_SHORTCUTS
			QString current = shortcutsToString(action->shortcuts());
			accelText = set->value(action->objectName(), current).toString();
			action->setShortcuts( stringToShortcuts( accelText ) );
#else
			accelText = set->value(action->objectName(), action->shortcut().toString()).toString();
			action->setShortcut(QKeySequence(accelText));
#endif
		}
    }

	set->endGroup();
}
Esempio n. 8
0
void ScServer::updateToggleRunningAction()
{
    QAction *targetAction = isRunning() ? mActions[Quit] : mActions[Boot];
    mActions[ToggleRunning]->setText( targetAction->text() );
    mActions[ToggleRunning]->setIcon( targetAction->icon() );
    mActions[ToggleRunning]->setShortcut( targetAction->shortcut() );
}
Esempio n. 9
0
void ShortcutsImpl::initTable(MainImpl *main)
{
    QList<QObject*> childrens = main->children();
    QListIterator<QObject*> iterator(childrens);
    int row = 0;

    while( iterator.hasNext() )
    {
        QObject *object = iterator.next();
        QAction *action = qobject_cast<QAction*>(object);

        if (action)
        {
            QString text = action->text().remove("&");

            if ( !text.isEmpty() && !(action->data().toString().contains("Recent|")) )
            {
                QString shortcut = action->shortcut();
                QTableWidgetItem *newItem = new QTableWidgetItem(text);

                newItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
                newItem->setData(Qt::UserRole, addressToVariant(object));
                newItem->setIcon(action->icon());
                table->setRowCount(row+1);
                table->setItem(row, 0, newItem);
                table->setItem(row++, 1, new QTableWidgetItem(shortcut));
            }
        }
        table->sortItems( 0 );
    }

    QHeaderView *header = table->horizontalHeader();
    header->resizeSection( 0, 230 );
    table->verticalHeader()->hide();
}
Esempio n. 10
0
void ActionsManager::setupLocalAction(QAction *localAction, const QLatin1String &globalAction, bool connectTrigger)
{
	if (!localAction)
	{
		return;
	}

	QAction *action = getAction(globalAction);

	if (action)
	{
		localAction->setCheckable(action->isCheckable());
		localAction->setChecked(action->isChecked());
		localAction->setEnabled(action->isEnabled());
		localAction->setIcon(action->icon());
		localAction->setText(action->text());
		localAction->setShortcut(action->shortcut());
		localAction->setObjectName(action->objectName());

		if (connectTrigger)
		{
			connect(localAction, SIGNAL(triggered()), action, SLOT(trigger()));
		}
	}
}
void QInputOutputPacsWidget::createContextMenuQStudyTreeWidget()
{
    QAction *action;

    action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieveAndView.png"), tr("Retrieve && &View"), this,
                                                     SLOT(retrieveAndViewSelectedItemsFromQStudyTreeWidget()));
    action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::RetrieveAndViewSelectedStudies));
    (void) new QShortcut(action->shortcut(), this, SLOT(retrieveAndViewSelectedItemsFromQStudyTreeWidget()));

    action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieve.png"), tr("&Retrieve"), this, SLOT(retrieveSelectedItemsFromQStudyTreeWidget()));
    action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::RetrieveSelectedStudies));
    (void) new QShortcut(action->shortcut(), this, SLOT(retrieveSelectedItemsFromQStudyTreeWidget()));

    // Especifiquem que es el menu del dicomdir
    m_studyTreeWidget->setContextMenu(& m_contextMenuQStudyTreeWidget);
}
Esempio n. 12
0
QKeySequence QActionProto::shortcut() const
{
  QAction *item = qscriptvalue_cast<QAction*>(thisObject());
  if (item)
    return item->shortcut();
  return QKeySequence();
}
bool SearchBar::eventFilter(QObject* object, QEvent* e)
{
    QFocusEvent* focusEvent = 0;

    // HACK This event comes from the ViewContainer when
    // updateViewActions is called. ViewContainer can't
    // check the status of the search box, and so tramples
    // on the QAction we're managing - that is until the
    // ambiguous shortcut dialog box pops up, at which point
    // a focus event is sent to the searchbar and the other
    // stanza in this method is triggered.
    // 414 was the time of day when I named the event.
    bool hack = (object == parent() && e->type() == QEvent::User+414);
    if (hack && hasFocus())
        focusEvent = new QFocusEvent(QEvent::FocusIn);
    else
        focusEvent = dynamic_cast<QFocusEvent*>(e);

    if (focusEvent)
    {
        Application* konvApp = Application::instance();
        QAction * action = static_cast<QAction*>(konvApp->getMainWindow()->actionCollection()->action("focus_input_box"));

        if (action->shortcut().matches(QKeySequence(Qt::Key_Escape)))
        {
            action->setEnabled(focusEvent->lostFocus());
            m_closeShortcut->setEnabled(focusEvent->gotFocus());
        }
    }

    if (hack)
        delete focusEvent;

    return hack;
}
Esempio n. 14
0
void ScProcess::updateToggleRunningAction()
{
    QAction *targetAction = state() == QProcess::NotRunning ? mActions[Start] : mActions[Stop];

    mActions[ToggleRunning]->setText( targetAction->text() );
    mActions[ToggleRunning]->setIcon( targetAction->icon() );
    mActions[ToggleRunning]->setShortcut( targetAction->shortcut() );
}
Esempio n. 15
0
	void updateText()
	{
		QString text = m_action->text();
		text.remove("&");
		QString shortcut = m_action->shortcut().toString();
		if (shortcut != "")
			text += " (" + shortcut + ")";
		setText(0, text);
	}
Esempio n. 16
0
void RatingBox::slotUpdateDescription(int rating)
{
    KXmlGuiWindow* app = dynamic_cast<KXmlGuiWindow*>(kapp->activeWindow());
    if (app)
    {
        QAction* ac = app->actionCollection()->action(QString("rateshortcut-%1").arg(rating));
        if (ac)
            d->shortcut->setText(ac->shortcut().toString());
    }
}
Esempio n. 17
0
//---------------------------------------------------------
// Implementations
//---------------------------------------------------------
//-------------------------------------
HotkeysController::HotkeysController(MainWindow *parent)
    : BaseController("hotkeys", parent) {
  QAction *actions[] = {
      parent->ui()->actionPlayPause, parent->ui()->actionNext,
      parent->ui()->actionPrevious, parent->ui()->actionAdd_to_favorites,
  };
  qDebug() << "Hotkeys: Setting up Qxt global shortcuts";
  for (int i = 0; i < 4; ++i) {
    QAction *action = actions[i];
    QxtGlobalShortcut *shortcut = new QxtGlobalShortcut();
    shortcut->setObjectName(action->objectName());
    if (shortcut->setShortcut(action->shortcut()))
      qDebug() << "Global shortcut registered: " << action->shortcut()
               << "\t: " << action->objectName();
    connect(shortcut, SIGNAL(activated()), action, SLOT(trigger()));
    m_shortcuts.append(shortcut);
  }
#ifdef Q_OS_WIN
  QAction *mediaActions[] = {
      parent->ui()->actionPlayPause, parent->ui()->actionPlayPause,
      parent->ui()->actionNext, parent->ui()->actionPrevious};
  int shortcuts[] = {Qt::Key_MediaPlay, Qt::Key_MediaStop, Qt::Key_MediaNext,
                     Qt::Key_MediaPrevious};
  QStringList names;
  names << "MediaPlay"
        << "MediaStop"
        << "MediaNext"
        << "MediaPrevious";
  qDebug() << "Hotkeys: Setting up Media shortcuts";
  for (int i = 0; i < names.count(); ++i) {
    QAction *action = mediaActions[i];
    QxtGlobalShortcut *shortcut = new QxtGlobalShortcut();
    shortcut->setObjectName(names[i]);
    if (shortcut->setShortcut(shortcuts[i]))
      qDebug() << "Media shortcut registered: " << names[i];
    connect(shortcut, SIGNAL(activated()), action, SLOT(trigger()));
    m_shortcuts.append(shortcut);
  }
#endif
}
Esempio n. 18
0
QVariant pActionsModel::data( const QModelIndex& index, int role ) const
{
    QAction* action = this->action( index );

    if ( !action ) {
        return QVariant();
    }

    switch ( role ) {
        case Qt::DecorationRole:
            switch ( index.column() ) {
                case 0:
                    return action->icon();
                default:
                    break;
            }

            break;
        case Qt::DisplayRole:
        case Qt::ToolTipRole:
            switch ( index.column() ) {
                case pActionsModel::Action:
                    return cleanText( action->text() );
                case pActionsModel::Shortcut:
                    return action->shortcut().toString( QKeySequence::NativeText );
                case pActionsModel::DefaultShortcut:
                    return defaultShortcut( action ).toString( QKeySequence::NativeText );
            }

            break;

        case Qt::FontRole: {
            QFont font = action->font();

            if ( action->menu() ) {
                font.setBold( true );
            }

            return font;
        }

        /*case Qt::BackgroundRole:
            return action->menu() ? QBrush( QColor( 0, 0, 255, 20 ) ) : QVariant();*/

        case pActionsModel::MenuRole:
            return QVariant::fromValue( action->menu() );
        case pActionsModel::ActionRole:
            return QVariant::fromValue( action );
    }

    return QVariant();
}
void QgsConfigureShortcutsDialog::actionChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
{
  Q_UNUSED( current );
  Q_UNUSED( previous );
  // cancel previous shortcut setting (if any)
  setGettingShortcut( false );

  QAction* action = currentAction();
  if ( !action )
    return;

  // show which one is the default action
  QString shortcut = QgsShortcutsManager::instance()->actionDefaultShortcut( action );
  if ( shortcut.isEmpty() )
    shortcut = tr( "None" );
  btnResetShortcut->setText( tr( "Set default (%1)" ).arg( shortcut ) );

  // if there's no shortcut, disable set none
  btnSetNoShortcut->setEnabled( !action->shortcut().isEmpty() );
  // if the shortcut is default, disable set default
  btnResetShortcut->setEnabled( action->shortcut() != QKeySequence( shortcut ) );
}
Esempio n. 20
0
void KeysPage::init() {
	QStringList ids = storage_->actionIDs();
	foreach (QString id, ids) {
		QAction* a = storage_->action(id);
		if ( NULL != a ) {
			QStringList list;
			list << ""<< a->text() << a->shortcut().toString();
			QTreeWidgetItem* item = new QTreeWidgetItem(list);
			item->setIcon(0, a->icon());
			item->setData(3, Qt::UserRole + 1, id);
			ui.keysTree->addTopLevelItem(item);
		}
	}
Esempio n. 21
0
void ActionsDialog::accept()
{
    QStringList shortcuts;
    for (int row = 0; row < (int)actionsList.size(); ++row) {
        QAction *action = actionsList[row];
        action->setShortcut(QKeySequence(actionsTable->item(row, 1)->text()));
        shortcuts.append(action->objectName());
        shortcuts.append(action->shortcut().toString());
    }
    M_PREFS->setShortcuts(shortcuts);

    QDialog::accept();
}
Esempio n. 22
0
ModeStripe::ModeStripe(QAction &modeAction, const QString &text, QWidget *parent)
	: QLabel(("&nbsp;&nbsp;&nbsp;<b>%1</b> - " + tr("press %2 or click here to switch to %3"))
			.arg(text, modeAction.shortcut().toString(), modeAction.property("modeName").toString()), parent)
	, mAction(modeAction)
{
	setFrameShape(QFrame::NoFrame);
	setFrameShadow(QFrame::Plain);
	setLineWidth(0);
	addAction(&modeAction);
	connect(&modeAction, &QAction::changed, this, [&modeAction, this]() {
		setVisible(modeAction.isVisible() && !modeAction.isChecked());
	});
}
Esempio n. 23
0
void KeysPage::init() {
	QStringList ids = storage_->actionIDs();
	foreach (QString id, ids) {
		QAction* a = storage_->action(id);
		if ( NULL != a ) {
			QStringList list;
			// let's remove "&" from action's text to fix #6: Shortcut manager shows extra "&"
			list << ""<< a->text().replace("&", "") << a->shortcut().toString();
			QTreeWidgetItem* item = new QTreeWidgetItem(list);
			item->setIcon(0, a->icon());
			item->setData(3, Qt::UserRole + 1, id);
			ui.keysTree->addTopLevelItem(item);
		}
	}
Esempio n. 24
0
void qtractorOptions::saveActionShortcuts ( QObject *pObject )
{
	m_settings.beginGroup("/Shortcuts/" + pObject->objectName());

	QList<QAction *> actions = pObject->findChildren<QAction *> ();
	QListIterator<QAction *> iter(actions);
	while (iter.hasNext()) {
		QAction *pAction = iter.next();
		if (pAction->objectName().isEmpty())
			continue;
		const QString& sKey = '/' + pAction->objectName();
		const QString& sValue = pAction->shortcut().toString();
		if (!sValue.isEmpty())
			m_settings.setValue(sKey, sValue);
		else
		if (m_settings.contains(sKey))
			m_settings.remove(sKey);
	}

	m_settings.endGroup();
}
Esempio n. 25
0
bool KateViewSpace::eventFilter(QObject *obj, QEvent *event)
{
    QToolButton *button = qobject_cast<QToolButton *>(obj);

    // quick open button: show tool tip with shortcut
    if (button == m_quickOpen && event->type() == QEvent::ToolTip) {
        QHelpEvent *e = static_cast<QHelpEvent *>(event);
        QAction *quickOpen = m_viewManager->mainWindow()->actionCollection()->action(QStringLiteral("view_quick_open"));
        Q_ASSERT(quickOpen);
        QToolTip::showText(e->globalPos(),
                           button->toolTip() + QStringLiteral(" (%1)").arg(quickOpen->shortcut().toString()), button);
        return true;
    }

    // quick open button: What's This
    if (button == m_quickOpen && event->type() == QEvent::WhatsThis) {
        QHelpEvent *e = static_cast<QHelpEvent *>(event);
        const int hiddenDocs = hiddenDocuments();
        QString helpText = (hiddenDocs == 0)
                         ? i18n("Click here to switch to the Quick Open view.")
                         : i18np("Currently, there is one more document open. To see all open documents, switch to the Quick Open view by clicking here.",
                                 "Currently, there are %1 more documents open. To see all open documents, switch to the Quick Open view by clicking here.",
                                 hiddenDocs);
        QWhatsThis::showText(e->globalPos(), helpText, m_quickOpen);
        return true;
    }

    // on mouse press on view space bar tool buttons: activate this space
    if (button && ! isActiveSpace() && event->type() == QEvent::MouseButtonPress) {
        m_viewManager->setActiveSpace(this);
        if (currentView()) {
            m_viewManager->activateView(currentView()->document());
        }
    }
    return false;
}
Esempio n. 26
0
/*!

*/
void
LogPlayerToolBar::createControls( LogPlayer * log_player,
                                  QMainWindow * main_win )
{
    // visible actions
    {
        QAction * act
            = new QAction( QIcon( QPixmap( rew_xpm ) ),
                           tr( "Rewind" ), this );
#ifdef Q_WS_MAC
        act->setShortcut( Qt::META + Qt::Key_Down );
#else
        act->setShortcut( Qt::CTRL + Qt::Key_Down );
#endif
        act->setStatusTip( tr( "Rewind the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( accelerateBack() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( rev_xpm ) ),
                           tr( "Play Backward" ), this );
        act->setShortcut( Qt::Key_Down );
        act->setStatusTip( tr( "Play backward the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( playBack() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( minus_xpm ) ),
                           tr( "Step Back" ), this );
        act->setShortcut( Qt::Key_Left );
        act->setStatusTip( tr( "One step back the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( stepBack() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( stop_xpm ) ),
                           tr( "Play/Stop" ), this );
        act->setShortcut( Qt::Key_Space );
        act->setStatusTip( tr( "Play/Stop the log player. (" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( playOrStop() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( plus_xpm ) ),
                           tr( "Step Forward" ), this );
        act->setShortcut( Qt::Key_Right );
        act->setStatusTip( tr( "One step forward the log player. (" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( stepForward() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( play_xpm ) ),
                           tr( "Play Forward" ), this );
        act->setShortcut( Qt::Key_Up );
        act->setStatusTip( tr( "Play forward the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( playForward() ) );
        this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( QIcon( QPixmap( ff_xpm ) ),
                           tr( "Fast Forward" ), this );
#ifdef Q_WS_MAC
        act->setShortcut( Qt::META + Qt::Key_Up );
#else
        act->setShortcut( Qt::CTRL + Qt::Key_Up );
#endif
        act->setStatusTip( tr( "Fast forward the log player.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( accelerateForward() ) );
        this->addAction( act );
        main_win->addAction( act );
    }

    this->addSeparator();


    // invisible actions
    {
        QAction * act
            = new QAction( //QIcon( QPixmap( go_first_xpm ) ),
                           tr( "Go first" ), this );
        act->setShortcut( Qt::Key_Home );
        act->setStatusTip( tr( "Go to the first.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( goToFirst() ) );
        //this->addAction( act );
        main_win->addAction( act );
    }
    {
        QAction * act
            = new QAction( //QIcon( QPixmap( go_last_xpm ) ),
                           tr( "Go last" ), this );
        act->setShortcut( Qt::Key_End );
        act->setStatusTip( tr( "Go to the last.(" )
                           + act->shortcut().toString() + tr( ")" ) );
        connect( act, SIGNAL( triggered() ),
                 log_player, SLOT( goToLast() ) );
        //this->addAction( act );
        main_win->addAction( act );
    }
}
Esempio n. 27
0
void ActionManagerPrivate::actionTriggered()
{
    QAction *action = qobject_cast<QAction *>(QObject::sender());
    if (action)
        showShortcutPopup(action->shortcut().toString());
}
Esempio n. 28
0
QString configTreeView::loadINI()
{
    QSettings settings(QApplication::applicationDirPath() + "/ananas-designer.ini", QSettings::IniFormat);

    QString projectName;
    settings.beginGroup("Options");
    QString s = settings.value("m_font", m_font.toString()).toString();
    m_font.fromString(s);
    m_tabStopWidth = settings.value("m_tabStopWidth", m_tabStopWidth).toInt();
    m_cppHighlighter = settings.value("m_cppHighlighter", m_cppHighlighter).toBool();
    m_automaticCompilation = settings.value("m_automaticCompilation", m_automaticCompilation).toBool();
    m_lineNumbers = settings.value("m_lineNumbers", m_lineNumbers).toBool();
    m_autoIndent = settings.value("m_autoIndent", m_autoIndent).toBool();
    m_autoCompletion = settings.value("m_autoCompletion", m_autoCompletion).toBool();
    m_autobrackets = settings.value("m_autobrackets", m_autobrackets).toBool();
    // Divius: comments autoclose
    m_autocomments = settings.value("m_autocomments", m_autocomments).toBool();
    //
    m_selectionBorder = settings.value("m_selectionBorder", m_selectionBorder).toBool();
    m_saveBeforeBuild = settings.value("m_saveBeforeBuild", m_saveBeforeBuild).toBool();
    m_restoreOnStart = settings.value("m_restoreOnStart", m_restoreOnStart).toBool();
    m_promptBeforeQuit = settings.value("m_promptBeforeQuit", m_promptBeforeQuit).toBool();
    m_checkEnvironmentOnStartup = settings.value("m_checkEnvironmentOnStartup", m_checkEnvironmentOnStartup).toBool();
    m_autoMaskDocks = settings.value("m_autoMaskDocks", m_autoMaskDocks).toBool();
    m_endLine = (EndLine)settings.value("m_endLine", m_endLine).toInt();
    m_tabSpaces = settings.value("m_tabSpaces", m_tabSpaces).toBool();
    m_match = settings.value("m_match", m_match).toBool();
    m_highlightCurrentLine = settings.value("m_highlightCurrentLine", m_highlightCurrentLine).toBool();
    m_backgroundColor = QColor(settings.value("m_backgroundColor", m_backgroundColor).toString());
    m_textColor = QColor(settings.value("m_textColor", m_textColor).toString());
    m_currentLineColor = QColor(settings.value("m_currentLineColor", m_currentLineColor).toString());
    m_matchingColor = QColor(settings.value("m_matchingColor", m_matchingColor).toString());
    m_projectsDirectory = settings.value("m_projectsDirectory", m_projectsDirectory).toString();
    m_pluginsDirectory = settings.value("m_pluginsDirectory", m_pluginsDirectory).toString();
    m_includeDirectory = settings.value("m_includeDirectory", m_includeDirectory).toString();
    m_documentationDirectory = settings.value("m_documentationDirectory", m_documentationDirectory).toString();
    m_makeOptions = settings.value("m_makeOptions", m_makeOptions).toString();
    m_showTreeClasses = settings.value("m_showTreeClasses", m_showTreeClasses).toBool();
    m_closeButtonInTabs = settings.value("m_closeButtonInTabs", m_closeButtonInTabs).toBool();
    m_displayEditorToolbars = settings.value("m_displayEditorToolbars", m_displayEditorToolbars).toBool();
    //slotUpdateOtherFileActions();
    m_displayWhiteSpaces = settings.value("m_displayWhiteSpaces", m_displayWhiteSpaces).toBool();
    m_rightMarginLine = settings.value("m_rightMarginLine", m_rightMarginLine).toInt();
    m_wordWrap = settings.value("m_wordWrap", m_wordWrap).toBool();
    m_hideFindReplace = settings.value("m_hideFindReplace", m_hideFindReplace).toInt();
    m_smartClick = settings.value("m_smartClick", m_smartClick).toBool();

        //if( !QDir().exists(m_includeDirectory) )
        //{
        //        QMessageBox::warning(0,
        //                "Ananas-designer", tr("The Qt include directory doesn't exist,\nYou can change in Options dialog."), tr("Ok") );
//
       // }
    //setCrossButton( !m_closeButtonInTabs );
    m_intervalUpdatingClasses = settings.value("m_intervalUpdatingClasses", m_intervalUpdatingClasses).toInt();
    if ( m_currentLineColor == Qt::black )
        m_currentLineColor = QColor();
    m_mibCodec = settings.value("m_mibCodec", m_mibCodec).toInt();
    //
    m_formatPreprocessorText.setForeground( QColor(settings.value("m_formatPreprocessorText", m_formatPreprocessorText.foreground().color().name()).toString() ) );
    m_formatQtText.setForeground( QColor(settings.value("m_formatQtText", m_formatQtText.foreground().color().name()).toString() ) );
    m_formatSingleComments.setForeground( QColor(settings.value("m_formatSingleComments", m_formatSingleComments.foreground().color().name()).toString() ) );
    m_formatMultilineComments.setForeground( QColor(settings.value("m_formatMultilineComments", m_formatMultilineComments.foreground().color().name()).toString() ) );
    m_formatQuotationText.setForeground( QColor(settings.value("m_formatQuotationText", m_formatQuotationText.foreground().color().name()).toString() ) );
    m_formatMethods.setForeground( QColor(settings.value("m_formatMethods", m_formatMethods.foreground().color().name()).toString() ) );
    m_formatKeywords.setForeground( QColor(settings.value("m_formatKeywords", m_formatKeywords.foreground().color().name()).toString() ) );
    //actionEditor_mode->setChecked( settings.value("editorMode", actionEditor_mode->isChecked()).toBool() );
    settings.endGroup();

    /* TODO
    if (!m_showTreeClasses) //ToolsOptions/General
        tabExplorer->setTabToolTip( 1, tr("Classes explorer is disabled, please enable it in the Options dialog") );
    else
        tabExplorer->setTabToolTip( 1, "" );
    */
    //m_assistant->setdocumentationDirectory( m_documentationDirectory );
    // Load shortcuts
    settings.beginGroup("Shortcuts");
    QList<QObject*> childrens;
    childrens = children();
    QListIterator<QObject*> iterator(childrens);
    while ( iterator.hasNext() )
    {
        QObject *object = iterator.next();
        QAction *action = qobject_cast<QAction*>(object);

        if ( (action) && (!(action->data().toString().contains( "Recent|" ))) && (!action->objectName().isEmpty()) )
        {
            QString text = object->objectName();

            if ( !text.isEmpty() )
            {
                QString shortcut = action->shortcut();
                shortcut = settings.value(text, shortcut).toString();
                action->setShortcut( shortcut );
            }
        }
    }
    settings.endGroup();

    if ( m_restoreOnStart )
    {
        settings.beginGroup("Project");
        projectName = settings.value("absoluteNameProjectFile").toString();
        settings.endGroup();
    }
    //
    settings.beginGroup("mainwindowstate");
#ifdef Q_OS_WIN32
    // Restores position, size and state for both normal and maximized/fullscreen state. Problems reported unter X11.
    // See Qt doc: Geometry: Restoring a Window's Geometry for details.
    restoreGeometry(settings.value("geometry", saveGeometry()).toByteArray()); // Window geometry and state.
#else
    // Restores position, size and state including maximized/fullscreen.
    move(settings.value("pos", pos()).toPoint()); // Window position.
    resize(settings.value("size", size()).toSize()); // Window size.
    // Note: Yes, the window can be maximized and fullscreen!
    if (settings.value("maximized", isMaximized()).toBool()) // Window maximized.
        setWindowState(windowState() | Qt::WindowMaximized);
    if (settings.value("fullscreen", isFullScreen()).toBool()) // Window fullscreen.
        setWindowState(windowState() | Qt::WindowFullScreen);
#endif
    //restoreState(settings.value("state", saveState()).toByteArray()); // Toolbar and DockWidget state.
    settings.endGroup();

        //settings.beginGroup("editormode");
        //QList<QDockWidget*> dockWidgets = findChildren<QDockWidget*>();
        //foreach( QWidget *w, dockWidgets )
        //        toolbarStatus[w] = settings.value(w->objectName(),w->isVisible()).toBool();
        //settings.endGroup();

    return projectName;
}
Esempio n. 29
0
SalesOrderManager::SalesOrderManager(QWidget* parent)
    : QSplitter(parent)
{
    model = new SalesOrderModel(this);
    proxyModel = new SalesOrderProxyModel(this);
    proxyModel->setSourceModel(model);

    QWidget* container = new QWidget(this);
    QBoxLayout* containerLayout = new QVBoxLayout(container);
    containerLayout->setMargin(0);

    QString actionTooltip("%1<br><b>%2</b>");
    QToolBar* toolBar = new QToolBar(container);
    toolBar->setIconSize(QSize(16, 16));
    QAction* refreshAction = toolBar->addAction(QIcon(":/resources/icons/refresh.png"), "&Muat Ulang", this, SLOT(refresh()));
    refreshAction->setShortcut(QKeySequence("F5"));
    refreshAction->setToolTip(actionTooltip.arg("Muat ulang daftar pesanan").arg(refreshAction->shortcut().toString()));

    QAction* newAction = toolBar->addAction(QIcon(":/resources/icons/plus.png"), "&Baru", this, SLOT(openEditor()));
    newAction->setShortcut(QKeySequence("Ctrl+N"));
    newAction->setToolTip(actionTooltip.arg("Pesanan baru").arg(newAction->shortcut().toString()));

    QAction* closeTabAction = new QAction(this);
    closeTabAction->setShortcuts(QList<QKeySequence>({QKeySequence("Esc"), QKeySequence("Ctrl+W")}));
    addAction(closeTabAction);

    QAction* closeAllTabsAction = new QAction(this);
    closeAllTabsAction->setShortcut(QKeySequence("Ctrl+Shift+W"));
    addAction(closeAllTabsAction);

    containerLayout->addWidget(toolBar);

    QLabel* spacer = new QLabel(toolBar);
    spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    toolBar->addWidget(spacer);

    stateComboBox = new QComboBox(toolBar);
    stateComboBox->setToolTip("Saring daftar pesanan berdasarkan status");
    stateComboBox->addItem("Semua");
    stateComboBox->addItem("Aktif");
    stateComboBox->addItem("Selesai");
    stateComboBox->addItem("Dibatalkan");
    stateComboBox->setCurrentIndex(1);
    toolBar->addWidget(stateComboBox);

    searchEdit = new QLineEdit(toolBar);
    searchEdit->setToolTip("Cari di daftar pesanan");
    searchEdit->setPlaceholderText("Cari");
    searchEdit->setClearButtonEnabled(true);
    searchEdit->setMaxLength(100);
    searchEdit->setMaximumWidth(150);
    toolBar->addWidget(searchEdit);

    view = new QTableView(container);
    view->setToolTip("Klik ganda atau ketuk Enter untuk membuka pesanan");
    view->setModel(proxyModel);
    view->setAlternatingRowColors(true);
    view->setSortingEnabled(true);
    view->setSelectionMode(QAbstractItemView::SingleSelection);
    view->setSelectionBehavior(QAbstractItemView::SelectRows);
    view->setTabKeyNavigation(false);
    QHeaderView* header = view->verticalHeader();
    header->setVisible(false);
    header->setMinimumSectionSize(20);
    header->setMaximumSectionSize(20);
    header->setDefaultSectionSize(20);
    header = view->horizontalHeader();
    header->setToolTip("Klik pada header kolom untuk mengurutkan");
    header->setHighlightSections(false);

    containerLayout->addWidget(view);

    infoLabel = new QLabel(container);
    infoLabel->setStyleSheet("font-style:italic;padding-bottom:1px;");
    infoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
    containerLayout->addWidget(infoLabel);

    tabWidget = new QTabWidget(this);
    tabWidget->setDocumentMode(true);
    tabWidget->setTabsClosable(true);
    tabWidget->setMovable(true);
    tabWidget->hide();

    setCollapsible(0, false);
    setCollapsible(1, false);

    connect(closeTabAction, SIGNAL(triggered(bool)), SLOT(closeCurrentTab()));
    connect(closeAllTabsAction, SIGNAL(triggered(bool)), SLOT(closeAllTabs()));
    connect(tabWidget, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
    connect(stateComboBox, SIGNAL(currentIndexChanged(int)), SLOT(refresh()));
    connect(searchEdit, SIGNAL(textChanged(QString)), SLOT(applyFilter()));
    connect(view, SIGNAL(activated(QModelIndex)), SLOT(edit()));

    QTimer::singleShot(0, this, SLOT(init()));
}
Esempio n. 30
0
void configTreeView::saveINI()
{
    qDebug() << "saveINI()";
    QSettings settings(qApp->applicationDirPath () + "/ananas-designer.ini", QSettings::IniFormat);

    settings.beginGroup("Options");
    settings.setValue("m_showTreeClasses", m_showTreeClasses);
    settings.setValue("m_intervalUpdatingClasses", m_intervalUpdatingClasses);
    settings.setValue("m_automaticCompilation", m_automaticCompilation);
        settings.setValue("m_font", m_font.toString());
    settings.setValue("m_tabStopWidth", m_tabStopWidth);
    settings.setValue("m_cppHighlighter", m_cppHighlighter);
    settings.setValue("m_lineNumbers", m_lineNumbers);
    settings.setValue("m_autoIndent", m_autoIndent);
    settings.setValue("m_selectionBorder", m_selectionBorder);
    settings.setValue("m_saveBeforeBuild", m_saveBeforeBuild);
    settings.setValue("m_restoreOnStart", m_restoreOnStart);
    settings.setValue("m_promptBeforeQuit", m_promptBeforeQuit);
    settings.setValue("m_autoCompletion", m_autoCompletion);
    settings.setValue("m_autobrackets", m_autobrackets);
    // Divius: comments autoclose
    settings.setValue("m_autocomments", m_autocomments);
    //
    settings.setValue("m_closeButtonInTabs", m_closeButtonInTabs);
    settings.setValue("m_match", m_match);
    settings.setValue("m_highlightCurrentLine", m_highlightCurrentLine);
    settings.setValue("m_checkEnvironmentOnStartup", m_checkEnvironmentOnStartup);
    settings.setValue("m_endLine", m_endLine);
    settings.setValue("m_tabSpaces", m_tabSpaces);
    settings.setValue("m_backgroundColor", m_backgroundColor.name());
    settings.setValue("m_textColor", m_textColor.name());
    settings.setValue("m_currentLineColor", m_currentLineColor.name());
    settings.setValue("m_matchingColor", m_matchingColor.name());
    settings.setValue("m_projectsDirectory", m_projectsDirectory);
    settings.setValue("m_pluginsDirectory", m_pluginsDirectory);
    settings.setValue("m_includeDirectory", m_includeDirectory);
    settings.setValue("m_documentationDirectory", m_documentationDirectory);
    settings.setValue("m_makeOptions", m_makeOptions);
    settings.setValue("m_mibCodec", m_mibCodec);
    //
    settings.setValue("m_formatPreprocessorText", m_formatPreprocessorText.foreground().color().name());
    settings.setValue("m_formatQtText", m_formatQtText.foreground().color().name());
    settings.setValue("m_formatSingleComments", m_formatSingleComments.foreground().color().name());
    settings.setValue("m_formatMultilineComments", m_formatMultilineComments.foreground().color().name());
    settings.setValue("m_formatQuotationText", m_formatQuotationText.foreground().color().name());
    settings.setValue("m_formatMethods", m_formatMethods.foreground().color().name());
    settings.setValue("m_formatKeywords", m_formatKeywords.foreground().color().name());
    settings.setValue("m_displayEditorToolbars", m_displayEditorToolbars);
    settings.setValue("m_displayWhiteSpaces", m_displayWhiteSpaces);
    settings.setValue("m_rightMarginLine", m_rightMarginLine);
    //settings.setValue("editorMode", actionEditor_mode->isChecked() );
    settings.setValue("m_wordWrap", m_wordWrap);
    settings.setValue("m_hideFindReplace", m_hideFindReplace);
    settings.setValue("m_smartClick", m_smartClick);
    settings.endGroup();

    // Save shortcuts
    settings.beginGroup("Shortcuts");
    QList<QObject*> childrens;
    childrens = children();
    QListIterator<QObject*> iterator(childrens);
    while ( iterator.hasNext() )
    {
        QObject *object = iterator.next();
        QAction *action = qobject_cast<QAction*>(object);

        if ( (action) && (!(action->data().toString().contains( "Recent|" ))))
        {
            QString text = action->objectName();
            if (!text.isEmpty())
            {
                QString shortcut = action->shortcut();
                settings.setValue( text, shortcut );
            }
        }
    }
    settings.endGroup();

    //if ( !m_projectManager )
    //return;

    //if ( m_restoreOnStart )
    //{
    //    settings.beginGroup("Project");
        //QString projectDirectory;
        //if ( m_projectManager )
        //    projectDirectory = m_projectManager->absoluteNameProjectFile(treeFiles->topLevelItem(0));
        //settings.setValue("absoluteNameProjectFile", projectDirectory);
    //    settings.endGroup();
    //}
    //
    settings.beginGroup("mainwindowstate");
    if (!isMinimized() && !isMaximized() && !isFullScreen())
    {
        settings.setValue("pos", pos());
        settings.setValue("size", size());
    }
    settings.setValue("maximized", isMaximized());
    settings.setValue("fullscreen", isFullScreen());
    settings.setValue("geometry", saveGeometry()); // Window geometry and state (only needed for Windows!).
    //settings.setValue("state", saveState()); // Toolbar and DockWidget state.
    settings.endGroup();

        //settings.beginGroup("editormode");
        //QList<QDockWidget*> dockWidgets = findChildren<QDockWidget*>();
        //foreach( QWidget *w, dockWidgets )
        //        settings.setValue( w->objectName(), toolbarStatus[w] );;
        //settings.endGroup();
}