Example #1
0
NewFileDialog::NewFileDialog(QDir *rootDirectory, QWidget *parent, QString caption, QString filename, bool dir) :
    QDialog(parent),
    ui(new Ui::NewFileDialog)
{
    ui->setupUi(this);
    this->setWindowTitle(caption);
    this->dtl = new DirectoryTreeLister(ui->treeWidget, DirectoryTreeLister::NewFile);
    dtl->buildList(rootDirectory);
    connect(dtl, SIGNAL(itemClicked(NPFile*)), this, SLOT(itemClicked(NPFile*)));
    connect(ui->buttonDate, SIGNAL(clicked(bool)), this, SLOT(insertDate()));
    item = 0x0;
    this->rootDir = rootDirectory;
    this->ui->fileLine->setFocus();
    this->ui->fileLine->setText(filename);
    this->ui->fileLine->selectAll();
    if (dir) ui->checkBox->setChecked(true);

    QAction *dateMe = new QAction(this);
    dateMe->setShortcut(QKeySequence("Ctrl+D"));
    connect(dateMe, SIGNAL(triggered(bool)), this, SLOT(insertDate()));
    this->addAction(dateMe);
}
Example #2
0
void
ComboBox::insertItem(int index,
                     const QString & item,
                     QIcon icon,
                     QKeySequence key,
                     const QString & toolTip)
{
    if (_cascading) {
        qDebug() << "Combobox::insertItem is unsupported when in cascading mode.";

        return;
    }

    assert(index >= 0);
    QAction* action =  new QAction(this);
    action->setText(item);
    action->setData( QVariant(index) );
    if ( !toolTip.isEmpty() ) {
        action->setToolTip( GuiUtils::convertFromPlainText(toolTip.trimmed(), Qt::WhiteSpaceNormal) );
    }
    if ( !icon.isNull() ) {
        action->setIcon(icon);
    }
    if ( !key.isEmpty() ) {
        action->setShortcut(key);
    }

    growMaximumWidthFromText(item);
    boost::shared_ptr<ComboBoxMenuNode> node( new ComboBoxMenuNode() );
    node->text = item;
    node->isLeaf = action;
    node->parent = _rootNode.get();
    _rootNode->isMenu->addAction(node->isLeaf);
    _rootNode->children.insert(_rootNode->children.begin() + index, node);
    /*if this is the first action we add, make it current*/
    if (_rootNode->children.size() == 1) {
        setCurrentText_no_emit( itemText(0) );
    }
}
Example #3
0
    CodeEditorDialog::CodeEditorDialog(QAbstractItemModel *completionModel, QMenu *variablesMenu, QMenu *resourcesMenu, QWidget *parent)
		: QDialog(parent),
        ui(new Ui::CodeEditorDialog),
        mVariablesMenu(variablesMenu),
        mResourcesMenu(resourcesMenu)
	{
		ui->setupUi(this);
		
		ui->editor->setCompletionModel(completionModel);

		QSettings settings;

		QAction *swapCodeAction = new QAction(this);
		swapCodeAction->setShortcut(QKeySequence(settings.value("actions/switchTextCode", QKeySequence("Ctrl+Shift+C")).toString()));
		swapCodeAction->setShortcutContext(Qt::WindowShortcut);
		addAction(swapCodeAction);

		connect(swapCodeAction, SIGNAL(triggered()), this, SLOT(swapCode()));
		connect(ui->editor, SIGNAL(acceptDialog()), this, SLOT(accept()));
        if(mResourcesMenu)//TMP
            connect(mResourcesMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertVariable(QAction*)));
	}
void AleatoriedadWidget::createMenus(){

    aleatoriedadMenuBar = new QMenuBar;
    menu_Archivo = new QMenu(tr("&Archivo"),aleatoriedadMenuBar);
    menu_Archivo->addAction(guardarAction);
    menu_Archivo->addAction(exportarAction);
    menu_Archivo->addSeparator();
    QAction *tmp = menu_Archivo->addAction(QIcon::fromTheme("application-exit"),
                                   tr("&Salir"), this, SLOT(close()));
    tmp->setMenuRole(QAction::QuitRole);
    tmp->setShortcut(QKeySequence(tr("CTRL+Q")));
    menu_Archivo->addAction(tmp);

    menu_Ayuda = new QMenu(tr("&Ayuda"));
    menu_Ayuda->addAction(action_Sobre);
    menu_Ayuda->addAction(action_Sobre_Qt);

    aleatoriedadMenuBar->addAction(menu_Archivo->menuAction());
    aleatoriedadMenuBar->addAction(menu_Ayuda->menuAction());


}
Example #5
0
void CommandManager::updateActions()
{
    qDeleteAll(mActions);
    mActions.clear();

    const QList<Command> &commands = mModel->allCommands();

    for (int i = 0; i < commands.size(); ++i) {
        const Command &command = commands.at(i);

        if (!command.isEnabled)
            continue;

        QAction *mAction = new QAction(command.name, this);
        mAction->setShortcut(command.shortcut);

        connect(mAction, &QAction::triggered, [this,i]() { mModel->execute(i); });

        mActions.append(mAction);
    }

    // Add Edit Commands action
    QAction *mSeparator = new QAction(this);
    mSeparator->setSeparator(true);

    mActions.append(mSeparator);

    QAction *mEditCommands = new QAction(this);
    mEditCommands->setIcon(
            QIcon(QLatin1String(":/images/24x24/system-run.png")));
    mEditCommands->setText(tr("Edit Commands..."));
    Utils::setThemeIcon(mEditCommands, "system-run");

    connect(mEditCommands, &QAction::triggered, this, &CommandManager::showDialog);

    mActions.append(mEditCommands);

    populateMenus();
}
Example #6
0
void QtWebKitWebWidget::pageLoadStarted()
{
	m_isLoading = true;

	m_thumbnail = QPixmap();

	if (m_actions.contains(RewindBackAction))
	{
		getAction(RewindBackAction)->setEnabled(getAction(GoBackAction)->isEnabled());
	}

	if (m_actions.contains(RewindForwardAction))
	{
		getAction(RewindForwardAction)->setEnabled(getAction(GoForwardAction)->isEnabled());
	}

	if (m_actions.contains(ReloadOrStopAction))
	{
		QAction *action = getAction(ReloadOrStopAction);

		ActionsManager::setupLocalAction(action, QLatin1String("Stop"));

		action->setShortcut(QKeySequence());
		action->setEnabled(true);
	}

	if (!isPrivate())
	{
		SessionsManager::markSessionModified();

		m_historyEntry = HistoryManager::addEntry(getUrl(), m_webView->title(), m_webView->icon(), m_isTyped);

		m_isTyped = false;
	}

	emit loadingChanged(true);
	emit statusMessageChanged(QString());
}
Example #7
0
IncludesWidget::IncludesWidget( QWidget* parent )
    : QWidget ( parent ), ui( new Ui::IncludesWidget )
    , includesModel( new IncludesModel( this ) )
{
    ui->setupUi( this );

    // Hack to workaround broken setIcon(QIcon) overload in QPushButton, the function does not set the icon at all
    // So need to explicitly use the QIcon overload
    ui->addIncludePath->setIcon(QIcon::fromTheme("list-add"));
    ui->removeIncludePath->setIcon(QIcon::fromTheme("list-remove"));

    // hack taken from kurlrequester, make the buttons a bit less in height so they better match the url-requester
    ui->addIncludePath->setFixedHeight( ui->includePathRequester->sizeHint().height() );
    ui->removeIncludePath->setFixedHeight( ui->includePathRequester->sizeHint().height() );

    ui->errorWidget->setHidden(true);
    ui->errorWidget->setMessageType(KMessageWidget::Warning);

    connect( ui->addIncludePath, &QPushButton::clicked, this, &IncludesWidget::addIncludePath );
    connect( ui->removeIncludePath, &QPushButton::clicked, this, &IncludesWidget::deleteIncludePath );

    // also let user choose a file as include path. This file will be "automatically included" in all files. See also -include command line option of clang/gcc
    ui->includePathRequester->setMode( KFile::File | KFile::Directory | KFile::LocalOnly | KFile::ExistingOnly );

    ui->includePaths->setModel( includesModel );
    connect( ui->includePaths->selectionModel(), &QItemSelectionModel::currentChanged, this, &IncludesWidget::includePathSelected );
    connect( ui->includePathRequester, &KUrlRequester::textChanged, this, &IncludesWidget::includePathEdited );
    connect( ui->includePathRequester, &KUrlRequester::urlSelected, this, &IncludesWidget::includePathUrlSelected );
    connect( includesModel, &IncludesModel::dataChanged, this, static_cast<void(IncludesWidget::*)()>(&IncludesWidget::includesChanged) );
    connect( includesModel, &IncludesModel::rowsInserted, this, static_cast<void(IncludesWidget::*)()>(&IncludesWidget::includesChanged)  );
    connect( includesModel, &IncludesModel::rowsRemoved, this, static_cast<void(IncludesWidget::*)()>(&IncludesWidget::includesChanged)  );

    QAction* delIncAction = new QAction( i18n("Delete Include Path"), this );
    delIncAction->setShortcut( QKeySequence( Qt::Key_Delete ) );
    delIncAction->setShortcutContext( Qt::WidgetWithChildrenShortcut );
    ui->includePaths->addAction( delIncAction );
    connect( delIncAction, &QAction::triggered, this, &IncludesWidget::deleteIncludePath );
}
void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos)
{
    if (!QDeclarativeViewObserverPrivate::get(observer())->mouseInsideContextItem())
        return;

    QMenu contextMenu;
    connect(&contextMenu, SIGNAL(hovered(QAction*)),
            this, SLOT(contextMenuElementHovered(QAction*)));

    m_contextMenuItemList = itemList;

    contextMenu.addAction("Items");
    contextMenu.addSeparator();
    int shortcutKey = Qt::Key_1;
    bool addKeySequence = true;
    int i = 0;

    foreach (QGraphicsItem * const item, itemList) {
        QString itemTitle = titleForItem(item);
        QAction *elementAction = contextMenu.addAction(itemTitle, this,
                                                       SLOT(contextMenuElementSelected()));

        if (observer()->selectedItems().contains(item)) {
            QFont boldFont = elementAction->font();
            boldFont.setBold(true);
            elementAction->setFont(boldFont);
        }

        elementAction->setData(i);
        if (addKeySequence)
            elementAction->setShortcut(QKeySequence(shortcutKey));

        shortcutKey++;
        if (shortcutKey > Qt::Key_9)
            addKeySequence = false;

        ++i;
    }
TocDlg::TocDlg(QWidget *parent, CR3View * docView) :
    QDialog(parent),
    m_ui(new Ui::TocDlg), m_docview(docView)
{
    setAttribute(Qt::WA_DeleteOnClose, true);
    m_ui->setupUi(this);
    addAction(m_ui->actionNextPage);
    addAction(m_ui->actionPrevPage);
    addAction(m_ui->actionUpdatePage);

    QAction *actionSelect = m_ui->actionGotoPage;
    actionSelect->setShortcut(Qt::Key_Select);
    addAction(actionSelect);

    m_ui->treeWidget->setColumnCount(2);
    m_ui->treeWidget->header()->setResizeMode(0, QHeaderView::Stretch);
    m_ui->treeWidget->header()->setResizeMode(1, QHeaderView::ResizeToContents);

    int nearestPage = -1;
    int currPage = docView->getCurPage();
    TocItem * nearestItem = NULL;
    LVTocItem * root = m_docview->getToc();
    for (int i=0; i<root->getChildCount(); i++ )
        m_ui->treeWidget->addTopLevelItem(new TocItem(root->getChild(i), currPage, nearestPage, nearestItem));

    m_ui->treeWidget->expandAll();
    if(nearestItem)
        m_ui->treeWidget->setCurrentItem(nearestItem);

    m_ui->pageNumEdit->setValidator(new QIntValidator(1, 999999999, this));
    m_ui->pageNumEdit->installEventFilter(this);
    m_ui->treeWidget->installEventFilter(this);

    // code added 28.11.2011
    countItems = 0;
    countItemsTotal = getMaxItemPosFromBegin(m_docview->getToc(),m_ui->treeWidget->currentItem(),0);
    isPageUpdated = false;
}
Example #10
0
 void CQTOpenGLMainWindow::CreateCameraActions() {
    /* Add the switch camera buttons */
    m_pcSwitchCameraActionGroup = new QActionGroup(this);
    QIcon cCameraIcon;
    cCameraIcon.addPixmap(QPixmap(m_strIconDir + "camera.png"));
    for(UInt32 i = 0; i < 12; ++i) {
       QAction* pcAction = new QAction(cCameraIcon, tr(QString("Camera %1").arg(i+1).toAscii().data()), m_pcSwitchCameraActionGroup);
       pcAction->setToolTip(tr(QString("Switch to camera %1").arg(i+1).toAscii().data()));
       pcAction->setStatusTip(tr(QString("Switch to camera %1").arg(i+1).toAscii().data()));
       pcAction->setCheckable(true);
       pcAction->setShortcut(Qt::Key_F1 + i);
       pcAction->setData(i);
       m_pcSwitchCameraActions.push_back(pcAction);
    }
    m_pcSwitchCameraActions.first()->setChecked(true);
    /* Add the toogle anti-aliasing button */
    m_pcToggleAntiAliasingAction = new QAction(tr("&Anti-alias"), this);
    m_pcToggleAntiAliasingAction->setStatusTip(tr("Toogle anti-aliasing in OpenGL rendering"));
    m_pcToggleAntiAliasingAction->setCheckable(true);
    /* Add the show camera XML button */
    m_pcShowCameraXMLAction = new QAction(tr("&Show XML..."), this);
    m_pcShowCameraXMLAction->setStatusTip(tr("Show XML configuration for all cameras"));
 }
Example #11
0
void MainWindow::initWindow (){
  //set background
  QPixmap pixmap(":/background/res/background/wood0.jpg");
  QPalette   palette;
  palette.setBrush(QPalette::Background,QBrush(pixmap));
  this->setPalette(palette);
  this->setMask(pixmap.mask());  //可以将图片中透明部分显示为透明的
  this->setAutoFillBackground(true); //在调用paintevent之前是否绘制背景图

  //menu
  QAction *newAction = new QAction(trUtf8 ("&New"),this);
  newAction->setIcon (QIcon(":/icon/res/emotes/face-smile.png"));
  newAction->setShortcut (QKeySequence::New);
  newAction->setToolTip ("Start New Game");

  toolbar = new QToolBar(this);
  toolbar->addAction(newAction);
  toolbar->setContextMenuPolicy (Qt::PreventContextMenu);//forbid toolbar's right click which can hide itself
  addToolBar (toolbar);
  this->setCentralWidget (chessboard);
  this->resize (chessboard->size ().width (),chessboard->size ().height ()+50);

}
Example #12
0
void CallStackView::setupContextMenu()
{
    mMenuBuilder = new MenuBuilder(this, [](QMenu*)
    {
        return DbgIsDebugging();
    });
    QIcon icon = DIcon(ArchValue("processor32.png", "processor64.png"));
    mMenuBuilder->addAction(makeAction(icon, tr("Follow &Address"), SLOT(followAddress())));
    QAction* mFollowTo = mMenuBuilder->addAction(makeAction(icon, tr("Follow &To"), SLOT(followTo())));
    mFollowTo->setShortcutContext(Qt::WidgetShortcut);
    mFollowTo->setShortcut(QKeySequence("enter"));
    connect(this, SIGNAL(enterPressedSignal()), this, SLOT(followTo()));
    mMenuBuilder->addAction(makeAction(icon, tr("Follow &From"), SLOT(followFrom())), [this](QMenu*)
    {
        return !getCellContent(getInitialSelection(), 2).isEmpty();
    });
    MenuBuilder* mCopyMenu = new MenuBuilder(this);
    setupCopyMenu(mCopyMenu);
    // Column count cannot be zero
    mMenuBuilder->addSeparator();
    mMenuBuilder->addMenu(makeMenu(DIcon("copy.png"), tr("&Copy")), mCopyMenu);
    mMenuBuilder->loadFromConfig();
}
Example #13
0
FileOps::FileOps(QObject *parent) : QObject(parent)
{
    //separators
    QAction *separator1 = new QAction(this);
    separator1->setSeparator (true);
    QAction *separator2 = new QAction(this);
    separator2->setSeparator (true);
    //load settings
    QSignalMapper *mapper = new QSignalMapper(this);
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("FileOps");
    int count = settings.value("count", 0).toInt();
    if (count > 0)
        UiHelper::instance()->addAction(separator1, UiHelper::PLAYLIST_MENU);
    else
        return;

    for (int i = 0; i < count; ++i)
    {

        if (settings.value(QString("enabled_%1").arg(i), true).toBool())
        {
            m_types << settings.value(QString("action_%1").arg(i), FileOps::COPY).toInt();
            QString name = settings.value(QString("name_%1").arg(i), "Action").toString();
            m_patterns << settings.value(QString("pattern_%1").arg(i)).toString();
            m_destinations << settings.value(QString("destination_%1").arg(i)).toString();
            QAction *action = new QAction(name, this);
            action->setShortcut(settings.value(QString("hotkey_%1").arg(i)).toString());
            connect (action, SIGNAL (triggered (bool)), mapper, SLOT (map()));
            mapper->setMapping(action, i);
            UiHelper::instance()->addAction(action, UiHelper::PLAYLIST_MENU);
        }
    }
    settings.endGroup();
    connect(mapper, SIGNAL(mapped(int)), SLOT(execAction(int)));
    UiHelper::instance()->addAction(separator2, UiHelper::PLAYLIST_MENU);
}
Example #14
0
MainWindow::MainWindow(ModuleLoader &moduleLoader, const ProgramLoader &programLoader, QWidget *parent)
    : QMainWindow(parent),
      moduleLoader(moduleLoader),
      programLoader(programLoader)
{
    createActions();
    createMenus();
    setAcceptDrops(true);

    treeWidget = new TreeWidget(programLoader, this);
    hexFileWidget = new HexFileWidget(this);
    logWidget = new LogWidget();

    setCentralWidget(new QWidget(this));
    QHBoxLayout* layout = new QHBoxLayout(centralWidget());

    QTabWidget* tab = new QTabWidget(centralWidget());
    tab->addTab(hexFileWidget, "hex");
    tab->addTab(logWidget, "log");

    layout->addWidget(treeWidget, 1);
    layout->addWidget(tab);
    layout->setContentsMargins(0,0,0,0);
    centralWidget()->setLayout(layout);

    QAction* search = new QAction(this);
    search->setShortcut(QKeySequence::Find);
    addAction(search);

    connect(treeWidget,SIGNAL(pathChanged(QString)), hexFileWidget, SLOT(setFile(QString)));
    connect(treeWidget,SIGNAL(positionChanged(qint64, qint64)), hexFileWidget, SLOT(gotoPosition(qint64)));
    connect(treeWidget,SIGNAL(positionChanged(qint64, qint64)), hexFileWidget, SLOT(highlight(qint64,qint64)));
    connect(treeWidget,SIGNAL(eventDropped(QDropEvent*)),this, SLOT(dropEvent(QDropEvent*)));
    connect(search, SIGNAL(triggered()), hexFileWidget, SLOT(focusSearch()));
    connect(treeWidget,SIGNAL(openFragmentedFile(Object&)), this, SLOT(openFragmentedFile(Object&)));
    connect(hexFileWidget, SIGNAL(selected(qint64)), treeWidget, SLOT(updateByFilePosition(qint64)));
}
OpenFileDlg::OpenFileDlg(QWidget *parent, CR3View * docView):
    QDialog(parent),
    m_ui(new Ui::OpenFileDlg),
    m_docview(docView)
{
    m_ui->setupUi(this);

    addAction(m_ui->actionGoToBegin);
    addAction(m_ui->actionNextPage);
    addAction(m_ui->actionPrevPage);
    addAction(m_ui->actionGoToFirstPage);
    addAction(m_ui->actionGoToLastPage);

    QAction *actionRemoveFile = m_ui->actionRemoveFile;
    QShortcut* kbd = new QShortcut(Qt::Key_AltGr, this); // quick hack to delete files on K4NT with KBD key
    connect(kbd, SIGNAL(activated()), actionRemoveFile, SLOT(trigger()));
    addAction(actionRemoveFile);

    QAction *actionSelect = m_ui->actionSelectFile;
    actionSelect->setShortcut(Qt::Key_Select);
    addAction(actionSelect);

    folder = QIcon(":/icons/folder_sans_32.png");
    file = QIcon(":/icons/book_text_32.png");
    arrowUp = QIcon(":/icons/arrow_full_up_32.png");

    m_ui->FileList->setItemDelegate(new FileListDelegate());

    QString lastPathName;
    QString lastName;
    if(!docView->GetLastPathName(&lastPathName))
#ifdef i386
        CurrentDir = "/home/";
#else
        CurrentDir = "/mnt/us/documents/";
#endif
    else {
Example #16
0
AboutBox::AboutBox(QWidget* parent) : QDialog (parent)
{
    setupUi(this);

    QAction* action = new QAction(this);
    action->setShortcut(QKeySequence(QKeySequence::Close));
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
    addAction(action);

    m_titleLabel->setText(APPNAME);
    m_versionLabel->setText(APPVERSION);
    m_copyrightLabel->setText(QString("Copyright &copy; <B>Heikki Junnila</B> %1")
                              .arg(tr("and contributors:")));
    m_websiteLabel->setText(tr("Website: %1").arg("<A HREF=\"http://qlc.sourceforge.net\">http://qlc.sourceforge.net</A>"));

    connect(m_contributors, SIGNAL(itemClicked(QListWidgetItem*)),
            this, SLOT(slotItemClicked()));
    m_contributors->clear();
    m_contributors->addItem("janek3");
    m_contributors->addItem("Klaus Weidenbach");
    m_contributors->addItem("Stefan Krumm");
    m_contributors->addItem(QByteArray::fromPercentEncoding("Christian S%fchs"));
    m_contributors->addItem("Simon Newton");
    m_contributors->addItem("Christopher Staite");
    m_contributors->addItem("Lutz Hillebrand");
    m_contributors->addItem("Matthew Jaggard");
    m_contributors->addItem("Ptit Vachon");
    m_contributors->addItem("NiKoyes");
    m_contributors->addItem("Tolmino");

    m_timer = new QTimer(this);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
    m_row = -1;
    m_increment = 1;
    m_timer->start(500);
}
Example #17
0
FindWidget::FindWidget(edbee::TextEditorWidget* parent)
    : QWidget(parent)
    , editorRef_( parent )
    , lineEditRef_(0)
{
    constructUI();

    /// when return is pressed we move to the given line
    connect(lineEditRef_,SIGNAL(returnPressed()), this, SLOT(enterPressed()) );

    // delete when editing is done
    connect(lineEditRef_,SIGNAL(editingFinished()), this, SLOT(deactivate()) );

    // create a close editor action
    QAction* closeAction = new QAction(lineEditRef_);
    closeAction->setShortcut( Qt::Key_Escape );
    connect( closeAction,SIGNAL(triggered()), this, SLOT(close()) );
    lineEditRef_->addAction(closeAction);

    // move the focus to the editor line
    lineEditRef_->setFocus();
    setFocusProxy(lineEditRef_);

}
ZLQtApplicationWindow::ZLQtApplicationWindow(ZLApplication *application) :
	ZLDesktopApplicationWindow(application),
	myFullscreenToolBar(0),
	myDocWidget(0),
	myFullScreen(false),
	myWasMaximized(false),
	myCursorIsHyperlink(false) {

	const std::string iconFileName = ZLibrary::ImageDirectory() + ZLibrary::FileNameDelimiter + ZLibrary::ApplicationName() + ".png";
	QPixmap icon(iconFileName.c_str());
	setWindowIcon(icon);

	myWindowToolBar = new QToolBar(this);
	QAction *toggleWindowToolBarAction = new QAction(this);
	toggleWindowToolBarAction->setShortcutContext(Qt::ApplicationShortcut);
	toggleWindowToolBarAction->setShortcut(QKeySequence(Qt::Key_F9));
	connect(toggleWindowToolBarAction, SIGNAL(triggered()), this, SLOT(toggleWindowToolBar()));
	addAction(toggleWindowToolBarAction);
	myWindowToolBar->setFocusPolicy(Qt::NoFocus);
	myWindowToolBar->setMovable(false);
	addToolBar(myWindowToolBar);
	myWindowToolBar->setIconSize(QSize(32, 32));

	if (hasFullscreenToolbar()) {
		myFullscreenToolBar = new QToolBar();
		myFullscreenToolBar->setMovable(false);
		myFullscreenToolBar->setIconSize(QSize(32, 32));
		myFullscreenToolBar->hide();
	}

	resize(myWidthOption.value(), myHeightOption.value());
	move(myXOption.value(), myYOption.value());

	menuBar()->hide();
	show();
}
Example #19
0
bool PowerGui::loadUserMenus()
{
	QStringList menus = getSetting("userMenus").toStringList();
 	_userActions.clear(); 
	foreach(QString menuName,menus)
	{
		QMenu *menu = new QMenu(menuName);
		QStringList actionList = getSetting("menu/" + menuName).toStringList();
		foreach (QString actionName, actionList)
		{
			QAction *actionUserMenu =	menu->addAction(actionName);
			QStringList userMenuData = getSetting("menu/" + menuName + "/" + actionName).toStringList();
			UserMenuAction *userAction = new UserMenuAction(userMenuData);
			if (userAction->hasShortcut()) 
				actionUserMenu->setShortcut(userAction->shortcut());
			if (userAction->hasIcon()) {
				actionUserMenu->setIcon(QIcon(userAction->icon()));
        toolBar->addAction(actionUserMenu);
			}
      _userMenuMapper.setMapping(actionUserMenu,userAction);
      connect(actionUserMenu,SIGNAL(triggered()),&_userMenuMapper,SLOT(map()));
      actionUserMenu->setData(userMenuData);
      _userActions << actionUserMenu;
		}
void EventQueueWindowState::setup()
{
    // Setup parent
    WindowStateWithMenu::setup();

    // Create actions
    QAction *buildAction = new QAction(tr("Build"), this);

    // Setup shortcuts
    buildAction->setShortcut(Qt::CTRL + Qt::Key_B);

    // Connect actions to slots
    QObject::connect(buildAction, SIGNAL(triggered()),
                         this, SLOT(buildEventQueue()));

    // Add actions to menu
    addAction(buildAction);

    // Bottom widget
    bottomWidget = new QWidget();
    bottomWidget->hide();
    bottomWidget->setMaximumHeight(200);
    QHBoxLayout *horizontalLayout = new QHBoxLayout(bottomWidget);
    horizontalLayout->setContentsMargins(1, 1, 1, 1);

    // list widget
    treeWidget = new QTreeWidget(bottomWidget);
    treeWidget->setColumnCount(1);
    treeWidget->setSelectionMode(QTreeWidget::ExtendedSelection);
    treeWidget->setHeaderLabel(tr("Event queue display"));
    QObject::connect(treeWidget, SIGNAL(itemSelectionChanged()),
                     this, SLOT(updateDrawables()));
    QObject::connect(treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
                     this, SLOT(treeWidgetItemDoubleClicked(QTreeWidgetItem*,int)));
    horizontalLayout->addWidget(treeWidget);
}
Example #21
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QMenu *fileMenu = new QMenu(tr("&File"));

    QAction *quitAction = fileMenu->addAction(tr("E&xit"));
    quitAction->setShortcut(tr("Ctrl+Q"));

    QMenu *itemsMenu = new QMenu(tr("&Items"));

    insertAction = itemsMenu->addAction(tr("&Insert Item"));
    removeAction = itemsMenu->addAction(tr("&Remove Item"));

    menuBar()->addMenu(fileMenu);
    menuBar()->addMenu(itemsMenu);

    QStringList numbers;
    numbers << tr("One") << tr("Two") << tr("Three") << tr("Four") << tr("Five")
            << tr("Six") << tr("Seven") << tr("Eight") << tr("Nine") << tr("Ten");

    model = new StringListModel(numbers);
    QListView *view = new QListView(this);
    view->setModel(model);

    selectionModel = view->selectionModel();

    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
    connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
    connect(selectionModel,
            SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(updateMenus(const QModelIndex &)));
    
    setCentralWidget(view);
    setWindowTitle("View onto a string list model");
}
Example #22
0
void MainWindow::updatePageHistoryActionList()
{
    // Update web history menu.
    // Restrict the content to 10 items and set
    // a shortcut to each item.
    if (!pageHistoryItems.isEmpty())
        for (const auto &item : pageHistoryItems) {
            pageHistoryMenu->removeAction(item);
        }
    pageHistoryItems.clear();
    QFontMetrics fontMetrics(font());
    int k = 0;
    while (k < visitedUrls.count() && k < MaxWebHistoryItems()) {
        QString title =
            fontMetrics.elidedText(visitedUrls.at(k).second, Qt::ElideRight,
                                   pageHistoryMenu->maximumWidth());
        QAction *action = new QAction(title, pageHistoryMenu);
        action->setData(visitedUrls.at(k).first);
        action->setShortcut(tr("Ctrl+%1").arg(k));
        connect(action, SIGNAL(triggered()), SLOT(openPageHistoryUrl()));
        pageHistoryItems.append(action);
        k++;
    }
}
Example #23
0
QAction* CWizActions::addAction(WIZACTION& action)
{   
    QString strText = action.strText;
    QString strIconName = action.strName;
    QString strShortcut = action.strShortcut;
    QString strSlot = "1on_" + action.strName + "_triggered()";

    QAction* pAction = new QAction(strText, m_parent);

    if (!strIconName.isEmpty()) {
        pAction->setIcon(::WizLoadSkinIcon(m_app.userSettings().skin(), strIconName));
    }

    if (!strShortcut.isEmpty()) {
        pAction->setShortcut(QKeySequence::fromString(strShortcut));
    }

    if (action.strName == "actionAbout")
        pAction->setMenuRole(QAction::AboutRole);
    else if (action.strName == "actionAboutPlugins")
        pAction->setMenuRole(QAction::ApplicationSpecificRole);
    else if (action.strName == "actionPreference")
        pAction->setMenuRole(QAction::PreferencesRole);
    else if (action.strName == "actionExit")
        pAction->setMenuRole(QAction::QuitRole);

    // Used for building menu from ini file
    pAction->setObjectName(action.strName);

    pAction->setShortcutContext(Qt::ApplicationShortcut);

    m_actions[action.strName] = pAction;
    QObject::connect(pAction, "2triggered()", m_parent, strSlot.toUtf8());

    return pAction;
}
Example #24
0
AnotherMenu::AnotherMenu(QWidget *parent) : QMainWindow(parent)
{
    // Instantiate the icons.
    QPixmap newpix("new.png");
    QPixmap openpix("open.png");
    QPixmap quitpix("quit.png");

    // Create the actions.
    QAction *newa = new QAction(newpix, "&New", this);
    QAction *open = new QAction(openpix, "&Open", this);
    QAction *quit = new QAction(quitpix, "&Close", this);
    
    // Add actions to a list
    std::vector<QAction *> alist;
    alist.push_back(newa);
    alist.push_back(open);
    alist.push_back(quit);

    quit->setShortcut(tr("CTRL+Q"));

    // Set up the menu.
    QMenu *file;
    file = menuBar()->addMenu("&File");

    std::vector<QAction *>::iterator bit = alist.begin();

    for (bit; bit != alist.end(); bit++)
    {
        QAction *current = *bit;
        if (current == quit)
            file->addSeparator();
        file->addAction(*bit);
    }

    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
}
Example #25
0
void
html_editor::create_actions()
{
  for (uint i=0; i<sizeof(m_action_definitions)/sizeof(m_action_definitions[0]); i++) {
    struct action_type* def = &m_action_definitions[i];
    QAction* a;
    if (def->webaction == QWebPage::NoWebAction) {
      // the action is owned by us
      a = new QAction(tr(def->name), this);
    }
    else {
      // action already provided by QWebPage
      a = page()->action(def->webaction);
    }
    if (a) {
      a->setIcon(HTML_ICON(def->icon));
      if (def->shortcut)
	a->setShortcut(tr(def->shortcut));
      m_actions[def->name] = a;
      if (def->slot)
	connect(a, SIGNAL(triggered()), this, def->slot);
    }
  }
}
Example #26
0
VCSliderProperties::VCSliderProperties(VCSlider* slider, Doc* doc, OutputMap* outputMap,
                                       InputMap* inputMap, MasterTimer* masterTimer)
    : QDialog(slider)
    , m_doc(doc)
    , m_outputMap(outputMap)
    , m_inputMap(inputMap)
    , m_masterTimer(masterTimer)
{
    Q_ASSERT(doc != NULL);
    Q_ASSERT(outputMap != NULL);
    Q_ASSERT(inputMap != NULL);
    Q_ASSERT(masterTimer != NULL);
    Q_ASSERT(slider != NULL);
    m_slider = slider;

    setupUi(this);

    QAction* action = new QAction(this);
    action->setShortcut(QKeySequence(QKeySequence::Close));
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
    addAction(action);

    /* Bus page connections */
    connect(m_switchToBusModeButton, SIGNAL(clicked()),
            this, SLOT(slotModeBusClicked()));

    /* Level page connections */
    connect(m_levelLowLimitSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotLevelLowSpinChanged(int)));
    connect(m_levelHighLimitSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotLevelHighSpinChanged(int)));
    connect(m_levelCapabilityButton, SIGNAL(clicked()),
            this, SLOT(slotLevelCapabilityClicked()));
    connect(m_levelList, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
            this, SLOT(slotLevelListClicked(QTreeWidgetItem*)));
    connect(m_levelAllButton, SIGNAL(clicked()),
            this, SLOT(slotLevelAllClicked()));
    connect(m_levelNoneButton, SIGNAL(clicked()),
            this, SLOT(slotLevelNoneClicked()));
    connect(m_levelInvertButton, SIGNAL(clicked()),
            this, SLOT(slotLevelInvertClicked()));
    connect(m_levelByGroupButton, SIGNAL(clicked()),
            this, SLOT(slotLevelByGroupClicked()));
    connect(m_switchToLevelModeButton, SIGNAL(clicked()),
            this, SLOT(slotModeLevelClicked()));

    /* Playback page connections */
    connect(m_switchToPlaybackModeButton, SIGNAL(clicked()),
            this, SLOT(slotModePlaybackClicked()));
    connect(m_attachPlaybackFunctionButton, SIGNAL(clicked()),
            this, SLOT(slotAttachPlaybackFunctionClicked()));
    connect(m_detachPlaybackFunctionButton, SIGNAL(clicked()),
            this, SLOT(slotDetachPlaybackFunctionClicked()));

    /*********************************************************************
     * General page
     *********************************************************************/

    /* Name */
    m_nameEdit->setText(m_slider->caption());

    /* Slider mode */
    m_sliderMode = m_slider->sliderMode();
    switch (m_sliderMode)
    {
    default:
    case VCSlider::Bus:
        slotModeBusClicked();
        break;
    case VCSlider::Level:
        slotModeLevelClicked();
        break;
    case VCSlider::Playback:
        slotModePlaybackClicked();
        break;
    }

    /* Slider movement (Qt understands inverted appearance vice versa) */
    if (m_slider->invertedAppearance() == true)
        m_sliderMovementInvertedRadio->setChecked(true);
    else
        m_sliderMovementNormalRadio->setChecked(true);

    /* Value display style */
    switch (m_slider->valueDisplayStyle())
    {
    default:
    case VCSlider::ExactValue:
        m_valueExactRadio->setChecked(true);
        break;
    case VCSlider::PercentageValue:
        m_valuePercentageRadio->setChecked(true);
        break;
    }

    /********************************************************************
     * External input
     ********************************************************************/
    m_inputUniverse = m_slider->inputUniverse();
    m_inputChannel = m_slider->inputChannel();
    updateInputSource();

    connect(m_autoDetectInputButton, SIGNAL(toggled(bool)),
            this, SLOT(slotAutoDetectInputToggled(bool)));
    connect(m_chooseInputButton, SIGNAL(clicked()),
            this, SLOT(slotChooseInputClicked()));

    /*********************************************************************
     * Bus page
     *********************************************************************/

    /* Bus combo contents */
    fillBusCombo();

    /* Bus value limit spins */
    m_busLowLimitSpin->setValue(m_slider->busLowLimit());
    m_busHighLimitSpin->setValue(m_slider->busHighLimit());

    /*********************************************************************
     * Level page
     *********************************************************************/

    /* Level limit spins */
    m_levelLowLimitSpin->setValue(m_slider->levelLowLimit());
    m_levelHighLimitSpin->setValue(m_slider->levelHighLimit());

    /* Tree widget columns */
    m_levelList->header()->setResizeMode(QHeaderView::ResizeToContents);

    /* Tree widget contents */
    levelUpdateFixtures();
    levelUpdateChannelSelections();

    /*********************************************************************
     * Playback page
     *********************************************************************/

    /* Function */
    m_playbackFunctionId = m_slider->playbackFunction();
    updatePlaybackFunctionName();
}
Example #27
0
VCSliderProperties::VCSliderProperties(VCSlider* slider, Doc* doc)
    : QDialog(slider)
    , m_doc(doc)
{
    Q_ASSERT(doc != NULL);
    Q_ASSERT(slider != NULL);
    m_slider = slider;

    setupUi(this);

    QAction* action = new QAction(this);
    action->setShortcut(QKeySequence(QKeySequence::Close));
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
    addAction(action);

    /* Level page connections */
    connect(m_levelLowLimitSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotLevelLowSpinChanged(int)));
    connect(m_levelHighLimitSpin, SIGNAL(valueChanged(int)),
            this, SLOT(slotLevelHighSpinChanged(int)));
    connect(m_levelCapabilityButton, SIGNAL(clicked()),
            this, SLOT(slotLevelCapabilityClicked()));
    connect(m_levelList, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
            this, SLOT(slotLevelListClicked(QTreeWidgetItem*)));
    connect(m_levelAllButton, SIGNAL(clicked()),
            this, SLOT(slotLevelAllClicked()));
    connect(m_levelNoneButton, SIGNAL(clicked()),
            this, SLOT(slotLevelNoneClicked()));
    connect(m_levelInvertButton, SIGNAL(clicked()),
            this, SLOT(slotLevelInvertClicked()));
    connect(m_levelByGroupButton, SIGNAL(clicked()),
            this, SLOT(slotLevelByGroupClicked()));
    connect(m_switchToLevelModeButton, SIGNAL(clicked()),
            this, SLOT(slotModeLevelClicked()));

    /* Playback page connections */
    connect(m_switchToPlaybackModeButton, SIGNAL(clicked()),
            this, SLOT(slotModePlaybackClicked()));
    connect(m_attachPlaybackFunctionButton, SIGNAL(clicked()),
            this, SLOT(slotAttachPlaybackFunctionClicked()));
    connect(m_detachPlaybackFunctionButton, SIGNAL(clicked()),
            this, SLOT(slotDetachPlaybackFunctionClicked()));

    /* Submaster page connections */
    connect(m_switchToSubmasterModeButton, SIGNAL(clicked()),
            this, SLOT(slotModeSubmasterClicked()));

    /*********************************************************************
     * General page
     *********************************************************************/

    /* Name */
    m_nameEdit->setText(m_slider->caption());

    /* Widget appearance */
    if (m_slider->widgetStyle() == VCSlider::WKnob)
        m_widgetKnobRadio->setChecked(true);
    else
        m_widgetSliderRadio->setChecked(true);

    /* Slider mode */
    m_sliderMode = m_slider->sliderMode();
    switch (m_sliderMode)
    {
    default:
    case VCSlider::Level:
        slotModeLevelClicked();
        break;
    case VCSlider::Playback:
        slotModePlaybackClicked();
        break;
    case VCSlider::Submaster:
        slotModeSubmasterClicked();
        break;
    }

    /* Slider movement (Qt understands inverted appearance vice versa) */
    if (m_slider->invertedAppearance() == true)
        m_sliderMovementInvertedRadio->setChecked(true);
    else
        m_sliderMovementNormalRadio->setChecked(true);

    /* Value display style */
    switch (m_slider->valueDisplayStyle())
    {
    default:
    case VCSlider::ExactValue:
        m_valueExactRadio->setChecked(true);
        break;
    case VCSlider::PercentageValue:
        m_valuePercentageRadio->setChecked(true);
        break;
    }

    /********************************************************************
     * External input
     ********************************************************************/
    m_inputSource = m_slider->inputSource();
    updateInputSource();

    connect(m_autoDetectInputButton, SIGNAL(toggled(bool)),
            this, SLOT(slotAutoDetectInputToggled(bool)));
    connect(m_chooseInputButton, SIGNAL(clicked()),
            this, SLOT(slotChooseInputClicked()));

    /*********************************************************************
     * Level page
     *********************************************************************/

    /* Level limit spins */
    m_levelLowLimitSpin->setValue(m_slider->levelLowLimit());
    m_levelHighLimitSpin->setValue(m_slider->levelHighLimit());

    /* Tree widget contents */
    levelUpdateFixtures();
    levelUpdateChannelSelections();

    connect(m_levelList, SIGNAL(expanded(QModelIndex)),
            this, SLOT(slotItemExpanded()));
    connect(m_levelList, SIGNAL(collapsed(QModelIndex)),
            this, SLOT(slotItemExpanded()));

    m_monitorValuesCheck->setChecked(m_slider->channelsMonitorEnabled());

    /*********************************************************************
     * Playback page
     *********************************************************************/

    /* Function */
    m_playbackFunctionId = m_slider->playbackFunction();
    updatePlaybackFunctionName();


}
Example #28
0
GLLUTWidget::GLLUTWidget(LUTChannelMode mode, QWidget *parent) : QGLWidget(parent)
{
  rb=0;
  _lut=0;
  _mode=mode;
  needs_init=false;
  gl_ready=false;
  view_mode=VIEW_SINGLE;
  setFocusPolicy(Qt::StrongFocus);
  cam.reset();
  cam.setPitch( -0.785398163);
  cam.setYaw( -0.785398163);
  cam.setDistance(6.0);


  setMinimumSize(60,40);

  /*QAction * actionSave = new QAction(this);
  actionSave->setObjectName("actionSave");
  actionSave->setIcon(QIcon(":/icons/document-save.png"));
  actionSave->setShortcut(QKeySequence("Ctrl+s"));
  actionSave->setToolTip("Save Image... (Ctrl-s)");
  actionSave->setShortcutContext(Qt::WidgetShortcut);
  addAction(actionSave);*/

  QAction * actionHelp = new QAction(this);
  actionHelp->setObjectName("actionHelp");
  actionHelp->setIcon(QIcon(":/icons/help-contents.png"));
  actionHelp->setShortcut(QKeySequence("Ctrl+h"));
  actionHelp->setToolTip("Show keyboard shortcuts (Ctrl-h)");
  actionHelp->setShortcutContext(Qt::WidgetShortcut);
  addAction(actionHelp);

  /*QAction * actionZoomFit = new QAction(this);
  actionZoomFit->setObjectName("actionZoomFit");
  actionZoomFit->setIcon(QIcon(":/icons/zoom-best-fit.png"));
  actionZoomFit->setShortcut(QKeySequence("Space"));
  actionZoomFit->setToolTip("Zoom to Fit (Space)");
  actionZoomFit->setShortcutContext(Qt::WidgetShortcut);
  addAction(actionZoomFit);*/

  QAction * actionZoomNormal = new QAction(this);
  actionZoomNormal->setObjectName("actionZoomNormal");
  actionZoomNormal->setIcon(QIcon(":/icons/zoom-original.png"));
  actionZoomNormal->setShortcut(QKeySequence("Home"));
  actionZoomNormal->setShortcutContext(Qt::WidgetShortcut);
  actionZoomNormal->setToolTip("Zoom to 100% (Home)");
  addAction(actionZoomNormal);

  QAction * actionSwitchMode = new QAction(this);
  actionSwitchMode->setObjectName("actionSwitchMode");
  actionSwitchMode->setIcon(QIcon(":/icons/3d.png"));
  actionSwitchMode->setShortcut(QKeySequence("Home"));
  actionSwitchMode->setShortcutContext(Qt::WidgetShortcut);
  actionSwitchMode->setToolTip("Switch Mode");
  addAction(actionSwitchMode);

  actionViewToggleBackground = new QAction(this);
  actionViewToggleBackground->setObjectName("actionViewToggleBackground");
  actionViewToggleBackground->setIcon(QIcon(":/icons/background.png"));
  actionViewToggleBackground->setCheckable(true);
  actionViewToggleBackground->setChecked(true);
  actionViewToggleBackground->setShortcut(QKeySequence("b"));
  actionViewToggleBackground->setShortcutContext(Qt::WidgetShortcut);
  actionViewToggleBackground->setToolTip("Display Background");
  addAction(actionViewToggleBackground);

  actionViewToggleOtherChannels = new QAction(this);
  actionViewToggleOtherChannels->setObjectName("actionViewToggleOtherChannels");
  actionViewToggleOtherChannels->setIcon(QIcon(":/icons/colors.png"));
  actionViewToggleOtherChannels->setCheckable(true);
  actionViewToggleOtherChannels->setChecked(true);
  actionViewToggleOtherChannels->setShortcut(QKeySequence("o"));
  actionViewToggleOtherChannels->setShortcutContext(Qt::WidgetShortcut);
  actionViewToggleOtherChannels->setToolTip("Display All Channels");
  if (mode==LUTChannelMode_Bitwise) {
    addAction(actionViewToggleOtherChannels);
  }


  QAction * actionSep = new QAction(this);
  actionSep->setSeparator(true);
  addAction(actionSep);

  actionUndo = new QAction(this);
  actionUndo->setEnabled(false);
  actionUndo->setObjectName("actionUndo");
  actionUndo->setIcon(QIcon(":/icons/undo.png"));
  actionUndo->setShortcut(QKeySequence("Backspace"));
  actionUndo->setShortcutContext(Qt::WidgetShortcut);
  actionUndo->setToolTip("Undo");
  addAction(actionUndo);

  actionRedo = new QAction(this);
  actionUndo->setEnabled(false);
  actionRedo->setObjectName("actionRedo");
  actionRedo->setIcon(QIcon(":/icons/redo.png"));
  actionRedo->setShortcut(QKeySequence("Insert"));
  actionRedo->setShortcutContext(Qt::WidgetShortcut);
  actionRedo->setToolTip("Redo");
  addAction(actionRedo);

  QAction * actionSep2 = new QAction(this);
  actionSep2->setSeparator(true);
  addAction(actionSep2);


  actionExclusiveMode = new QAction(this);
  actionExclusiveMode->setObjectName("actionExclusiveMode");
  actionExclusiveMode->setIcon(QIcon(":/icons/xedit.png"));
  actionExclusiveMode->setCheckable(true);
  actionExclusiveMode->setShortcut(QKeySequence("x"));
  actionExclusiveMode->setShortcutContext(Qt::WidgetShortcut);
  actionExclusiveMode->setToolTip("Exclusive Channel Mode");
  if (mode==LUTChannelMode_Bitwise) {
    addAction(actionExclusiveMode);
  } else {
    actionExclusiveMode->setChecked(true);
  }

  QAction * actionClearSampler = new QAction(this);
  actionClearSampler->setObjectName("actionClearSampler");
  actionClearSampler->setIcon(QIcon(":/icons/xload.png"));
  actionClearSampler->setShortcut(QKeySequence("c"));
  actionClearSampler->setShortcutContext(Qt::WidgetShortcut);
  actionClearSampler->setToolTip("Clear Sampler");
  addAction(actionClearSampler);

  connect(actionViewToggleBackground, SIGNAL(triggered()), this, SLOT(redraw()));
  connect(actionViewToggleOtherChannels, SIGNAL(triggered()), this, SLOT(rebuildAndRedraw()));
  connect(actionSwitchMode, SIGNAL(triggered()), this, SLOT(switchMode()));
  
  connect(actionRedo, SIGNAL(triggered()), this, SLOT(editRedo()));
  connect(actionUndo, SIGNAL(triggered()), this, SLOT(editUndo()));
  connect(actionClearSampler, SIGNAL(triggered()), this, SLOT(clearSampler()));
  //connect(actionSave, SIGNAL(triggered()), this, SLOT(saveImage()));
  connect(actionHelp, SIGNAL(triggered()), this, SLOT(callHelp()));
  
  connect(actionZoomNormal, SIGNAL(triggered()), this, SLOT(callZoomNormal()));

  editClearAll();
}
Example #29
0
MainWindow::MainWindow()
{
	ui.setupUi(this);

	this->setWindowTitle(tr("Texture Atlas Maker v0.96  (18-08-2011)"));

	readSettings();

///////////////////////////////////////////////
	QGridLayout *gridLayout_2 = new QGridLayout(ui.page_textures);



	TextureListWidget *listViewTextures = new TextureListWidget(ui.page_textures);
	listViewTextures->setObjectName(QString::fromUtf8("listViewTextures"));
			QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Expanding);
			sizePolicy2.setHorizontalStretch(0);
			sizePolicy2.setVerticalStretch(0);
			sizePolicy2.setHeightForWidth(listViewTextures->sizePolicy().hasHeightForWidth());
			listViewTextures->setSizePolicy(sizePolicy2);
	gridLayout_2->addWidget(listViewTextures, 0, 0, 1, 4);


	QToolButton *toolButtonAddFile = new QToolButton(ui.page_textures);
	toolButtonAddFile->setText(tr("add file"));
	toolButtonAddFile->setObjectName(QString::fromUtf8("toolButtonAddFile"));
	gridLayout_2->addWidget(toolButtonAddFile, 1, 0, 1, 2);

	QToolButton *toolButtonAddFolder = new QToolButton(ui.page_textures);
	toolButtonAddFolder->setText(tr("add folder"));
	toolButtonAddFolder->setObjectName(QString::fromUtf8("toolButtonAddFolder"));
	gridLayout_2->addWidget(toolButtonAddFolder, 2, 0, 1, 2);

	QToolButton *toolExport = new QToolButton(ui.page_textures);
	toolExport->setText(tr("export"));
	toolExport->setToolTip(tr("Export selected images"));
	gridLayout_2->addWidget(toolExport, 1, 2, 1, 2);


	QToolButton *toolButtonClear = new QToolButton(ui.page_textures);
	toolButtonClear->setText(tr("clear"));
	toolButtonClear->setObjectName(QString::fromUtf8("toolButtonClear"));
	gridLayout_2->addWidget(toolButtonClear, 2, 2, 1, 2);




	comboBoxResolution = new QComboBox(ui.page_textures);
	comboBoxResolution->setObjectName(QString::fromUtf8("comboBoxResolution"));
	gridLayout_2->addWidget(comboBoxResolution, 3, 0, 1, 2);




	QToolButton *toolButtonAddResolution = new QToolButton(ui.page_textures);
	toolButtonAddResolution->setText(tr("+"));
	toolButtonAddResolution->setObjectName(QString::fromUtf8("toolButtonAddResolution"));
	toolButtonAddResolution->setArrowType(Qt::NoArrow);

	gridLayout_2->addWidget(toolButtonAddResolution, 3, 2, 1, 1);
////////////////////////////////////////

	/////////////////


	comboBoxResolution->addItem("2048*2048", 2048);
	comboBoxResolution->addItem("1024*1024", 1024);
	comboBoxResolution->addItem("512*512", 512);
	comboBoxResolution->addItem("256*256", 256);
	comboBoxResolution->addItem("128*128", 128);

	textureModel = new TextureModel(this);

	listViewTextures->setModel(textureModel);

	ui.workArea->setAcceptDrops(true);
	ui.workArea->setTextureModel(textureModel);
	ui.workArea->setUpdatesEnabled(true);
	ui.workArea->update();


	connect(toolButtonAddFile,SIGNAL(clicked(bool)), this,SLOT(AddFile()));
	connect(toolButtonAddFolder,SIGNAL(clicked(bool)), this,SLOT(AddFolder()));
	connect(toolButtonClear,SIGNAL(clicked(bool)), textureModel,SLOT(clear()));
	connect(toolExport,SIGNAL(clicked(bool)), listViewTextures,SLOT(saveSelectedImages()));


	connect(comboBoxResolution,SIGNAL(currentIndexChanged(int)), this,SLOT(resolutionAtlasChange()));
	connect(toolButtonAddResolution,SIGNAL(clicked(bool)), this,SLOT(AddNewResolution()));



	QAction *bindingAction = ui.toolBar->addAction(tr("binding"));
	bindingAction->setCheckable(true);
	bindingAction->setChecked(false);
	connect(bindingAction, SIGNAL(triggered(bool)), ui.workArea,SLOT(setBinding(bool)));

	QAction *remakeAction = ui.toolBar->addAction(tr("remake"));
	connect(remakeAction,SIGNAL(triggered(bool)), textureModel,SLOT(arrangeImages()));


	QAction *autoRemakeAction = ui.toolBar->addAction(tr("auto arrange"));
	autoRemakeAction->setCheckable(true);
	autoRemakeAction->setChecked(textureModel->isAutoArrangeImages());
	connect(autoRemakeAction, SIGNAL(triggered(bool)), textureModel,SLOT(setAutoArrangeImages(bool)));


	QAction *loadAction = new QAction(tr("&Open"), this);
	connect(loadAction,SIGNAL(triggered(bool)), this,SLOT(loadFile()));
	loadAction->setShortcut(QKeySequence::Open);

	QAction *saveAction = new QAction(tr("&Save"), this);
	saveAction->setShortcut(QKeySequence::Save);
	connect(saveAction,SIGNAL(triggered(bool)), this,SLOT(save()));

	QAction *saveAsAct = new QAction(tr("Save &As..."), this);
	saveAsAct->setShortcuts(QKeySequence::SaveAs);
	saveAsAct->setStatusTip(tr("Save the atlas under a new name"));
	connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));

	QAction *exitAct = new QAction(tr("E&xit"), this);
	exitAct->setShortcuts(QKeySequence::Quit);
	exitAct->setStatusTip(tr("Exit the application"));
	connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

	QMenu *fileMenuAct = ui.menubar->addMenu(tr("File"));
	fileMenuAct->addAction(loadAction);
	fileMenuAct->addSeparator();
	fileMenuAct->addAction(saveAction);
	fileMenuAct->addAction(saveAsAct);
	fileMenuAct->addSeparator();
	fileMenuAct->addAction(exitAct);


	ui.workArea->setBinding(bindingAction->isChecked());


	connect(textureModel,SIGNAL(cantMakeAtlas()), this,SLOT(CantMakeAtlas()));

	comboBoxResolution->setCurrentIndex(1);
	resolutionAtlasChange();
}
Example #30
0
void DevGUI::setupFileActions()
{
    QToolBar *tb = new QToolBar(this);
    tb->setWindowTitle(tr("File Actions"));
    addToolBar(tb);

    QMenu *menu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(menu);

    QAction *a;

    a = new QAction(QIcon(":/new.png"), tr("&New..."), this);
    a->setShortcut(Qt::CTRL + Qt::Key_N);
    connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
    tb->addAction(a);
    menu->addAction(a);

    a = new QAction(QIcon(":/open.png"), tr("&Open..."), this);
    a->setShortcut(Qt::CTRL + Qt::Key_O);
    connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
    tb->addAction(a);
    menu->addAction(a);

    menu->addSeparator();

    actionSave = a = new QAction(QIcon(":/save.png"), tr("&Save"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_S);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
    a->setEnabled(false);
    tb->addAction(a);
    menu->addAction(a);
    
    a = new QAction(QIcon(":/save.png"), tr("Save &As..."), this);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
    a->setEnabled(false);
    menu->addAction(a);

    menu->addSeparator();

    actionSaveAll = a = new QAction(QIcon(":/saveall.png"), tr("&Save All"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_A);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAll()));
    tb->addAction(a);
    menu->addAction(a);

    menu->addSeparator();

    a = new QAction(QIcon(":/print.png"), tr("&Print..."), this);
    a->setShortcut(Qt::CTRL + Qt::Key_P);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
    tb->addAction(a);
    menu->addAction(a);

    actionClose = a = new QAction(QIcon(":/close.png"), tr("&Close"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_W);
	a->setEnabled(false);
    connect(a, SIGNAL(triggered()), this, SLOT(fileClose()));
    tb->addAction(a);
    menu->addAction(a);

    menu->addSeparator();

    a = new QAction(QIcon(":/exit.png"), tr("E&xit"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect( a, SIGNAL(triggered()), qApp, SLOT( quit() ) );
    menu->addAction(a);
}