void dlgPackageExporter::listActions() { ActionUnit* tu = mpHost->getActionUnit(); list<TAction *>::const_iterator it; std::list<TAction *> tList = tu->getActionRootNodeList(); QList<QTreeWidgetItem *> items = treeWidget->findItems(QString("Buttons"), Qt::MatchExactly, 0); QTreeWidgetItem * top = items.first(); for(it = tList.begin(); it != tList.end(); it++) { TAction * pChild = *it; QStringList sl; sl << pChild->getName(); QTreeWidgetItem * pItem = new QTreeWidgetItem(sl); pItem->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsTristate|Qt::ItemIsEnabled|Qt::ItemIsSelectable); pItem->setCheckState(0, Qt::Unchecked); actionMap.insert(pItem, pChild); top->addChild(pItem); recurseActions(pChild, pItem); } }
void XMLimport::readActionGroup( TAction * pParent ) { TAction * pT; if( pParent ) { pT = new TAction( pParent, mpHost ); } else { pT = new TAction( 0, mpHost ); } mpHost->getActionUnit()->registerAction( pT ); pT->setIsActive( ( attributes().value("isActive") == "yes" ) ); pT->mIsFolder = ( attributes().value("isFolder") == "yes" ); pT->mIsPushDownButton = ( attributes().value("isPushButton") == "yes" ); pT->mButtonFlat = ( attributes().value("isFlatButton") == "yes" ); pT->mUseCustomLayout = ( attributes().value("useCustomLayout") == "yes" ); if (module) pT->mModuleMember = true; while( ! atEnd() ) { readNext(); if( isEndElement() ) break; if( isStartElement() ) { if( name() == "name" ) { pT->mName = readElementText(); continue; } else if( name() == "packageName") { pT->mPackageName = readElementText(); continue; } else if( name() == "script") { QString script = readElementText(); pT->setScript( script ); continue; } else if( name() == "css") { pT->css = readElementText(); continue; } else if( name() == "commandButtonUp") { pT->mCommandButtonUp = readElementText(); continue; } else if( name() == "commandButtonDown") { pT->mCommandButtonDown = readElementText(); continue; } else if( name() == "icon") { pT->mIcon = readElementText(); continue; } else if( name() == "orientation") { pT->mOrientation = readElementText().toInt(); continue; } else if( name() == "location") { pT->mLocation = readElementText().toInt(); continue; } else if( name() == "buttonRotation") { pT->mButtonRotation = readElementText().toInt(); continue; } else if( name() == "sizeX") { pT->mSizeX = readElementText().toInt(); continue; } else if( name() == "sizeY") { pT->mSizeY = readElementText().toInt(); continue; } else if( name() == "mButtonState") { pT->mButtonState = readElementText().toInt(); continue; } else if( name() == "buttonColor") { pT->mButtonColor.setNamedColor( readElementText() ); continue; } else if( name() == "buttonColumn") { pT->mButtonColumns = readElementText().toInt(); continue; } else if( name() == "posX") { pT->mPosX = readElementText().toInt(); continue; } else if( name() == "posY") { pT->mPosY = readElementText().toInt(); continue; } else if( name() == "ActionGroup" ) { readActionGroup( pT ); } else if( name() == "Action" ) { readActionGroup( pT ); } else { readUnknownActionElement(); } } } }
void TupMainWindow::setupFileActions() { TAction *newProject = new TAction(QPixmap(THEME_DIR + "icons/new.png"), tr("New project"), QKeySequence(tr("Ctrl+N")), this, SLOT(newProject()), m_actionManager); newProject->setStatusTip(tr("Open new project")); m_actionManager->insert(newProject, "newproject", "file"); TAction *openFile = new TAction(QPixmap(THEME_DIR + "icons/open.png"), tr("Open project"), QKeySequence(tr("Ctrl+O")), this, SLOT(openProject()), m_actionManager); m_actionManager->insert( openFile, "openproject", "file" ); openFile->setStatusTip(tr("Load existent project")); TAction *openNetFile = new TAction(QPixmap(THEME_DIR + "icons/net_document.png"), tr("Open project from server..."), tr(""), this, SLOT(openProjectFromServer()), m_actionManager); m_actionManager->insert(openNetFile, "opennetproject", "file"); TAction *importNetFile = new TAction(QPixmap(THEME_DIR + "icons/import_project.png"), tr("Export project to server..."), tr(""), this, SLOT(importProjectToServer()), m_actionManager); m_actionManager->insert(importNetFile, "exportprojectserver", "file"); TAction *save = new TAction(QPixmap(THEME_DIR + "icons/save.png"), tr( "Save project" ), QKeySequence(tr("Ctrl+S")), this, SLOT(saveProject()), m_actionManager); m_actionManager->insert(save, "saveproject", "file"); save->setStatusTip(tr("Save current project in current location")); TAction *saveAs = new TAction(QPixmap(THEME_DIR + "icons/save_as.png"), tr("Save project &As..."), QKeySequence(tr("Ctrl+Shift+S")), m_actionManager); connect(saveAs, SIGNAL(triggered()), this, SLOT(saveAs())); saveAs->setStatusTip(tr("Open dialog box to save current project in any location")); m_actionManager->insert(saveAs, "saveprojectas", "file"); TAction *close = new TAction(QPixmap(THEME_DIR + "icons/close.png"), tr("Cl&ose project"), QKeySequence(tr("Ctrl+W")), m_actionManager); connect(close, SIGNAL(triggered()), this, SLOT(closeProject())); close->setStatusTip(tr("Close active project")); m_actionManager->insert(close, "closeproject", "file"); // Import Palette action TAction *importPalette = new TAction(QPixmap(THEME_DIR + "icons/import.png"), tr("&Import GIMP palettes"), QKeySequence(tr("Ctrl+G")), this, SLOT(importPalettes()), m_actionManager); importPalette->setStatusTip(tr("Import palettes")); m_actionManager->insert(importPalette, "importpalettes", "file"); // Export Project action TAction *exportProject = new TAction(QPixmap(THEME_DIR + "icons/export.png"), tr("&Export Project"), QKeySequence(tr("Ctrl+R")), this, SLOT(exportProject()), m_actionManager); exportProject->setStatusTip(tr("Export project to several video formats")); m_actionManager->insert(exportProject, "export", "file"); // Exit action TAction *exit = new TAction(QPixmap(THEME_DIR + "icons/exit.png"), tr("E&xit"), QKeySequence(tr("Ctrl+Q")), qApp, SLOT(closeAllWindows()), m_actionManager); exit->setStatusTip(tr("Close application")); m_actionManager->insert(exit, "exit", "file"); // when the last window is closed, the application should quit connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit())); }
void SetActionValue(const TState& s, const TAction& a, float v) { assert(s.GetID() < mActionValues.size()); assert(a.GetID() < mActionValues[s.GetID()].size()); mActionValues[s.GetID()][a.GetID()] = v; }
float GetActionValue(const TState& s, const TAction& a) const { assert(s.GetID() < mActionValues.size()); assert(a.GetID() < mActionValues[s.GetID()].size()); return mActionValues[s.GetID()][a.GetID()]; }