GraphicsResourceManager::GraphicsResourceManager(Sirikata::Task::WorkQueue *dependencyQueue) : mEpoch(0), mEnabled(true) { this->mTickListener = EventSource::getSingleton().subscribeId( EventID(EventTypes::Tick), EVENT_CALLBACK(GraphicsResourceManager, tick, this) ); mDependencyManager = new DependencyManager(dependencyQueue); mBudget = OPTION_VIDEO_MEMORY_RESOURCE_CACHE_SIZE->as<int>() * 1024 * 1024; }
//----------------------------------------------------------------------------------------- GenericTextEditor::GenericTextEditor(QString editorName, QWidget *parent) : QMdiArea(parent) { mParentTabWidget = static_cast<QTabWidget*>(parent->parent()); setObjectName(editorName); setViewMode(QMdiArea::TabbedView); QTabBar* tabBar = findChildren<QTabBar*>().at(0); tabBar->setTabsClosable(true); connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); mActSave = new QAction(tr("Save"), this); mActSave->setStatusTip(tr("Save")); mActSave->setIcon( QIcon( ":/icons/filesave.svg" )); mActSave->setEnabled(false); mActEditCopy = new QAction(tr("Copy"), this); mActEditCopy->setStatusTip(tr("Copy Selected")); mActEditCopy->setIcon( QIcon( ":/icons/editcopy.svg")); mActEditCopy->setEnabled(false); mActEditCut = new QAction(tr("Cut"), this); mActEditCut->setStatusTip(tr("Cut Selected")); mActEditCut->setIcon( QIcon( ":/icons/editcut.svg")); mActEditCut->setEnabled(false); mActEditPaste = new QAction(tr("Paste"), this); mActEditPaste->setStatusTip(tr("Paste From Clipboard")); mActEditPaste->setIcon( QIcon( ":/icons/editpaste.svg")); mActEditPaste->setEnabled(false); mMainToolBar = new QToolBar(); mMainToolBar->setObjectName("renderwindowtoolbar"); mMainToolBar->setIconSize(QSize(20,20)); mMainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); mMainToolBar->addAction(mActSave); mMainToolBar->addSeparator(); mMainToolBar->addAction(mActEditCut); mMainToolBar->addAction(mActEditCopy); mMainToolBar->addAction(mActEditPaste); QMainWindow *mw = static_cast<QMainWindow*>(this->parentWidget()); mw->addToolBar(Qt::TopToolBarArea, mMainToolBar); mLastDocument = 0; connect(mActEditCut, SIGNAL(triggered()), this, SLOT(pasteAvailable())); connect(mActEditCopy, SIGNAL(triggered()), this, SLOT(pasteAvailable())); connect(mActSave, SIGNAL(triggered()), this, SLOT(onSave())); // Register the standard generic text editor codec extensions GenericTextEditorCodecFactory* genCodecFactory = new GenericTextEditorCodecFactory(); GenericTextEditor::registerCodecFactory("txt", genCodecFactory); GenericTextEditor::registerCodecFactory("xml", genCodecFactory); GenericTextEditor::registerCodecFactory("ogscene", genCodecFactory); GenericTextEditor::registerCodecFactory("html", genCodecFactory); GenericTextEditor::registerCodecFactory("htm", genCodecFactory); GenericTextEditor::registerCodecFactory("scene", genCodecFactory); GenericTextEditor::registerCodecFactory("cfg", genCodecFactory); GenericTextEditor::registerCodecFactory("log", genCodecFactory); Ogitors::EventManager::getSingletonPtr()->connectEvent(Ogitors::EventManager::MODIFIED_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(GenericTextEditor, onModifiedStateChanged)); Ogitors::EventManager::getSingletonPtr()->connectEvent(Ogitors::EventManager::LOAD_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(GenericTextEditor, onLoadStateChanged)); }