ICF 3.1.1.10
Technical documentation of ICF Libraries
CSingletonDocApplicationComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QSharedMemory>
11#include <QtCore/QObject>
12#include <QtCore/QTimer>
13#include <QtCore/QString>
14#include <QtCore/QStringList>
15
16// ICF includes
23
24
25namespace idocgui
26{
27
28
34 public QObject,
36 protected imod::TSingleModelObserverBase<ibase::IRuntimeStatusProvider>,
37 virtual public ibase::IApplication
38{
39 Q_OBJECT
40public:
43
44 I_BEGIN_COMPONENT(CSingletonDocApplicationComp);
45 I_REGISTER_INTERFACE(ibase::IApplication);
46 I_ASSIGN(m_applicationInfoCompPtr, "ApplicationInfo", "Application info used to identify the application in the system", false, "ApplicationInfo");
47 I_ASSIGN(m_slaveApplicationCompPtr, "Application", "Application component to be executed", true, "Application");
48 I_ASSIGN_TO(m_slaveGuiApplicationCompPtr, m_slaveApplicationCompPtr, false);
49 I_ASSIGN(m_documentManagerCompPtr, "DocumentManager", "Document manager used for opening of documents triggered by the shell", false, "DocumentManager");
50 I_ASSIGN(m_runtimeStatusProviderCompPtr, "RuntimeStatus", "Runtime status of the application", false, "RuntimeStatus");
51 I_ASSIGN_TO(m_runtimeStatusProviderModelCompPtr, m_runtimeStatusProviderCompPtr, false);
52 I_END_COMPONENT;
53
55
56 // reimplemented (ibase::IApplication)
57 bool InitializeApplication(int argc, char** argv) override;
58 int Execute(int argc, char** argv) override;
59 QString GetHelpText() const override;
60 QStringList GetApplicationArguments() const override;
61
62protected:
63 // reimplemented (imod::CSingleModelObserverBase)
64 void OnUpdate(const istd::IChangeable::ChangeSet& changeSet) override;
65
66 // reimplemented (icomp::CComponentBase)
67 void OnComponentCreated() override;
68 void OnComponentDestroyed() override;
69
70private:
71 void ShareDocumentsForOpening(int argc, char** argv);
72 QStringList PopDocumentsForOpening() const;
73
74private Q_SLOTS:
75 void OnUpdateDocumentList();
76
77private:
78 enum{
82 MAX_DOCUMENT_PATH_LENGTH = 1024,
86 MAX_DOCUMENTS_COUNT = 100
87 };
88
92 struct RunningProcessInfo
93 {
94 qint64 processId;
95 char requestedDocuments[MAX_DOCUMENTS_COUNT][MAX_DOCUMENT_PATH_LENGTH];
96 };
97
98 I_REF(ibase::IApplicationInfo, m_applicationInfoCompPtr);
99 I_REF(ibase::IApplication, m_slaveApplicationCompPtr);
100 I_REF(istdgui::IGuiApplication, m_slaveGuiApplicationCompPtr);
101
102 std::unique_ptr<QSharedMemory> m_processDataPtr;
103 bool m_isAlreadyRunning;
104 QTimer m_documentUpdateTimer;
105
106 bool m_isApplicationInitialized;
107
108 I_REF(idoc::IDocumentManager, m_documentManagerCompPtr);
109 I_REF(ibase::IRuntimeStatusProvider, m_runtimeStatusProviderCompPtr);
110 I_REF(imod::IModel, m_runtimeStatusProviderModelCompPtr);
111};
112
113
114} // namespace idocgui
115
116
Interface for the main entry point of a component-based application.
This interface provides some information about the application.
Provider of the run-time status.
Base class for component implementation.
Provide set of user actions needed to manage documents in MVC (Model View Controller) concept.
bool InitializeApplication(int argc, char **argv) override
Initialize the application object.
QString GetHelpText() const override
Get information about the possible command line arguments of this application.
QStringList GetApplicationArguments() const override
Get the command line arguments of this application.
imod::TSingleModelObserverBase< ibase::IRuntimeStatusProvider > BaseClass2
int Execute(int argc, char **argv) override
Start execution loop of the application.
void OnUpdate(const istd::IChangeable::ChangeSet &changeSet) override
Called on update of observed model.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
Basic implementation for a single model observer with binding to concrete data object interface.
Set of change flags (its IDs).
Definition IChangeable.h:38
Interface for Qt based application with GUI.
This package contains Qt implementations related to Document/View concept.

© Witold Gantzke and Kirill Lepskiy