MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); createActions(); createMenus(); initDirectories(&dirModel_confs, QStringList("*.xml"), ui->treeView_configs); initDirectories(&dirModel_elabs, QStringList("*.java"), ui->treeView_elaborations); connect(ui->elaborateButton, SIGNAL(clicked()), this, SLOT(elaborate())); ui->elaborateButton->setHidden(true); ui->tabWidget->setHidden(true); ui->treeView_configs->setVisible(true); ui->treeView_configs->setExpandsOnDoubleClick(false); ui->openFolder->setEnabled(false); setAcceptDrops( true); //Drag & Drop setWindowTitle(tr("ELCI (EL Configuration Interface)")); setMinimumSize(300, WIND_HEIGHT); resize(WIND_WIDTH, WIND_HEIGHT); setWindowIcon(QIcon(":/icon.ico")); loadDirectory(); }
void dirSetup(const char *executable) { #ifdef LOCAL_DATA goto_installpath(executable); #endif initDirectories(); }
/* MainApp::OnInit * Application initialization, run when program is started *******************************************************************/ bool MainApp::OnInit() { // Set locale to C so that the tokenizer will work properly // even in locales where the decimal separator is a comma. setlocale(LC_ALL, "C"); // Init global variables Global::error = ""; ArchiveManager::getInstance(); init_ok = false; // Init variables action_invalid = new SAction("invalid", "Invalid Action", "", "Something's gone wrong here"); // Setup system options wxSystemOptions::SetOption("mac.listctrl.always_use_generic", 1); // Set application name (for wx directory stuff) #ifdef __WINDOWS__ wxApp::SetAppName("SLADE3"); #else wxApp::SetAppName("slade3"); #endif // Handle exceptions using wxDebug stuff, but only in release mode #ifdef NDEBUG wxHandleFatalExceptions(true); #endif // Init application directories if (!initDirectories()) return false; // Load image handlers wxInitAllImageHandlers(); // Init logfile initLogFile(); // Init keybinds KeyBind::initBinds(); // Load configuration file wxLogMessage("Loading configuration"); readConfigFile(); Global::log_verbosity = log_verbosity; // Check that SLADE.pk3 can be found wxLogMessage("Loading resources"); theArchiveManager->init(); if (!theArchiveManager->resArchiveOK()) { wxMessageBox("Unable to find slade.pk3, make sure it exists in the same directory as the SLADE executable", "Error", wxICON_ERROR); return false; } // Init lua Lua::init(); // Calculate scaling factor (from system ppi) wxMemoryDC dc; Global::ppi_scale = (double)(dc.GetPPI().x) / 96.0; // Show splash screen theSplashWindow->init(); theSplashWindow->show("Starting up..."); // Init SImage formats SIFormat::initFormats(); // Load program icons wxLogMessage("Loading icons"); loadIcons(); // Load program fonts Drawing::initFonts(); // Load entry types wxLogMessage("Loading entry types"); EntryDataFormat::initBuiltinFormats(); EntryType::loadEntryTypes(); // Load text languages wxLogMessage("Loading text languages"); TextLanguage::loadLanguages(); // Init text stylesets wxLogMessage("Loading text style sets"); StyleSet::loadResourceStyles(); StyleSet::loadCustomStyles(); // Init colour configuration wxLogMessage("Loading colour configuration"); ColourConfiguration::init(); // Init nodebuilders NodeBuilders::init(); // Init game executables Executables::init(); // Init actions initActions(); theMainWindow; // Init base resource wxLogMessage("Loading base resource"); theArchiveManager->initBaseResource(); wxLogMessage("Base resource loaded"); // Show the main window theMainWindow->Show(true); SetTopWindow(theMainWindow); theSplashWindow->SetParent(theMainWindow); theSplashWindow->CentreOnParent(); // Open any archives on the command line // argv[0] is normally the executable itself (i.e. Slade.exe) // and opening it as an archive should not be attempted... for (int a = 1; a < argc; a++) { string arg = argv[a]; theArchiveManager->openArchive(arg); } // Hide splash screen theSplashWindow->hide(); init_ok = true; wxLogMessage("SLADE Initialisation OK"); // Init game configuration theGameConfiguration->init(); // Show Setup Wizard if needed if (!setup_wizard_run) { SetupWizardDialog dlg(theMainWindow); dlg.ShowModal(); setup_wizard_run = true; } // Check for updates #ifdef __WXMSW__ wxHTTP::Initialize(); if (update_check) checkForUpdates(false); #endif // Bind events Bind(wxEVT_MENU, &MainApp::onMenu, this); Bind(wxEVT_COMMAND_VERSIONCHECK_COMPLETED, &MainApp::onVersionCheckCompleted, this); return true; }
// ----------------------------------------------------------------------------- // Application initialisation // ----------------------------------------------------------------------------- bool App::init(vector<std::string>& args, double ui_scale) { // Get the id of the current thread (should be the main one) main_thread_id = std::this_thread::get_id(); // Set locale to C so that the tokenizer will work properly // even in locales where the decimal separator is a comma. setlocale(LC_ALL, "C"); // Init application directories if (!initDirectories()) return false; // Init log Log::init(); // Process the command line arguments auto paths_to_open = processCommandLine(args); // Init keybinds KeyBind::initBinds(); // Load configuration file Log::info("Loading configuration"); readConfigFile(); // Check that SLADE.pk3 can be found Log::info("Loading resources"); archive_manager.init(); if (!archive_manager.resArchiveOK()) { wxMessageBox( "Unable to find slade.pk3, make sure it exists in the same directory as the " "SLADE executable", "Error", wxICON_ERROR); return false; } // Init SActions SAction::initWxId(26000); SAction::initActions(); // Init lua Lua::init(); // Init UI UI::init(ui_scale); // Show splash screen UI::showSplash("Starting up..."); // Init palettes if (!palette_manager.init()) { Log::error("Failed to initialise palettes"); return false; } // Init SImage formats SIFormat::initFormats(); // Init brushes SBrush::initBrushes(); // Load program icons Log::info("Loading icons"); Icons::loadIcons(); // Load program fonts Drawing::initFonts(); // Load entry types Log::info("Loading entry types"); EntryDataFormat::initBuiltinFormats(); EntryType::loadEntryTypes(); // Load text languages Log::info("Loading text languages"); TextLanguage::loadLanguages(); // Init text stylesets Log::info("Loading text style sets"); StyleSet::loadResourceStyles(); StyleSet::loadCustomStyles(); // Init colour configuration Log::info("Loading colour configuration"); ColourConfiguration::init(); // Init nodebuilders NodeBuilders::init(); // Init game executables Executables::init(); // Init main editor MainEditor::init(); // Init base resource Log::info("Loading base resource"); archive_manager.initBaseResource(); Log::info("Base resource loaded"); // Init game configuration Log::info("Loading game configurations"); Game::init(); // Init script manager ScriptManager::init(); // Show the main window MainEditor::windowWx()->Show(true); wxGetApp().SetTopWindow(MainEditor::windowWx()); UI::showSplash("Starting up...", false, MainEditor::windowWx()); // Open any archives from the command line for (auto& path : paths_to_open) archive_manager.openArchive(path); // Hide splash screen UI::hideSplash(); init_ok = true; Log::info("SLADE Initialisation OK"); // Show Setup Wizard if needed if (!setup_wizard_run) { SetupWizardDialog dlg(MainEditor::windowWx()); dlg.ShowModal(); setup_wizard_run = true; MainEditor::windowWx()->Update(); MainEditor::windowWx()->Refresh(); } return true; }
void dirSetup(const char *executable[]) { initDirectories(); }