void MainWindow::setUiDefults() { #ifdef Q_OS_MAC this->setWindowIcon(QIcon(":/cat_builder.icns")); #endif #ifdef Q_OS_WIN this->setWindowIcon(QIcon(":/cat_builder.ico")); #endif //MainWindow Geometry; QRect dg = qApp->desktop()->availableGeometry(qApp->desktop()->primaryScreen()); //Init default geometry of main window setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, QSize(dg.width()-100, dg.height()-100), dg)); dock_LvlItemBox = new LevelItemBox(this); dock_WldItemBox = new WorldItemBox(this); dock_LvlWarpProps = new LvlWarpBox(this); dock_LvlItemProps = new LvlItemProperties(this); dock_LvlSearchBox = new LvlSearchBox(this); dock_LvlEvents = new LvlEventsBox(this); dock_LvlLayers = new LvlLayersBox(this); dock_LvlSectionProps = new LvlSectionProps(this); dock_WldItemProps = new WLD_ItemProps(this); dock_WldSearchBox = new WldSearchBox(this); dock_WldSettingsBox = new WorldSettingsBox(this); dock_TilesetBox = new TilesetItemBox(this); dock_BookmarksBox = new BookmarksBox(this); dock_DebuggerBox = new DebuggerBox(this); dock_VariablesBox = new VariablesBox(this); tabifyDockWidget(dock_LvlItemBox, dock_WldItemBox); // #ifndef Q_OS_WIN // tabifyDockWidget(dock_LvlWarpProps, dock_LvlSectionProps); // tabifyDockWidget(dock_LvlSectionProps, dock_LvlItemProps); // tabifyDockWidget(dock_LvlItemProps, dock_LvlSearchBox); // tabifyDockWidget(dock_LvlSearchBox, dock_LvlLayers); // tabifyDockWidget(dock_LvlLayers, dock_LvlEvents); // tabifyDockWidget(dock_LvlEvents, dock_WldItemProps); // tabifyDockWidget(dock_WldItemProps, dock_WldSearchBox); // tabifyDockWidget(dock_WldSearchBox, dock_WldSettingsBox); // tabifyDockWidget(dock_WldSettingsBox, dock_DebuggerBox); #define DisableFloatFeature(dock) dock->setFeatures(dock->features()&(~QDockWidget::DockWidgetFloatable)); // DisableFloatFeature(dock_LvlItemBox); // DisableFloatFeature(dock_WldItemBox); // DisableFloatFeature(dock_LvlWarpProps); // DisableFloatFeature(dock_LvlSectionProps); // DisableFloatFeature(dock_LvlItemProps); // DisableFloatFeature(dock_LvlSearchBox); // DisableFloatFeature(dock_LvlLayers); // DisableFloatFeature(dock_LvlWarpProps); // DisableFloatFeature(dock_WldItemProps); // DisableFloatFeature(dock_WldSearchBox); // DisableFloatFeature(dock_WldSettingsBox); // DisableFloatFeature(dock_DebuggerBox); #ifdef Q_OS_ANDROID DisableFloatFeature(dock_TilesetBox); DisableFloatFeature(dock_BookmarksBox); #endif // #endif connect(ui->centralWidget, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(updateMenus(QMdiSubWindow*))); //connect(ui->centralWidget, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(recordSwitchedWindow(QMdiSubWindow*))); connect(&engine_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(testingFinished())); connect(this, &MainWindow::setSMBX64Strict, ui->actionCreateScriptLocal, &QAction::setDisabled); connect(this, &MainWindow::setSMBX64Strict, ui->actionCreateScriptEpisode, &QAction::setDisabled); windowMapper = new QSignalMapper(this); connect(windowMapper, SIGNAL(mapped(QWidget*)), this, SLOT(setActiveSubWindow(QWidget*))); ui->actionPlayMusic->setChecked(GlobalSettings::autoPlayMusic); ui->centralWidget->cascadeSubWindows(); ui->ResizingToolbar->setVisible(false); ui->PlacingToolbar->setVisible(false); ui->actionOverwriteMode->setVisible(false); ui->actionRectFill->setVisible(false); ui->actionCircleFill->setVisible(false); ui->actionLine->setVisible(false); ui->actionFill->setVisible(false); ui->actionFloodSectionOnly->setVisible(false); ui->actionFloodSectionOnly->setEnabled(false); #ifndef Q_OS_WIN addToolBar(Qt::LeftToolBarArea, ui->LevelObjectToolbar); addToolBar(Qt::LeftToolBarArea, ui->WorldObjectToolbar); #endif { QAction* action = ui->menuSetGridSize->addAction(tr("Default by item")); action->setData(0); connect(action, &QAction::triggered, this, &MainWindow::customGrid); ui->menuSetGridSize->addSeparator(); action = ui->menuSetGridSize->addAction("8 x 8"); action->setData(8); connect(action, &QAction::triggered, this, &MainWindow::customGrid); action = ui->menuSetGridSize->addAction("16 x 16"); action->setData(16); connect(action, &QAction::triggered, this, &MainWindow::customGrid); action = ui->menuSetGridSize->addAction("32 x 32"); action->setData(32); connect(action, &QAction::triggered, this, &MainWindow::customGrid); action = ui->menuSetGridSize->addAction("64 x 64"); action->setData(64); connect(action, &QAction::triggered, this, &MainWindow::customGrid); action = ui->menuSetGridSize->addAction(tr("Custom...")); action->setData(-1); connect(action, &QAction::triggered, this, &MainWindow::customGrid); } {//Vanilla editor's toolbar m_toolbarVanilla = new QToolBar("Vanilla toolbar", this); m_toolbarVanilla->setObjectName("m_toolbarVanilla"); QPushButton* select = new QPushButton(m_toolbarVanilla); select->setText(tr("Select", "Vanilla-like toolbar")); select->setCheckable(true); select->setChecked(ui->actionSelect->isChecked()); connect(ui->actionSelect, &QAction::toggled, select, &QPushButton::setChecked); connect(select, &QPushButton::clicked, ui->actionSelect, &QAction::trigger); m_toolbarVanilla->insertWidget(nullptr, select); QAction* selectA = m_toolbarVanilla->insertWidget(nullptr, select); connect(this, &MainWindow::windowActiveLevelWorld, selectA, &QAction::setVisible); QPushButton* erase = new QPushButton(m_toolbarVanilla); erase->setText(tr("Erase", "Vanilla-like toolbar")); erase->setCheckable(true); erase->setChecked(ui->actionEriser->isChecked()); connect(ui->actionEriser, &QAction::toggled, erase, &QPushButton::setChecked); connect(erase, &QPushButton::clicked, ui->actionEriser, &QAction::trigger); m_toolbarVanilla->insertWidget(nullptr, erase); QAction* eraseA = m_toolbarVanilla->insertWidget(nullptr, erase); connect(this, &MainWindow::windowActiveLevelWorld, eraseA, &QAction::setVisible); QPushButton* items = new QPushButton(m_toolbarVanilla); items->setText(tr("Items", "Vanilla-like toolbar")); items->setCheckable(true); items->setChecked(ui->actionTilesetBox->isChecked()); connect(ui->actionTilesetBox, &QAction::toggled, items , &QPushButton::setChecked); connect(items , &QPushButton::clicked, ui->actionTilesetBox, &QAction::trigger); m_toolbarVanilla->insertWidget(nullptr, items); QAction* itemsA = m_toolbarVanilla->insertWidget(nullptr, items); connect(this, &MainWindow::windowActiveLevelWorld, itemsA, &QAction::setVisible); QPushButton* player = new QPushButton(m_toolbarVanilla); player->setText(tr("Player", "Vanilla-like toolbar")); connect(player, &QPushButton::clicked, [=](bool) { QMenu menu; menu.insertAction(nullptr, ui->actionSetFirstPlayer); menu.insertAction(nullptr, ui->actionSetSecondPlayer); menu.exec(QCursor::pos()); }); m_toolbarVanilla->insertWidget(nullptr, player); QAction* playerA = m_toolbarVanilla->insertWidget(nullptr, player); connect(this, &MainWindow::windowActiveLevel, playerA, &QAction::setVisible); QPushButton* section = new QPushButton(m_toolbarVanilla); section->setText(tr("Section", "Vanilla-like toolbar")); section->setCheckable(true); section->setChecked(ui->actionSection_Settings->isChecked()); connect(ui->actionSection_Settings, &QAction::toggled, section , &QPushButton::setChecked); connect(section , &QPushButton::clicked, ui->actionSection_Settings, &QAction::trigger); QAction* sectionA = m_toolbarVanilla->insertWidget(nullptr, section); connect(this, &MainWindow::windowActiveLevel, sectionA, &QAction::setVisible); QPushButton* wldProps = new QPushButton(m_toolbarVanilla); wldProps->setText(tr("World settings", "Vanilla-like toolbar")); wldProps->setCheckable(true); wldProps->setChecked(ui->actionWorld_settings->isChecked()); connect(ui->actionWorld_settings, &QAction::toggled, wldProps , &QPushButton::setChecked); connect(wldProps, &QPushButton::clicked, ui->actionWorld_settings, &QAction::trigger); QAction* wldPropsAction = m_toolbarVanilla->insertWidget(nullptr, wldProps); connect(this, &MainWindow::windowActiveWorld, wldPropsAction, &QAction::setVisible); QPushButton* doors = new QPushButton(m_toolbarVanilla); doors->setText(tr("Warps and Doors", "Vanilla-like toolbar")); doors->setCheckable(true); doors->setChecked(ui->actionWarpsAndDoors->isChecked()); connect(ui->actionWarpsAndDoors, &QAction::toggled, doors , &QPushButton::setChecked); connect(doors, &QPushButton::clicked, ui->actionWarpsAndDoors, &QAction::trigger); QAction* doorsA = m_toolbarVanilla->insertWidget(nullptr, doors); connect(this, &MainWindow::windowActiveLevel, doorsA, &QAction::setVisible); QPushButton* water = new QPushButton(m_toolbarVanilla); water->setText(tr("Water", "Vanilla-like toolbar")); connect(water, &QPushButton::clicked, [=](bool) { QMenu menu; menu.insertAction(nullptr, ui->actionDrawWater); menu.insertAction(nullptr, ui->actionDrawSand); menu.exec(QCursor::pos()); }); m_toolbarVanilla->insertWidget(nullptr, water); QAction* waterA = m_toolbarVanilla->insertWidget(nullptr, water); connect(this, &MainWindow::windowActiveLevel, waterA, &QAction::setVisible); QLabel *options = new QLabel(m_toolbarVanilla); options->setText(QString("<a href=\"x\">%1</a>").arg(tr("Options"))); options->setTextFormat(Qt::RichText); connect(options, &QLabel::linkActivated, [=](const QString&) { QMenu menu; menu.insertAction(nullptr, ui->actionGridEn); menu.insertAction(nullptr, ui->actionShowGrid); menu.addMenu(ui->menuSetGridSize); menu.addSeparator(); menu.insertAction(nullptr, ui->actionAnimation); menu.insertAction(nullptr, ui->actionCollisions); menu.insertAction(nullptr, ui->actionSemi_transparent_paths); menu.exec(QCursor::pos()); }); m_toolbarVanilla->insertWidget(nullptr, options); addToolBar(Qt::BottomToolBarArea, m_toolbarVanilla); m_toolbarVanilla->setVisible(false); } ui->menuWindow->menuAction()->setEnabled(true); ui->menuLevel->menuAction()->setEnabled(false); ui->menuWorld->menuAction()->setEnabled(false); ui->menuTest->menuAction()->setEnabled(false); ui->LevelObjectToolbar->setVisible(false); ui->WorldObjectToolbar->setVisible(false); ui->actionLVLToolBox->setVisible(false); ui->actionWarpsAndDoors->setVisible(false); ui->actionSection_Settings->setVisible(false); ui->actionWarpsAndDoors->setVisible(false); ui->actionWLDToolBox->setVisible(false); ui->actionGridEn->setChecked(true); ui->actionTilesetBox->setVisible(false); ui->actionBookmarkBox->setVisible(false); ui->actionDebugger->setVisible(false); ui->actionZoomReset->setEnabled(false); ui->actionZoomIn->setEnabled(false); ui->actionZoomOut->setEnabled(false); setAcceptDrops(true); ui->centralWidget->cascadeSubWindows(); ui->centralWidget->setViewMode(GlobalSettings::MainWindowView); dock_LvlItemBox->tabWidget()->setTabPosition(GlobalSettings::LVLToolboxPos); dock_WldItemBox->tabWidget()->setTabPosition(GlobalSettings::WLDToolboxPos); ui->centralWidget->setTabsClosable(true); /*********************Music volume regulator*************************/ m_ui_musicVolume = new QSlider(Qt::Horizontal, ui->EditionToolBar); m_ui_musicVolume->setMaximumWidth(70); m_ui_musicVolume->setMinimumWidth(70); m_ui_musicVolume->setMinimum(0); #ifndef MIX_MAX_VOLUME #define MIX_MAX_VOLUME 128 #endif m_ui_musicVolume->setMaximum(MIX_MAX_VOLUME); m_ui_musicVolume->setValue(GlobalSettings::musicVolume); MusPlayer.setVolume(m_ui_musicVolume->value()); ui->EditionToolBar->insertWidget(ui->actionAnimation, m_ui_musicVolume); ui->EditionToolBar->insertSeparator(ui->actionAnimation); connect(m_ui_musicVolume, SIGNAL(valueChanged(int)), &MusPlayer, SLOT(setVolume(int))); /*********************Music volume regulator*************************/ /*********************Zoom field*************************/ zoom = new QLineEdit(ui->LevelSectionsToolBar); zoom->setValidator(new QIntValidator(0, 2001, zoom)); zoom->setText("100"); #ifdef Q_OS_OSX zoom->setMinimumWidth(40); zoom->setMaximumWidth(50); #else zoom->setMaximumWidth(28); #endif zoom->setEnabled(false); ui->LevelSectionsToolBar->insertWidget(ui->actionZoomReset,zoom); connect(zoom, SIGNAL(editingFinished()), this, SLOT(applyTextZoom())); /*********************Zoom field*************************/ /***Hide all "under construction" elements in release builds***/ #ifndef DEBUG_BUILD ui->actionVariables->setVisible(false); ui->actionScriptEditor->setVisible(false); #endif /**************************************************************/ connect(this, &MainWindow::windowActiveLevelWorld, ui->actionSelect, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionSelectOnly, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionEriser, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionHandScroll, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionCopy, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionPaste, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionCut, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionGridEn, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->menuSetGridSize, &QMenu::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionShowGrid, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->menuLevel->menuAction(), &QAction::setVisible); connect(this, &MainWindow::windowActiveWorld, ui->menuWorld->menuAction(), &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->menuLevel->menuAction(), &QAction::setEnabled); connect(this, &MainWindow::windowActiveWorld, ui->menuWorld->menuAction(), &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->menuView->menuAction(), &QAction::setEnabled); connect(this, &MainWindow::windowActiveWorld, ui->actionSemi_transparent_paths, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevelWorld, ui->menuTest->menuAction(), &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->action_doTest, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->action_doSafeTest, &QAction::setEnabled); #ifdef Q_OS_WIN connect(this, &MainWindow::windowActiveLevel, ui->actionRunTestSMBX, &QAction::setEnabled); #endif connect(this, &MainWindow::windowActiveLevel, ui->LevelObjectToolbar, &QWidget::setVisible); connect(this, &MainWindow::windowActiveWorld, ui->WorldObjectToolbar, &QWidget::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionLVLToolBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionWarpsAndDoors, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_Settings, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionLevelProp, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionLayersBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionLevelEvents, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionWarpsAndDoors, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionLVLSearchBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionTilesetBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionBookmarkBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionDebugger, &QAction::setVisible); connect(this, &MainWindow::windowActiveWorld, ui->actionWLDToolBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveWorld, ui->actionWorld_settings, &QAction::setVisible); connect(this, &MainWindow::windowActiveWorld, ui->actionWLD_SearchBox, &QAction::setVisible); connect(this, &MainWindow::windowActiveLevel, ui->actionLevNoBack, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionLevOffScr, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionWrapHorizontal, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionWrapVertically, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionLevUnderW, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionLevelProp, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionExport_to_image_section, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionExport_to_image, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionZoomIn, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionZoomOut, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionZoomReset, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, zoom, &QLineEdit::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionGotoLeftBottom, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionGotoLeftTop, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionGotoTopRight, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionGotoRightBottom, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionFixWrongMasks, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionCDATA_clear_unused, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionCDATA_Import, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionAlign_selected, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionFlipHorizontal, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionFlipVertical, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionRotateLeft, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionRotateRight, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionCloneSectionTo, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSCT_Delete, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSCT_FlipHorizontal, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSCT_FlipVertical, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSCT_RotateLeft, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSCT_RotateRight, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionAdditional_Settings, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->menuScript->menuAction(), &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionCreateScriptLocal, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->actionCreateScriptEpisode, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevelWorld, ui->menuLunaLUA_scripts->menuAction(), &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_1, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_2, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_3, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_4, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_5, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_6, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_7, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_8, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_9, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_10, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_11, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_12, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_13, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_14, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_15, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_16, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_17, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_18, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_19, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_20, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSection_21, &QAction::setEnabled); connect(this, &MainWindow::windowActiveLevel, ui->actionSectionMore, &QAction::setEnabled); }
void MainWindow::setUiDefults() { #ifdef Q_OS_MAC this->setWindowIcon(QIcon(":/cat_builder.icns")); #endif //Apply objects into tools setLevelSectionData(); setLvlItemBoxes(); setWldItemBoxes(); setSoundList(); applyTheme(Themes::currentTheme().isEmpty() ? ConfStatus::defaultTheme : Themes::currentTheme()); WldLvlExitTypeListReset(); //MainWindow Geometry; QRect mwg = this->geometry(); int GOffset=240; //Define the default geometry for toolboxes ui->DoorsToolbox->setGeometry( mwg.x()+mwg.width()-ui->DoorsToolbox->width()-GOffset, mwg.y()+120, ui->DoorsToolbox->width(), ui->DoorsToolbox->height() ); ui->LevelSectionSettings->setGeometry( mwg.x()+mwg.width()-ui->LevelSectionSettings->width()-GOffset, mwg.y()+120, ui->LevelSectionSettings->width(), ui->LevelSectionSettings->height() ); ui->LevelLayers->setGeometry( mwg.x()+mwg.width()-ui->LevelLayers->width()-GOffset, mwg.y()+120, ui->LevelLayers->width(), ui->LevelLayers->height() ); ui->LevelEventsToolBox->setGeometry( mwg.x()+mwg.width()-ui->LevelEventsToolBox->width()-GOffset, mwg.y()+120, ui->LevelEventsToolBox->width(), ui->LevelEventsToolBox->height() ); ui->ItemProperties->setGeometry( mwg.x()+mwg.width()-ui->ItemProperties->width()-GOffset, mwg.y()+120, ui->ItemProperties->width(), ui->ItemProperties->height() ); ui->FindDock->setGeometry( mwg.x()+mwg.width()-ui->FindDock->width()-GOffset, mwg.y()+120, ui->FindDock->width(), ui->FindDock->height() ); ui->WLD_ItemProps->setGeometry( mwg.x()+mwg.width()-ui->WLD_ItemProps->width()-GOffset, mwg.y()+120, ui->WLD_ItemProps->width(), ui->WLD_ItemProps->height() ); ui->WorldSettings->setGeometry( mwg.x()+mwg.width()-ui->WorldSettings->width()-GOffset-200, mwg.y()+120, ui->WorldSettings->width(), ui->WorldSettings->height() ); ui->WorldFindDock->setGeometry( mwg.x()+mwg.width()-ui->WorldFindDock->width()-GOffset, mwg.y()+120, ui->WorldFindDock->width(), ui->WorldFindDock->height() ); ui->Tileset_Item_Box->setGeometry( mwg.x()+GOffset, mwg.y()+mwg.height()-600, 800, 300 ); ui->debuggerBox->setGeometry( mwg.x()+mwg.width()-ui->debuggerBox->width()-GOffset, mwg.y()+120, ui->debuggerBox->width(), ui->debuggerBox->height() ); ui->bookmarkBox->setGeometry( mwg.x()+mwg.width()-ui->bookmarkBox->width()-GOffset, mwg.y()+120, ui->bookmarkBox->width(), ui->bookmarkBox->height() ); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); font.setWeight(8); ui->DEBUG_Items->setFont(font); loadSettings(); connect(ui->centralWidget, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(updateMenus())); windowMapper = new QSignalMapper(this); connect(windowMapper, SIGNAL(mapped(QWidget*)), this, SLOT(setActiveSubWindow(QWidget*))); ui->actionPlayMusic->setChecked(GlobalSettings::autoPlayMusic); ui->actionExport_to_image_section->setVisible(false); ui->actionVBAlphaEmulate->setChecked(GraphicsHelps::EnableVBEmulate); ui->centralWidget->cascadeSubWindows(); ui->applyResize->setVisible(false); ui->cancelResize->setVisible(false); ui->ResizingToolbar->setVisible(false); ui->PlacingToolbar->setVisible(false); ui->LevelToolBox->hide(); ui->DoorsToolbox->hide(); ui->LevelLayers->hide(); ui->LevelEventsToolBox->hide(); ui->LevelSectionSettings->hide(); ui->ItemProperties->hide(); ui->FindDock->hide(); ui->WorldToolBox->hide(); ui->WorldSettings->hide(); ui->WLD_ItemProps->hide(); ui->WorldFindDock->hide(); ui->Tileset_Item_Box->hide(); ui->debuggerBox->hide(); ui->bookmarkBox->hide(); ui->menuView->setEnabled(false); ui->menuWindow->setEnabled(true); ui->menuLevel->setEnabled(false); ui->menuWorld->setEnabled(false); ui->menuTest->setEnabled(false); ui->LevelObjectToolbar->setVisible(false); ui->WorldObjectToolbar->setVisible(false); ui->actionLVLToolBox->setVisible(false); ui->actionWarpsAndDoors->setVisible(false); ui->actionSection_Settings->setVisible(false); ui->actionWarpsAndDoors->setVisible(false); ui->actionWLDToolBox->setVisible(false); ui->actionGridEn->setChecked(true); ui->actionTilesetBox->setVisible(false); ui->actionBookmarkBox->setVisible(false); ui->actionDebugger->setVisible(false); ui->actionZoomReset->setEnabled(false); ui->actionZoomIn->setEnabled(false); ui->actionZoomOut->setEnabled(false); setAcceptDrops(true); ui->centralWidget->cascadeSubWindows(); ui->centralWidget->setViewMode(GlobalSettings::MainWindowView); ui->LevelToolBoxTabs->setTabPosition(GlobalSettings::LVLToolboxPos); ui->WorldToolBoxTabs->setTabPosition(GlobalSettings::WLDToolboxPos); ui->TileSetsCategories->setTabPosition(GlobalSettings::TSTToolboxPos); ui->centralWidget->setTabsClosable(true); muVol = new QSlider(Qt::Horizontal); muVol->setMaximumWidth(70); muVol->setMinimumWidth(70); muVol->setMinimum(0); muVol->setMaximum(MIX_MAX_VOLUME); muVol->setValue(GlobalSettings::musicVolume); MusPlayer.setVolume(muVol->value()); ui->EditionToolBar->insertWidget(ui->actionAnimation, muVol); ui->EditionToolBar->insertSeparator(ui->actionAnimation); zoom = new QLineEdit(); zoom->setValidator(new QIntValidator(0,2001)); zoom->setText("100"); zoom->setMaximumWidth(50); zoom->setEnabled(false); ui->LevelSectionsToolBar->insertWidget(ui->actionZoomReset,zoom); connect(zoom, SIGNAL(editingFinished()), this, SLOT(applyTextZoom())); connect(muVol, SIGNAL(valueChanged(int)), &MusPlayer, SLOT(setVolume(int))); curSearchBlock.id = 0; curSearchBlock.index = 0; curSearchBlock.npc_id = 0; curSearchBGO.id = 0; curSearchBGO.index = 0; curSearchNPC.id = 0; curSearchNPC.index = 0; curSearchTile.id = 0; curSearchTile.index = 0; curSearchScenery.id = 0; curSearchScenery.index = 0; curSearchPath.id = 0; curSearchPath.index = 0; curSearchLevel.id = 0; curSearchLevel.index = 0; curSearchMusic.id = 0; curSearchMusic.index = 0; connect(ui->LvlLayerList->model(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(DragAndDroppedLayer(QModelIndex,int,int,QModelIndex,int))); connect(ui->LVLEvents_List->model(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(DragAndDroppedEvent(QModelIndex,int,int,QModelIndex,int))); connect(ui->bookmarkList->model(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(DragAndDroppedBookmark(QModelIndex,int,int,QModelIndex,int))); //enable & disable connect(ui->Find_Check_TypeBlock, SIGNAL(toggled(bool)), ui->Find_Button_TypeBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_TypeBGO, SIGNAL(toggled(bool)), ui->Find_Button_TypeBGO, SLOT(setEnabled(bool))); connect(ui->Find_Check_TypeNPC, SIGNAL(toggled(bool)), ui->Find_Button_TypeNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_PriorityBGO, SIGNAL(toggled(bool)), ui->Find_Spin_PriorityBGO, SLOT(setEnabled(bool))); connect(ui->Find_Check_LayerBlock, SIGNAL(toggled(bool)), ui->Find_Combo_LayerBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_LayerBGO, SIGNAL(toggled(bool)), ui->Find_Combo_LayerBGO, SLOT(setEnabled(bool))); connect(ui->Find_Check_LayerNPC, SIGNAL(toggled(bool)), ui->Find_Combo_LayerNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_InvisibleBlock, SIGNAL(toggled(bool)), ui->Find_Check_InvisibleActiveBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_SlipperyBlock, SIGNAL(toggled(bool)), ui->Find_Check_SlipperyActiveBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_ContainsNPCBlock, SIGNAL(toggled(bool)), ui->Find_Button_ContainsNPCBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_EventDestoryedBlock, SIGNAL(toggled(bool)), ui->Find_Combo_EventDestoryedBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_EventHitedBlock, SIGNAL(toggled(bool)), ui->Find_Combo_EventHitedBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_EventLayerEmptyBlock, SIGNAL(toggled(bool)), ui->Find_Combo_EventLayerEmptyBlock, SLOT(setEnabled(bool))); connect(ui->Find_Check_DirNPC, SIGNAL(toggled(bool)), ui->Find_Radio_DirLeftNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_DirNPC, SIGNAL(toggled(bool)), ui->Find_Radio_DirRandomNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_DirNPC, SIGNAL(toggled(bool)), ui->Find_Radio_DirRightNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_FriendlyNPC, SIGNAL(toggled(bool)), ui->Find_Check_FriendlyActiveNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_NotMoveNPC, SIGNAL(toggled(bool)), ui->Find_Check_NotMoveActiveNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_BossNPC, SIGNAL(toggled(bool)), ui->Find_Check_BossActiveNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_MsgNPC, SIGNAL(toggled(bool)), ui->Find_Edit_MsgNPC, SLOT(setEnabled(bool))); connect(ui->Find_Check_MsgNPC, SIGNAL(toggled(bool)), ui->Find_Check_MsgSensitiveNPC, SLOT(setEnabled(bool))); //for world search connect(ui->Find_Check_TypeLevel, SIGNAL(toggled(bool)), ui->Find_Button_TypeLevel, SLOT(setEnabled(bool))); connect(ui->Find_Check_TypeTile, SIGNAL(toggled(bool)), ui->Find_Button_TypeTile, SLOT(setEnabled(bool))); connect(ui->Find_Check_TypeScenery, SIGNAL(toggled(bool)), ui->Find_Button_TypeScenery, SLOT(setEnabled(bool))); connect(ui->Find_Check_TypePath, SIGNAL(toggled(bool)), ui->Find_Button_TypePath, SLOT(setEnabled(bool))); connect(ui->Find_Check_TypeMusic, SIGNAL(toggled(bool)), ui->Find_Button_TypeMusic, SLOT(setEnabled(bool))); connect(ui->Find_Check_PathBackground, SIGNAL(toggled(bool)), ui->Find_Check_PathBackgroundActive, SLOT(setEnabled(bool))); connect(ui->Find_Check_BigPathBackground, SIGNAL(toggled(bool)), ui->Find_Check_BigPathBackgroundActive, SLOT(setEnabled(bool))); connect(ui->Find_Check_AlwaysVisible, SIGNAL(toggled(bool)), ui->Find_Check_AlwaysVisibleActive, SLOT(setEnabled(bool))); connect(ui->Find_Check_GameStartPoint, SIGNAL(toggled(bool)), ui->Find_Check_GameStartPointActive, SLOT(setEnabled(bool))); connect(ui->Find_Check_LevelFile, SIGNAL(toggled(bool)), ui->Find_Edit_LevelFile, SLOT(setEnabled(bool))); connect(ui->Find_Check_LevelFile, SIGNAL(toggled(bool)), ui->Find_Button_LevelFile, SLOT(setEnabled(bool))); connect(ui->Find_Check_ContainsTitle, SIGNAL(toggled(bool)), ui->Find_Edit_ContainsTitle, SLOT(setEnabled(bool))); //reset if modify connect(ui->Find_Button_TypeBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Button_TypeBGO, SIGNAL(clicked()), this, SLOT(resetBGOSearch())); connect(ui->Find_Button_TypeNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Spin_PriorityBGO, SIGNAL(valueChanged(int)), this, SLOT(resetBGOSearch())); connect(ui->Find_Combo_LayerBlock, SIGNAL(activated(int)), this, SLOT(resetBlockSearch())); connect(ui->Find_Combo_LayerBGO, SIGNAL(activated(int)), this, SLOT(resetBGOSearch())); connect(ui->Find_Combo_LayerNPC, SIGNAL(activated(int)), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_InvisibleActiveBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_SlipperyActiveBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Button_ContainsNPCBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Combo_EventDestoryedBlock, SIGNAL(activated(int)), this, SLOT(resetBlockSearch())); connect(ui->Find_Combo_EventHitedBlock, SIGNAL(activated(int)), this, SLOT(resetBlockSearch())); connect(ui->Find_Combo_EventLayerEmptyBlock, SIGNAL(activated(int)), this, SLOT(resetBlockSearch())); connect(ui->Find_Radio_DirLeftNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Radio_DirRandomNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Radio_DirRightNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_FriendlyActiveNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_NotMoveActiveNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_BossActiveNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Edit_MsgNPC, SIGNAL(textEdited(QString)), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_MsgSensitiveNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); //for world connect(ui->Find_Button_TypeTile, SIGNAL(clicked()), this, SLOT(resetTileSearch())); connect(ui->Find_Button_TypeScenery, SIGNAL(clicked()), this, SLOT(resetScenerySearch())); connect(ui->Find_Button_TypePath, SIGNAL(clicked()), this, SLOT(resetPathSearch())); connect(ui->Find_Button_TypeLevel, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Button_TypeMusic, SIGNAL(clicked()), this, SLOT(resetMusicSearch())); connect(ui->Find_Check_PathBackgroundActive, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_BigPathBackgroundActive, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_AlwaysVisibleActive, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_GameStartPointActive, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Edit_LevelFile, SIGNAL(textEdited(QString)), this, SLOT(resetLevelSearch())); connect(ui->Find_Button_LevelFile, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Edit_ContainsTitle, SIGNAL(textEdited(QString)), this, SLOT(resetLevelSearch())); //also checkboxes connect(ui->Find_Check_TypeBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_LayerBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_InvisibleBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_SlipperyBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_ContainsNPCBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_EventDestoryedBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_EventLayerEmptyBlock, SIGNAL(clicked()), this, SLOT(resetBlockSearch())); connect(ui->Find_Check_TypeBGO, SIGNAL(clicked()), this, SLOT(resetBGOSearch())); connect(ui->Find_Check_LayerBGO, SIGNAL(clicked()), this, SLOT(resetBGOSearch())); connect(ui->Find_Check_PriorityBGO, SIGNAL(clicked()), this, SLOT(resetBGOSearch())); connect(ui->Find_Check_TypeNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_LayerNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_DirNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_FriendlyNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_NotMoveNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_BossNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); connect(ui->Find_Check_MsgNPC, SIGNAL(clicked()), this, SLOT(resetNPCSearch())); //for world connect(ui->Find_Check_TypeTile, SIGNAL(clicked()), this, SLOT(resetTileSearch())); connect(ui->Find_Check_TypeScenery, SIGNAL(clicked()), this, SLOT(resetScenerySearch())); connect(ui->Find_Check_TypePath, SIGNAL(clicked()), this, SLOT(resetPathSearch())); connect(ui->Find_Check_TypeLevel, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_TypeMusic, SIGNAL(clicked()), this, SLOT(resetMusicSearch())); connect(ui->Find_Check_PathBackground, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_BigPathBackground, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_AlwaysVisible, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_GameStartPoint, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_LevelFile, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Check_ContainsTitle, SIGNAL(clicked()), this, SLOT(resetLevelSearch())); connect(ui->Find_Button_LevelFile, SIGNAL(clicked()), this, SLOT(selectLevelForSearch())); connect(ui->centralWidget, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(toggleNewWindowLVL(QMdiSubWindow*))); connect(ui->centralWidget, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(toggleNewWindowWLD(QMdiSubWindow*))); //for tileset dock //connect(ui->TileSetsCategories, SIGNAL(currentChanged(int)), this, SLOT(makeCurrentTileset())); //for tileset connect(ui->customTilesetSearchEdit, SIGNAL(textChanged(QString)), this, SLOT(makeCurrentTileset())); updateWindowMenu(); }