summaryrefslogtreecommitdiffstats
path: root/src/Mainpage.dox
blob: 2f055d1b522a96db98c9a119591d86f8dcf8880f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/**
@mainpage The KDevelop Generic Shell

This library contains the Shell - a profile-based implementation of TDevelop plugin architecture.

<b>Link with</b>: -lkdevshell

<b>Include path</b>: -I\$(kde_includes)/tdevelop/shell

\section creatingapp Creating an application using generic shell
KDevelop platform applications can use generic shell as a ready to use implementation
of TDevelop plugin architecture.

This is done by creating application %main.cpp file and @ref ShellExtension subclass.
Example:
- %main.cpp for "myapp" application:
    @code
    #include <config.h>
    
    #include <tdeaboutdata.h>
    #include <tdeapplication.h>
    #include <tdecmdlineargs.h>
    #include <tdelocale.h>
    #include <dcopclient.h>
    
    #include <splashscreen.h>
    #include <toplevel.h>
    #include <plugincontroller.h>
    #include <partcontroller.h>
    #include <core.h>
    #include <projectmanager.h>
    #include <newmainwindow.h>
    
    #include "myappextension.h"
    
    static TDECmdLineOptions options[] =
    {
        { "profile <profile>",	I18N_NOOP("Profile to load"), 0 },
        { 0,0,0 }
    };
    
    int main(int argc, char *argv[])
    {
        static const char description[] = I18N_NOOP("My Application");
        TDEAboutData aboutData("myapp", I18N_NOOP("My Application"),
                        VERSION, description, TDEAboutData::License_GPL,
                        I18N_NOOP("(c) 1999-2004, MyApp developers"),
                        "", "http://www.myapp.org");
        aboutData.addAuthor("Me", I18N_NOOP("Creator"), "me@myapp.org");
    
        TDECmdLineArgs::init(argc, argv, &aboutData);
        TDECmdLineArgs::addCmdLineOptions( options );
    
        TDEApplication app;

        MyAppExtension::init();
    
        QPixmap pm;
        pm.load(locate("data", "myapp/pics/myapp-splash.png"));
        SplashScreen * splash = new SplashScreen( pm );
        splash->show();
    
        app.processEvents();
    
        QObject::connect(PluginController::getInstance(), SIGNAL(loadingPlugin(const QString &)),
            splash, SLOT(showMessage(const QString &)));
    
        splash->message( i18n( "Loading Settings" ) );
        TopLevel::getInstance()->loadSettings();
    
        PluginController::getInstance()->loadInitialPlugins();
    
        splash->message( i18n( "Starting GUI" ) );
        NewMainWindow *mw = dynamic_cast<NewMainWindow*>(TopLevel::getInstance()->main());
        if (mw)
            mw->enableShow();
        TopLevel::getInstance()->main()->show();
    
        Core::getInstance()->doEmitCoreInitialized();
    
        delete splash;
    
        kapp->dcopClient()->registerAs("myapp");
    
        return app.exec();
    }
    @endcode
    
- Shell extension for "myapp" application:
    @code
    class MyAppExtension: public ShellExtension {
    public:
        static void init()
        {
            s_instance = new MyAppExtension();
        }

        virtual void createGlobalSettingsPage(KDialogBase */*dlg*/) {};
        virtual void acceptGlobalSettingsPage(KDialogBase */*dlg*/) {};
    
        virtual QString xmlFile()
        {
            return "myappui.rc";
        }
        
        virtual QString defaultProfile()
        {
            return "MyApp";
        }
            
    protected:
        KDevAssistantExtension();
    
    };
    @endcode

*/