SLGMMainWindow::SLGMMainWindow(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); connect(ui.actionNew,SIGNAL(triggered()),this,SLOT(onActionNew())); connect(ui.actionOpen,SIGNAL(triggered()),this,SLOT(onActionOpen())); connect(ui.actionSave,SIGNAL(triggered()),this,SLOT(onActionSave())); connect(ui.actionSaveAs,SIGNAL(triggered()),this,SLOT(onActionSaveAs())); connect(ui.actionClose,SIGNAL(triggered()),this,SLOT(onActionClose())); mainLayout = new QHBoxLayout(); editorWidget = new SLGMEditorWidget(); widgetMapTreeEditor = new SLGMMapTreeEditor(this->getEditorScene()->game, this); objectSelectorWidget = new SLGMObjectSelectorWidget(this); mainLayout->addWidget(widgetMapTreeEditor); mainLayout->addWidget(editorWidget); mainLayout->addWidget(objectSelectorWidget); QWidget* temp = new QWidget(); temp->setLayout(mainLayout); setCentralWidget(temp); }
/** * \brief Constructor * @param parent as the parent widget * @param name as the object name */ UBLibActionBar::UBLibActionBar(QWidget *parent, const char *name):QWidget(parent) , mCrntButtonSet(eButtonSet_Default) , mPreviousButtonSet(eButtonSet_Default) , mButtonGroup(NULL) , mSearchBar(NULL) , mLayout(NULL) , mpFavoriteAction(NULL) , mpSocialAction(NULL) , mpDeleteAction(NULL) , mpSearchAction(NULL) , mpCloseAction(NULL) , mpRemoveFavorite(NULL) , mpNewFolderAction(NULL) , mpFavoriteBtn(NULL) , mpSocialBtn(NULL) , mpDeleteBtn(NULL) , mpSearchBtn(NULL) , mpCloseBtn(NULL) , mpRemoveFavoriteBtn(NULL) , mpNewFolderBtn(NULL) , bFavorite(false) , bIsInTrash(false) { setObjectName(name); setStyleSheet(QString("background: #EEEEEE; border-radius : 10px; border : 2px solid #999999;")); setAcceptDrops(true); mButtonGroup = new QButtonGroup(this); mSearchBar = new QLineEdit(this); mSearchBar->setStyleSheet(QString("background-color:white; border-radius : 10px; padding : 2px;")); connect(mSearchBar, SIGNAL(returnPressed()), this, SLOT(onActionSearch())); mLayout = new QHBoxLayout(); setLayout(mLayout); setMaximumHeight(ACTIONBAR_HEIGHT); // Create the actions mpFavoriteAction = new QAction(QIcon(":/images/libpalette/miniFavorite.png"), tr("Add to favorites"), this); mpSocialAction = new QAction(QIcon(":/images/libpalette/social.png"), tr("Share"), this); mpSearchAction = new QAction(QIcon(":/images/libpalette/miniSearch.png"), tr("Search"), this); mpDeleteAction = new QAction(QIcon(":/images/libpalette/miniTrash.png"), tr("Delete"), this); mpCloseAction = new QAction(QIcon(":/images/close.svg"), tr("Back to folder"), this); mpRemoveFavorite = new QAction(QIcon(":/images/libpalette/trash_favorite.svg"), tr("Remove from favorites"), this); mpNewFolderAction = new QAction(QIcon(":/images/libpalette/miniNewFolder.png"), tr("Create new folder"), this); // Create the buttons mpFavoriteBtn = new UBActionButton(this, mpFavoriteAction); mpSocialBtn = new UBActionButton(this, mpSocialAction); mpSearchBtn = new UBActionButton(this, mpSearchAction); mpDeleteBtn = new UBActionButton(this, mpDeleteAction); mpCloseBtn = new UBActionButton(this, mpCloseAction); mpRemoveFavoriteBtn = new UBActionButton(this, mpRemoveFavorite); mpNewFolderBtn = new UBActionButton(this, mpNewFolderAction); // Initialize the buttons mpSearchBtn->setEnabled(false); mpNewFolderBtn->setEnabled(false); // Add the buttons to the button group mButtonGroup->addButton(mpFavoriteBtn); mButtonGroup->addButton(mpSocialBtn); mButtonGroup->addButton(mpSearchBtn); mButtonGroup->addButton(mpDeleteBtn); mButtonGroup->addButton(mpCloseBtn); mButtonGroup->addButton(mpRemoveFavoriteBtn); mButtonGroup->addButton(mpNewFolderBtn); // Connect signals & slots connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite())); connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial())); connect(mpSearchAction,SIGNAL(triggered()), this, SLOT(onActionSearch())); connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash())); connect(mpCloseAction, SIGNAL(triggered()), this, SLOT(onActionClose())); connect(mpRemoveFavorite, SIGNAL(triggered()), this, SLOT(onActionRemoveFavorite())); connect(mSearchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchTextChanged(QString))); connect(mpNewFolderAction, SIGNAL(triggered()), this, SLOT(onActionNewFolder())); // Build the default toolbar mLayout->addWidget(mpFavoriteBtn); mLayout->addWidget(mpSocialBtn); mLayout->addWidget(mpNewFolderBtn); mLayout->addWidget(mSearchBar); mLayout->addWidget(mpSearchBtn); mLayout->addWidget(mpDeleteBtn); mLayout->addWidget(mpCloseBtn); mLayout->addWidget(mpRemoveFavoriteBtn); setButtons(eButtonSet_Default); }