void CoreService::ready() { _settings.beginGroup("data"); QString profileData = _settings.value("profile").toString(); QStringList leagues = _settings.value("leagues").toStringList(); _settings.endGroup(); qDebug() << leagues; getPluginManager()->loadPlugins(); qInfo() << qPrintable("Adamant Started!"); getInterface()->registerPages(); // Set page to home getInterface()->window()->setPageIndex(0); }
UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio_) : mainWindow(mainWindow_), processorGraph(pgraph), audio(audio_) { processorGraph->createDefaultNodes(); messageCenterEditor = (MessageCenterEditor*) processorGraph->getMessageCenter()->createEditor(); addActionListener(messageCenterEditor); addAndMakeVisible(messageCenterEditor); std::cout << "Created message center." << std::endl; infoLabel = new InfoLabel(); std::cout << "Created info label." << std::endl; graphViewer = new GraphViewer(); std::cout << "Created graph viewer." << std::endl; dataViewport = new DataViewport(); addChildComponent(dataViewport); dataViewport->addTabToDataViewport("Info", infoLabel,0); dataViewport->addTabToDataViewport("Graph", graphViewer,0); std::cout << "Created data viewport." << std::endl; editorViewport = new EditorViewport(); addAndMakeVisible(editorViewport); std::cout << "Created filter viewport." << std::endl; editorViewportButton = new EditorViewportButton(this); addAndMakeVisible(editorViewportButton); controlPanel = new ControlPanel(processorGraph, audio); addAndMakeVisible(controlPanel); std::cout << "Created control panel." << std::endl; processorList = new ProcessorList(); processorListViewport.setViewedComponent(processorList,false); processorListViewport.setScrollBarsShown(true,false); addAndMakeVisible(&processorListViewport); processorList->setVisible(true); processorList->setBounds(0,0,195,processorList->getTotalHeight()); std::cout << "Created filter list." << std::endl; pluginManager = new PluginManager(); std::cout << "Created plugin manager" << std::endl; setBounds(0,0,500,400); AccessClass::setUIComponent(this); getPluginManager()->loadAllPlugins(); getProcessorList()->fillItemList(); controlPanel->updateChildComponents(); processorGraph->updatePointers(); // needs to happen after processorGraph gets the right pointers #if JUCE_MAC MenuBarModel::setMacMainMenu(this); mainWindow->setMenuBar(0); #else mainWindow->setMenuBar(this); #endif }
bool CoreService::load() { sensitiveSettings()->beginGroup("session"); QString sessionId = sensitiveSettings()->value("id").toString(); QString accessToken = sensitiveSettings()->value("access_token").toString(); sensitiveSettings()->endGroup(); // Required here so that the setup dialog also gets this palette getInterface()->setTheme(); getInterface()->start(); SetupDialog::LoginMethod method = SetupDialog::LoginSessionId; if (!accessToken.isEmpty()) { method = SetupDialog::LoginOAuth; } while (sessionId.isEmpty() && accessToken.isEmpty()) { // Oh no, run setup. int result = getInterface()->showSetup(); // Blocking if (result != 0x0) { getInterface()->window()->close(); return false; } QVariantMap map = getInterface()->getSetupDialog()->getData(); // Setup completed, we should have valid data sensitiveSettings()->beginGroup("session"); for (QString key : map.uniqueKeys()) { sensitiveSettings()->setValue(key, map.value(key)); } sessionId = map.value("id").toString(); sensitiveSettings()->endGroup(); method = (SetupDialog::LoginMethod)map.value("method").toInt(); if (method == SetupDialog::LoginOAuth && !map.value("access_token").toString().isEmpty()) { break; } } // These are requirements for data we need before the application loads _requiredData.clear(); // Load Plugins getPluginManager()->scanPlugins(true); getPluginManager()->verifyPlugins(); getPluginManager()->preparePlugins(); // Load the main application! /* Require leagues list */ { ADD_REQUIREMENT(session(), Session::Request::leaguesList, QStringList, leagues); session()->fetchLeagues(); } /* Require profile data */ { ADD_REQUIREMENT(session(), Session::Request::profileData, QString, profile); switch (method) { case SetupDialog::LoginSessionId: case SetupDialog::LoginEmail: case SetupDialog::LoginSteam: session()->loginWithSessionId(sessionId); break; case SetupDialog::LoginOAuth: session()->fetchProfileData(); break; } // TODO(rory): Improve this connect(session(), &Session::Request::loginResult, [this] (int result, QString resultString) { if (result == 0) { } else { qDebug() << "Failed to log in: " << resultString; } }); } return true; }