49 #include <KCmdLineArgs>
50 #include <KApplication>
52 #include <QtCore/QList>
61 #define CmdLineOptionName(STRING) QByteArray::fromRawData( STRING, sizeof(STRING)-1 )
64 : mDocumentManager( new DocumentManager() ),
65 mViewManager( new ViewManager() ),
66 mDocumentStrategy( new MultiDocumentStrategy(mDocumentManager, mViewManager) ),
67 mDialogHandler( new DialogHandler() )
69 KCmdLineOptions programOptions;
74 KCmdLineArgs::init( argc, argv, &mAboutData );
75 KCmdLineArgs::addCmdLineOptions( programOptions );
79 int OktetaProgram::execute()
81 KApplication programCore;
84 mByteArrayViewProfileManager =
new ByteArrayViewProfileManager();
88 ByteArrayStreamEncoderFactory::createStreamEncoders();
91 ByteArrayDataGeneratorFactory::createDataGenerators();
94 ByteArrayStreamEncoderConfigEditorFactoryFactory::createFactorys();
97 ByteArrayDataGeneratorConfigEditorFactoryFactory::createFactorys();
99 mDocumentManager->codecManager()->setEncoders( encoderList );
100 mDocumentManager->codecManager()->setGenerators( generatorList );
101 mDocumentManager->codecManager()->setOverwriteDialog( mDialogHandler );
102 mDocumentManager->createManager()->setDocumentFactory(
new ByteArrayDocumentFactory() );
103 mDocumentManager->syncManager()->setDocumentSynchronizerFactory(
new ByteArrayRawFileSynchronizerFactory() );
104 mDocumentManager->syncManager()->setOverwriteDialog( mDialogHandler );
105 mDocumentManager->syncManager()->setSaveDiscardDialog( mDialogHandler );
107 mViewManager->setViewFactory(
new ByteArrayViewFactory(mByteArrayViewProfileManager) );
108 mViewManager->codecViewManager()->setEncoderConfigEditorFactories( encoderConfigEditorFactoryList );
109 mViewManager->codecViewManager()->setGeneratorConfigEditorFactories( generatorConfigEditorFactoryList );
111 OktetaMainWindow* mainWindow =
new OktetaMainWindow(
this );
112 mDialogHandler->setWidget( mainWindow );
115 if( programCore.isSessionRestored() && KMainWindow::canBeRestored(1) )
117 mainWindow->restore( 1 );
122 KCmdLineArgs* arguments = KCmdLineArgs::parsedArgs();
125 if( arguments->count() > 0 )
127 for(
int i=0; i<arguments->count(); ++i )
128 mDocumentStrategy->load( arguments->url(i) );
136 return programCore.exec();
140 void OktetaProgram::quit()
146 OktetaProgram::~OktetaProgram()
148 delete mDocumentStrategy;
149 delete mDocumentManager;
151 delete mDialogHandler;
152 delete mByteArrayViewProfileManager;
#define CmdLineOptionName(STRING)
OktetaProgram(int argc, char *argv[])