HydrogensExtension::HydrogensExtension(QObject *parent) : Extension(parent), m_molecule(0)
  {
    QAction *action = new QAction(this);
    action->setText(tr("Add Hydrogens"));
    m_actions.append(action);

    action = new QAction(this);
    action->setText(tr("Add Hydrogens for pH..."));
    m_actions.append(action);

    action = new QAction(this);
    action->setText(tr("Remove Hydrogens"));
    m_actions.append(action);

    action = new QAction( this );
    action->setSeparator(true);
    m_actions.append( action );
  }
Example #2
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setContextMenuPolicy(Qt::ActionsContextMenu);
      setObjectName("palette-box");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

      QAction* a = new QAction(this);
      a->setText(tr("Single Palette"));
      a->setCheckable(true);
      a->setChecked(preferences.singlePalette);
      addAction(a);
      connect(a, SIGNAL(toggled(bool)), SLOT(setSinglePalette(bool)));

      QWidget* w = new QWidget(this);
      w->setContextMenuPolicy(Qt::NoContextMenu);
      QVBoxLayout* vl = new QVBoxLayout(w);
      vl->setMargin(0);
      QHBoxLayout* hl = new QHBoxLayout;
      hl->setContentsMargins(5,5,5,0);

      workspaceList = new QComboBox;
      workspaceList->setToolTip(tr("Select workspace"));
      updateWorkspaces();
      hl->addWidget(workspaceList);
      QToolButton* nb = new QToolButton;

      nb->setMinimumHeight(27);
      nb->setText(tr("+"));
      nb->setToolTip(tr("Add new workspace"));
      hl->addWidget(nb);

      setWidget(w);

      PaletteBoxScrollArea* sa = new PaletteBoxScrollArea;
      sa->setFocusPolicy(Qt::NoFocus);
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      sa->setFrameShape(QFrame::NoFrame);
      vl->addWidget(sa);
      vl->addLayout(hl);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

      connect(nb, SIGNAL(clicked()), SLOT(newWorkspaceClicked()));
      connect(workspaceList, SIGNAL(activated(int)), SLOT(workspaceSelected(int)));
      }
Example #3
0
void menuSchedule::addActionsToMenu(actionProperties acts[], unsigned int numElems)
{
  QAction * m = 0;
  for (unsigned int i = 0; i < numElems; i++)
  {
    if (! acts[i].visible)
    {
      continue;
    }
    else if (acts[i].actionName == QString("menu"))
    {
      m = acts[i].menu->addMenu((QMenu*)(acts[i].slot));
      if(m)
        m->setText(acts[i].actionTitle);
    }
    else if (acts[i].actionName == QString("separator"))
    {
      acts[i].menu->addSeparator();
    }
    else if ((acts[i].toolBar != NULL) && (!acts[i].toolTip.isEmpty()))
    {
      new Action( parent,
                  acts[i].actionName,
                  acts[i].actionTitle,
                  this,
                  acts[i].slot,
                  acts[i].menu,
                  acts[i].priv,
                  (acts[i].pixmap),
                  acts[i].toolBar,
                  acts[i].toolTip) ;
    }
    else if (acts[i].toolBar != NULL)
    {
      new Action( parent,
                  acts[i].actionName,
                  acts[i].actionTitle,
                  this,
                  acts[i].slot,
                  acts[i].menu,
                  acts[i].priv,
                  (acts[i].pixmap),
                  acts[i].toolBar,
                  acts[i].actionTitle) ;
    }
    else
    {
      new Action( parent,
                  acts[i].actionName,
                  acts[i].actionTitle,
                  this,
                  acts[i].slot,
                  acts[i].menu,
                  acts[i].priv ) ;
    }
  }
}
  PackmolExtension::PackmolExtension(QObject *parent) : Extension(parent), 
      m_molecule(0), m_dialog(0)
  {  
    QAction *action = new QAction(this);
    action->setText(tr("Packmol"));
    m_actions.append(action);

    createDialog();
  }
Example #5
0
void KBlocksWin::setupGUILayout()
{
    QAction *action;

    action = KStandardGameAction::gameNew(this, SLOT(singleGame()), actionCollection());
    action->setText(i18n("Single Game"));
    actionCollection()->addAction(QStringLiteral("newGame"), action);

    action = new QAction(this);
    action->setText(i18n("Human vs AI"));
    actionCollection()->addAction(QStringLiteral("pve_step"), action);
    connect(action, &QAction::triggered, this, &KBlocksWin::pveStepGame);

    m_pauseAction = KStandardGameAction::pause(this, SLOT(pauseGame()), actionCollection());
    actionCollection()->addAction(QStringLiteral("pauseGame"), m_pauseAction);
    m_pauseAction->setEnabled(false);

    action = KStandardGameAction::highscores(this, SLOT(showHighscore()), actionCollection());
    actionCollection()->addAction(QStringLiteral("showHighscores"), action);

    action = KStandardGameAction::quit(this, SLOT(close()), actionCollection());
    actionCollection()->addAction(QStringLiteral("quit"), action);

    KStandardAction::preferences(this, SLOT(configureSettings()), actionCollection());

    KToggleAction *soundAction = new KToggleAction(i18n("&Play sounds"), this);
    soundAction->setChecked(Settings::sounds());
    actionCollection()->addAction(QStringLiteral("sounds"), soundAction);
    connect(soundAction, &KToggleAction::triggered, this, &KBlocksWin::setSoundsEnabled);

    // TODO
    mScore = new QLabel(i18n("Points: 0 - Lines: 0 - Level: 0"));
    statusBar()->addPermanentWidget(mScore);
    connect(mpGameScene, &KBlocksScene::scoreChanged, this, &KBlocksWin::onScoreChanged);
    connect(mpGameScene, &KBlocksScene::isHighscore, this, &KBlocksWin::onIsHighscore);

    Kg::difficulty()->addStandardLevelRange(
        KgDifficultyLevel::Easy, KgDifficultyLevel::Hard
    );
    KgDifficultyGUI::init(this);
    connect(Kg::difficulty(), &KgDifficulty::currentLevelChanged, this, &KBlocksWin::levelChanged);

    setupGUI();
}
void tst_QActionGroup::separators()
{
    QMainWindow mw;
    QMenu menu(&mw);
    QActionGroup actGroup(&mw);

    mw.show();

#ifdef QT_SOFTKEYS_ENABLED
    // Softkeys add extra "Select" and "Back" actions to menu by default.
    // Two first actions will be Select and Back when softkeys are enabled
    int numSoftkeyActions = 2;
#else
    int numSoftkeyActions = 0;
#endif

    QAction *action = new QAction(&actGroup);
    action->setText("test one");

    QAction *separator = new QAction(&actGroup);
    separator->setSeparator(true);
    actGroup.addAction(separator);

    QListIterator<QAction*> it(actGroup.actions());
    while (it.hasNext())
        menu.addAction(it.next());

    QCOMPARE((int)menu.actions().size(), 2 + numSoftkeyActions);

    it = QListIterator<QAction*>(actGroup.actions());
    while (it.hasNext())
        menu.removeAction(it.next());

    QCOMPARE((int)menu.actions().size(), 0 + numSoftkeyActions);

    action = new QAction(&actGroup);
    action->setText("test two");

    it = QListIterator<QAction*>(actGroup.actions());
    while (it.hasNext())
        menu.addAction(it.next());

    QCOMPARE((int)menu.actions().size(), 3 + numSoftkeyActions);
}
Example #7
0
LogWidget::LogWidget(QWidget *parent) 
 : QMainWindow(parent) {
	m_contents = new QTextEdit(this);
	QFont font("Monospace");
	font.setStyleHint(QFont::TypeWriter);
	m_contents->setFont(font);
	m_contents->setReadOnly(true);
	QPalette palette;
	palette.setColor(QPalette::Base, Qt::black);
	m_contents->setPalette(palette);
	setPalette(palette);
	QToolBar *toolBar = new QToolBar(this);
	toolBar->setMovable(false);
	toolBar->setAllowedAreas(Qt::TopToolBarArea);
	toolBar->setIconSize(QSize(32, 32));
	toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
	toolBar->setFloatable(false);

	QAction *actionShowStats = new QAction(this);
	QIcon showStatsIcon;
	showStatsIcon.addFile(QString::fromUtf8(":/resources/showStats.png"), QSize(), QIcon::Normal, QIcon::Off);
	actionShowStats->setIcon(showStatsIcon);
    actionShowStats->setToolTip(tr("Show statistics"));
    actionShowStats->setText(tr("Show Statistics"));
	connect(actionShowStats, SIGNAL(triggered()), this, SLOT(onShowStats()));
	toolBar->addAction(actionShowStats);
	QAction *actionClear = new QAction(this);
	QIcon clearIcon;
	clearIcon.addFile(QString::fromUtf8(":/resources/clear.png"), QSize(), QIcon::Normal, QIcon::Off);
	actionClear->setIcon(clearIcon);
    actionClear->setToolTip(tr("Clear"));
    actionClear->setText(tr("Clear"));
	connect(actionClear, SIGNAL(triggered()), m_contents, SLOT(clear()));
	toolBar->addAction(actionClear);
#if defined(__OSX__)
	toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif

    addToolBar(Qt::TopToolBarArea, toolBar);
	setCentralWidget(m_contents);
    setUnifiedTitleAndToolBarOnMac(true);
	setWindowTitle(tr("Log"));
	resize(QSize(1000, 500));
}
Example #8
0
void SearchLaunch::init()
{
    Containment::init();
    connect(this, SIGNAL(appletAdded(Plasma::Applet*,QPointF)),
            this, SLOT(layoutApplet(Plasma::Applet*,QPointF)));
    connect(this, SIGNAL(appletRemoved(Plasma::Applet*)),
            this, SLOT(appletRemoved(Plasma::Applet*)));

    connect(this, SIGNAL(toolBoxVisibilityChanged(bool)), this, SLOT(updateConfigurationMode(bool)));


    setToolBox(Plasma::AbstractToolBox::load(corona()->preferredToolBoxPlugin(Plasma::Containment::DesktopContainment), QVariantList(), this));

    QAction *a = action("add widgets");
    if (a) {
        addToolBoxAction(a);
    }


    if (toolBox()) {
        connect(toolBox(), SIGNAL(toggled()), this, SIGNAL(toolBoxToggled()));
        connect(toolBox(), SIGNAL(visibilityChanged(bool)), this, SIGNAL(toolBoxVisibilityChanged(bool)));
        toolBox()->show();
    }

    a = action("configure");
    if (a) {
        addToolBoxAction(a);
        a->setText(i18n("Configure Search and Launch"));
    }


    QAction *lockAction = 0;
    if (corona()) {
        lockAction = corona()->action("lock widgets");
    }

    if (!lockAction || !lockAction->isEnabled()) {
        lockAction = new QAction(this);
        addAction("lock page", lockAction);
        lockAction->setText(i18n("Lock Page"));
        lockAction->setIcon(KIcon("object-locked"));
        QObject::connect(lockAction, SIGNAL(triggered(bool)), this, SLOT(toggleImmutability()));
    }
KindleMainWindow::KindleMainWindow(Config::Class & cfg_) :
    ui(new Ui::MainWindow),
    cfg( cfg_ ),
    dictionaryBar( this, configEvents, cfg.editDictionaryCommandLine ),
    articleMaker( dictionaries, groupInstances, cfg.preferences.displayStyle ),
    articleNetMgr( this, dictionaries, articleMaker,
                   cfg.preferences.disallowContentFromOtherSites ),
    dictNetMgr( this ),
    wordFinder( this )
{
    qDebug() << "DISPLAY STYLE" << cfg.preferences.displayStyle;
    applyQtStyleSheet( cfg.preferences.displayStyle );
    ui->setupUi(this);

    QAction * actionClose = ui->actionClose;
    actionClose->setShortcut(Qt::ALT + Qt::Key_Escape);
    actionClose->setText(tr("Close") + "\tAlt+Back");
    addAction(actionClose);

    QAction * actionSelect = ui->actionSelect;
    actionSelect->setShortcut(Qt::Key_Select);
    ui->translateLine->addAction(actionSelect);

    connect( ui->translateLine, SIGNAL( textChanged( QString const & ) ),
               this, SLOT( translateInputChanged( QString const & ) ) );
    connect( ui->translateLine, SIGNAL( returnPressed() ),
             this, SLOT( translateInputFinished() ) );

    articleView = new ArticleView( this, articleNetMgr, dictionaries,
                                            groupInstances, false, cfg,
                                            dictionaryBar.toggleViewAction(),
                                            groupList );
    wordList = new QListWidget( this );

    ui->stackedWidget->addWidget(articleView);
    ui->stackedWidget->addWidget(wordList);

    connect( articleView, SIGNAL( typingEvent( QString const & ) ),
               this, SLOT( typingEvent( QString const & ) ) );

    // install filters
    ui->translateLine->installEventFilter( this );
    wordList->installEventFilter( this );
    wordList->viewport()->installEventFilter( this );

    connect( &wordFinder, SIGNAL( updated() ),
             this, SLOT( prefixMatchUpdated() ) );
    connect( &wordFinder, SIGNAL( finished() ),
             this, SLOT( prefixMatchFinished() ) );

    makeDictionaries();

    articleView->showDefinition( tr( "Welcome!" ), Instances::Group::HelpGroupId );

    ui->translateLine->setFocus();
}
TerrainEditTool::TerrainEditTool(EditScene *editScene, QObject *parent)
    : EditTool(editScene, parent),
      _item(0)
{
    QAction *newPolygonAction = new QAction(this);
    newPolygonAction->setText(tr("New Polygon"));
    connect(newPolygonAction, SIGNAL(triggered()), this, SLOT(startNewPolygon()));
    _actions.append(newPolygonAction);
    initTerrain(editScene->getLevel()->getTerrain());
}
Example #11
0
void KDEDKSysGuard::init()
{
    KActionCollection* actionCollection = new KActionCollection(this);

    QAction* action = actionCollection->addAction(QStringLiteral("Show System Activity"));
    action->setText(i18n("Show System Activity"));
    connect(action, &QAction::triggered, this, &KDEDKSysGuard::showTaskManager);

    KGlobalAccel::self()->setGlobalShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_Escape));
}
Example #12
0
Kontomierz::Kontomierz()
{
    QLabel* l = new QLabel( this );
    l->setText( "Hello World!" );
    setCentralWidget( l );
    QAction* a = new QAction(this);
    a->setText( "Quit" );
    connect(a, SIGNAL(triggered()), SLOT(close()) );
    menuBar()->addMenu( "File" )->addAction( a );
}
Example #13
0
//VOXOX CHANGE by Rolando - 2009.10.23 
void QtContactNetworkMenu::buildContactMenuNetwork() 
{
	QtEnumIMProtocol::IMProtocol protocol = _cWengoPhone.getCUserProfileHandler().getCUserProfile()->getCContactList().getContactQtProtocol(_contactId);

	QAction * chatAction	  = new QAction(tr("Chat"),   this);
	QAction * socialWebAction = new QAction(tr("Social"), this);
	
	SAFE_CONNECT(chatAction,      SIGNAL(triggered()), SLOT(chatButtonClicked()));
	SAFE_CONNECT(socialWebAction, SIGNAL(triggered()), SLOT(webProfileContactClicked()));
	
	if(protocol == QtEnumIMProtocol::IMProtocolVoxOx)
	{
		QAction * callWithVideo =  new QAction(tr("Call with Video"), this);
		SAFE_CONNECT(callWithVideo, SIGNAL(triggered()), SLOT(callButtonClicked()));

		QAction * editContact =  new QAction(tr("Edit Contact"), this);
		SAFE_CONNECT(editContact, SIGNAL(triggered()), SLOT(profileContactClicked()));

		addAction(callWithVideo);
		addAction(editContact);

		return;
		
	}
	addAction(chatAction);

	if(protocol ==QtEnumIMProtocol::IMProtocolTwitter)
	{
		chatAction->setText(tr("Reply to"));
		socialWebAction->setText(tr("Twitter Profile"));
		addAction(socialWebAction);
	}
	else if(protocol ==QtEnumIMProtocol::IMProtocolFacebook)
	{
		socialWebAction->setText(tr("Facebook Profile"));
		addAction(socialWebAction);
	}
	else if(protocol ==QtEnumIMProtocol::IMProtocolMYSPACE)
	{
		socialWebAction->setText(tr("MySpace Profile"));
		addAction(socialWebAction);
	}
}
void FrameLabel::createContextMenu()
{
    // Create top-level menu object
    menu = new QMenu(this);
    // Add actions
    QAction *action;
    action = new QAction(this);
    action->setText(tr("Reset ROI"));
    menu->addAction(action);
    action = new QAction(this);
    action->setText(tr("Scale to Fit Frame"));
    action->setCheckable(true);
    menu->addAction(action);
    menu->addSeparator();
    // Create image processing menu object
    QMenu* menu_imgProc = new QMenu(this);
    menu_imgProc->setTitle("Image Processing");
    menu->addMenu(menu_imgProc);
    // Add actions
    action = new QAction(this);
    action->setText(tr("Grayscale"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Smooth"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Dilate"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Erode"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Flip"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    action = new QAction(this);
    action->setText(tr("Canny"));
    action->setCheckable(true);
    menu_imgProc->addAction(action);
    menu_imgProc->addSeparator();
    action = new QAction(this);
    action->setText(tr("Settings..."));
    menu_imgProc->addAction(action);
}
/**
 * Create an action for an entry in the context menu.
 * @param text     the text of the action
 * @param method   the method to call when triggered
 * @param icon     the shown icon
 * @return         the created action
 */
QAction* RefactoringAssistant::createAction(const QString& text, const char * method, const Icon_Utils::IconType icon)
{
    Q_UNUSED(method);
    QAction* action = new QAction(this);
    action->setText(text);
    if (icon != Icon_Utils::N_ICONTYPES) {
        action->setIcon(Icon_Utils::SmallIcon(icon));
    }
    return action;
}
Example #16
0
void LoginDialog::toggleAction() {
    auto accountManager = DependencyManager::get<AccountManager>();
    QAction* loginAction = Menu::getInstance()->getActionForOption(MenuOption::Login);
    Q_CHECK_PTR(loginAction);
    static QMetaObject::Connection connection;
    if (connection) {
        disconnect(connection);
    }

    if (accountManager->isLoggedIn()) {
        // change the menu item to logout
        loginAction->setText("Logout " + accountManager->getAccountInfo().getUsername());
        connection = connect(loginAction, &QAction::triggered, accountManager.data(), &AccountManager::logout);
    } else {
        // change the menu item to login
        loginAction->setText("Log In / Sign Up");
        connection = connect(loginAction, &QAction::triggered, [] { LoginDialog::showWithSelection(); });
    }
}
Example #17
0
void Window::updateTrayMenu(bool force) {
    if (!trayIconMenu || (cPlatform() == dbipWindows && !force)) return;

    bool active = isActive(false);
    if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
        QAction *first = trayIconMenu->actions().at(0);
        first->setText(lang(active ? lng_minimize_to_tray : lng_open_from_tray));
        disconnect(first, SIGNAL(triggered(bool)), 0, 0);
        connect(first, SIGNAL(triggered(bool)), this, active ? SLOT(minimizeToTray()) : SLOT(showFromTray()));
    } else {
Example #18
0
void KrPopupMenu::addCreateNewMenu()
{
    createNewPopup.addAction(krLoader->loadIcon("folder", KIconLoader::Small), i18n("Folder..."))->setData(QVariant(MKDIR_ID));
    createNewPopup.addAction(krLoader->loadIcon("text-plain", KIconLoader::Small), i18n("Text File..."))->setData(QVariant(NEW_TEXT_FILE_ID));

    QAction *newAct = addMenu(&createNewPopup);
    newAct->setData(QVariant(CREATE_NEW_ID));
    newAct->setText(i18n("Create New"));

}
void TextBrowserHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
{
    for (int i = 1; i <= m_textBrowser->forwardHistoryCount(); ++i) {
        QAction *action = new QAction(forwardMenu);
        action->setText(m_textBrowser->historyTitle(i));
        action->setData(i);
        connect(action, &QAction::triggered, this, &TextBrowserHelpViewer::goToHistoryItem);
        forwardMenu->addAction(action);
    }
}
Example #20
0
void radeon_profile::setupContextMenus() {
    QAction *copyToClipboard = new QAction(this);
    copyToClipboard->setText(tr("Copy to clipboard"));
    ui->list_glxinfo->setContextMenuPolicy(Qt::ActionsContextMenu);
    ui->list_glxinfo->addAction(copyToClipboard);
    connect(copyToClipboard, SIGNAL(triggered()),this,SLOT(copyGlxInfoToClipboard()));

    QAction * copyConnectors = new QAction(this);
    copyConnectors->setText(tr("Copy to clipboard"));
    ui->list_connectors->setContextMenuPolicy(Qt::ActionsContextMenu);
    ui->list_connectors->addAction(copyConnectors);
    connect(copyConnectors, SIGNAL(triggered()), this, SLOT(copyConnectorsToClipboard()));

    QAction *reset = new QAction(this);
    reset->setText(tr("Reset statistics"));
    ui->list_stats->setContextMenuPolicy(Qt::ActionsContextMenu);
    ui->list_stats->addAction(reset);
    connect(reset,SIGNAL(triggered()),this,SLOT(resetStats()));
}
Example #21
0
QAction *PQMenu::addAction(const QString &text) {
    QAction *action = new PQAction;
    action->setText(text);

    pq_registerQObject(action);

    addAction(action);

    return action;
}
void TextBrowserHelpViewer::addBackHistoryItems(QMenu *backMenu)
{
    for (int i = 1; i <= m_textBrowser->backwardHistoryCount(); ++i) {
        QAction *action = new QAction(backMenu);
        action->setText(m_textBrowser->historyTitle(-i));
        action->setData(-i);
        connect(action, SIGNAL(triggered()), this, SLOT(goToHistoryItem()));
        backMenu->addAction(action);
    }
}
Example #23
0
void
PhotosApplet::init()
{
    DEBUG_BLOCK

    // Call the base implementation.
    Context::Applet::init();

    // Create label
    enableHeader( true );
    setHeaderText( i18n( "Photos" ) );

    // Set the collapse size
    setCollapseHeight( m_header->height() );
    setCollapseOffHeight( 220 );
    setMaximumHeight( 220 );
    setMinimumHeight( collapseHeight() );
    setPreferredHeight( collapseHeight() );

    // Icon
    QAction* settingsAction = new QAction( this );
    settingsAction->setIcon( KIcon( "preferences-system" ) );
    settingsAction->setVisible( true );
    settingsAction->setEnabled( true );
    settingsAction->setText( i18n( "Settings" ) );
    m_settingsIcon = addRightHeaderAction( settingsAction );
    connect( m_settingsIcon, SIGNAL( clicked() ), this, SLOT( showConfigurationInterface() ) );

    m_widget = new PhotosScrollWidget( this );
    m_widget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    m_widget->setContentsMargins( 0, 0, 0, 0 );
    connect( m_widget, SIGNAL(photoAdded()), SLOT(photoAdded()) );

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical, this );
    layout->addItem( m_header );
    layout->addItem( m_widget );

    // Read config and inform the engine.
    KConfigGroup config = Amarok::config("Photos Applet");
    m_nbPhotos = config.readEntry( "NbPhotos", "10" ).toInt();
    m_Animation = config.readEntry( "Animation", "Fading" );
    m_KeyWords = config.readEntry( "KeyWords", QStringList() );

    if( m_Animation == i18nc( "animation type", "Automatic" ) )
        m_widget->setMode( 0 );
    else if( m_Animation == i18n( "Interactive" ) )
        m_widget->setMode( 1 );
    else // fading
        m_widget->setMode( 2 );

    Plasma::DataEngine *engine = dataEngine( "amarok-photos" );
    engine->setProperty( "fetchSize", m_nbPhotos );
    engine->setProperty( "keywords", m_KeyWords );
    engine->connectSource( "photos", this );
}
Example #24
0
void SearchListView::setupUsers() {
	mUsersMenu->clear();

	QStringList users;
	QTreeWidgetItemIterator it(this, QTreeWidgetItemIterator::Selected | QTreeWidgetItemIterator::NotHidden);

	while (*it) {
		SearchListItem* item = dynamic_cast<SearchListItem*>(*it);

		if(item && users.indexOf(item->user()) == -1)
		{
			users << item->user();
		}
		++it;
	}


    int numusers = users.size();
    mPopupMenu->removeAction(mUsersMenu->menuAction());
    delete mUsersMenu;
    if (numusers <= 0) {
        mUsersMenu = mPopupMenu->addMenu(tr("Users"));
        return;
    }
    else if (numusers == 1) {
        mUsersMenu = new Usermenu(mPopupMenu);
        dynamic_cast<Usermenu*>(mUsersMenu)->setup(users.first());
        QAction * usermenu = mPopupMenu->addMenu(mUsersMenu);
        usermenu->setText(tr("User '%1'").arg(users.first()));
    }
    else {
        QStringListIterator usersIt(users);
        mUsersMenu = mPopupMenu->addMenu(tr("Users"));
        while (usersIt.hasNext()) {
            QString username = usersIt.next();
            Usermenu *m = new Usermenu(mUsersMenu);
            m->setup(username);
            QAction * usermenu = mUsersMenu->addMenu(static_cast<QMenu*>(m));
            usermenu->setText(username);
        }
    }
}
Example #25
0
void KBlocksWin::setupGUILayout()
{
    QAction *action;
    
    action = KStandardGameAction::gameNew(this, SLOT(singleGame()), actionCollection());
    action->setText(i18n("Single Game"));
    actionCollection()->addAction( QLatin1String( "newGame" ), action);
    
    action = new KAction(this);
    action->setText(i18n("Human vs AI"));
    actionCollection()->addAction( QLatin1String( "pve_step" ), action);
    connect(action, SIGNAL(triggered(bool)), this, SLOT(pveStepGame()));
    
    m_pauseAction = KStandardGameAction::pause(this, SLOT(pauseGame()), actionCollection());
    actionCollection()->addAction( QLatin1String( "pauseGame" ), m_pauseAction);
    
    action = KStandardGameAction::highscores(this, SLOT(showHighscore()), actionCollection());
    actionCollection()->addAction( QLatin1String( "showHighscores" ), action);
    
    action = KStandardGameAction::quit(this, SLOT(close()), actionCollection());
    actionCollection()->addAction( QLatin1String( "quit" ), action);
    
    KStandardAction::preferences(this, SLOT(configureSettings()), actionCollection());
    
    KAction* soundAction = new KToggleAction(i18n("&Play sounds"), this);
    soundAction->setChecked(Settings::sounds());
    actionCollection()->addAction( QLatin1String( "sounds" ), soundAction);
    connect(soundAction, SIGNAL(triggered(bool)), this, SLOT(setSoundsEnabled(bool)));
    
    // TODO
    statusBar()->insertItem( i18n("Points: 0 - Lines: 0 - Level: 0"), 0 );
    connect(mpGameScene, SIGNAL(scoreChanged(int,int,int,int)), this,  SLOT(onScoreChanged(int,int,int,int)));
    connect(mpGameScene, SIGNAL(isHighscore(int,int,int)), this,  SLOT(onIsHighscore(int,int,int)));
    
    Kg::difficulty()->addStandardLevelRange(
        KgDifficultyLevel::Easy, KgDifficultyLevel::Hard
    );
    KgDifficultyGUI::init(this);
    connect(Kg::difficulty(), SIGNAL(currentLevelChanged(const KgDifficultyLevel*)), SLOT(levelChanged()));
    
    setupGUI();
}
Example #26
0
QAction *SplitWindowStyle::addToolWindow(LiteApi::IApplication *app,Qt::DockWidgetArea area, QWidget *widget, const QString &id, const QString &title, bool split, QList<QAction*> widgetActions)
{
//    QMap<QString,SplitInitToolSate>::iterator it = m_initIdStateMap.find(id);
//    if (it != m_initIdStateMap.end()) {
//        area = it.value().area;
//        split = it.value().split;
//    }
    area = (Qt::DockWidgetArea)m_liteApp->settings()->value("split_area/"+id,area).toInt();
    split = m_liteApp->settings()->value("split_split/"+id,split).toBool();


    SplitActionToolBar *actToolBar = m_areaToolBar.value(area);
    QAction *action = new QAction(this);
    action->setText(title);
    action->setCheckable(true);
    action->setObjectName(id);

    SplitActionState *state = new SplitActionState;
    state->area = area;
    state->split = split;
    state->widget = widget;
    state->widgetActions = widgetActions;
    state->id = id;
    state->title = title;

    actToolBar->addAction(action,title,split);

    int index = m_actStateMap.size();
    if (index <= 9) {
        action->setText(QString("%1: %2").arg(index).arg(title));
        QKeySequence ks(LiteApi::UseMacShortcuts?QString("Ctrl+Alt+%1").arg(index):QString("Alt+%1").arg(index));
        LiteApi::IActionContext *actionContext = app->actionManager()->getActionContext(app,"App");
        actionContext->regAction(action,"ToolWindow_"+id,ks.toString());
    }
    m_actStateMap.insert(action,state);    

    connect(action,SIGNAL(toggled(bool)),this,SLOT(toggledAction(bool)));
    if (m_windowMenu) {
        m_windowMenu->addAction(action);
    }
    return action;
}
Example #27
0
  H2MethylExtension::H2MethylExtension(QObject *parent) : Extension(parent),
    m_molecule(0)
  {
    QAction *action = new QAction(this);
    action->setText(tr("Change H to Methyl"));
    m_actions.append(action);

    action = new QAction( this );
    action->setSeparator(true);
    m_actions.append( action );
  }
Example #28
0
void ClangSupport::createActionsForMainWindow (Sublime::MainWindow* /*window*/, QString& _xmlFile, KActionCollection& actions)
{
    _xmlFile = xmlFile();

    QAction* renameDeclarationAction = actions.addAction(QStringLiteral("code_rename_declaration"));
    renameDeclarationAction->setText( i18n("Rename Declaration") );
    renameDeclarationAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
    actions.setDefaultShortcut(renameDeclarationAction, Qt::CTRL | Qt::SHIFT | Qt::Key_R);
    connect(renameDeclarationAction, &QAction::triggered,
            m_refactoring, &BasicRefactoring::executeRenameAction);
}
 virtual QList<QAction*> addNewActions(QObject* parent,
                                       const QList<KConfigGroup>& existingModules,
                                       const QVariant& unused)
 {
     Q_UNUSED(unused);
     Q_UNUSED(existingModules);
     QAction* action = new QAction(parent);
     action->setText(i18nc("@action:inmenu Add", "Web Sidebar Module"));
     action->setIcon(KIcon("internet-web-browser"));
     return QList<QAction *>() << action;
 }
Example #30
0
void
LatchManager::unlatchRequest( const source_ptr& source )
{
    Q_UNUSED( source );
    AudioEngine::instance()->stop();
    AudioEngine::instance()->setPlaylist( Tomahawk::playlistinterface_ptr() );

    QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" );
    latchOnAction->setText( tr( "&Listen Along" ) );
    latchOnAction->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) );
}