Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 990b3776 authored by saubatn's avatar saubatn
Browse files

FIXED : Back Action::ApplyStatus::ERROR (was FAILED).

DELETED : DocumentWindow class has been removed.
NEW : File extension association now uses Qt (with QSettings).
NEW : ExtensionManager has a new static method : registerFileExtension(QString).
TODO : call registerFileExtension at the loading of componentextension depending on previous file association (prompt to the user).

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@536 ec899d31-69d1-42ba-9299-647d76f65fb3
parent af78a2ee
......@@ -94,7 +94,7 @@ Action::ApplyStatus OpenAction::apply() {
}
else {
Application::showStatusBarMessage(tr ("Error loading files: ") + (*fileIterator));
return FAILED;
return ERROR;
}
}
else {
......
......@@ -65,5 +65,5 @@ Action::ApplyStatus RemoveLastInstanciatedAction::apply() {
Application::refresh();
return SUCCESS;
}
return FAILED;
return ERROR;
}
......@@ -71,5 +71,5 @@ Action::ApplyStatus SaveAction::apply() {
while (it != allTopLevel.constEnd() && Application::save(*it))
++it;
return (it == allTopLevel.constEnd())? SUCCESS : FAILED;
return (it == allTopLevel.constEnd())? SUCCESS : ERROR;
}
......@@ -68,9 +68,9 @@ Action::ApplyStatus SaveAllAction::apply() {
while (it != Application::getTopLevelComponents().constEnd() && Application::save(*it))
++it;
return (it == Application::getTopLevelComponents().constEnd()) ? SUCCESS : FAILED;
return (it == Application::getTopLevelComponents().constEnd()) ? SUCCESS : ERROR;
Application::showStatusBarMessage( tr ( "Ready." ) );
return FAILED;
return ERROR;
}
......@@ -182,7 +182,7 @@ Action::ApplyStatus SaveAsAction::apply() {
}
else {
comp->setFileName(compfileName);
return FAILED;
return ERROR;
}
}
else {
......@@ -191,6 +191,6 @@ Action::ApplyStatus SaveAsAction::apply() {
}
return FAILED;
return ERROR;
}
......@@ -71,6 +71,6 @@ Action::ApplyStatus SelectLastInstanciatedAction::apply() {
Application::refresh();
return SUCCESS;
}
return FAILED;
return ERROR;
}
......@@ -95,7 +95,7 @@ Action::ApplyStatus CenterMesh::apply() {
}
else {
CAMITK_INFO("CenterMesh", "apply transformation", "Error: filter output is of type: " << filter->GetOutputDataObject(0)->GetClassName());
return FAILED;
return ERROR;
}
Application::setProgressBarValue(100.0*(i+1.0)/((double)getTargets().size()));
......
......@@ -200,7 +200,7 @@ Action::ApplyStatus RigidTransform::apply() {
}
else {
CAMITK_INFO("RigidTransform", "applyTransform", "Error: filter output is of type: " << filterList[i]->GetOutputDataObject(0)->GetClassName());
return FAILED;
return ERROR;
}
// next filter
i++;
......
This diff is collapsed.
......@@ -67,7 +67,7 @@ int main(int argc, char *argv[]) {
// parse command line
CommandLineParser clp(argc, argv);
clp.setDescription(description);
clp.addOption("noConsole", "Disable CamiTK application console and redirect everything to\n the standard output (default=off)");
clp.addOption("noConsole", "Disable CamiTK application console and redirect everything to\n the standard output (default=off)");
clp.addOption("printPath", "Print CamiTK path on the standard output and exit\n");
clp.addOption("config", "Print all information for a complete CamiTK diagnosis and exit\n");
clp.parse();
......
......@@ -192,7 +192,7 @@ void ExtensionWindow::okClicked() {
Extension::name_type name(ui.extensionNameLineEdit->text().toStdString());
Extension::description_type description(ui.extensionDescriptionPlainTextEdit->toPlainText().toStdString());
Extension::extensionClass_type extensionClass(ui.extensionClassNameLineEdit->text().toStdString());
coreschema::Extension ext(name, description, extensionClass);
Extension ext(name, description, extensionClass);
Components::componentExtension_sequence fileExtSeq;
Actions myActions;
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef CAMITKCORE_H
#define CAMITKCORE_H
// The following content describes the index.html page of the API documentation.
// It uses CMake variable (surrounded by the '@' pattern), replaced by their content using the CONFIGURE_FILE CMake command
// This file is configured in camitk/cmake/modules/CamiTKApiDoc.cmake into the CamiTKVersion.h file.
/** @mainpage CamiTK API Documentation
*
* @section introduction Introduction
* Welcome to the Computer Assisted Medical Intervention Tool kit (CamiTK) API Documentation.
* CamiTK is an open-source framework that helps researchers and clinicians to easily and rapidly collaborate in order to prototype CAMI applications, that feature medical images, surgical navigation and biomechanical simulations. CamiTK uses famous tools such as Qt, ITK and VTK.
* This API documentation would introduce you to the architecture of the framework
*
* @section architecture Core Architecture
* CamiTK follows the Components Based Software Engineering (CBSE) principles. Each new functionality to the framework is a new module represented as a dynamic library (.dll on windows, .so on Linux systems). These principles guarantee CamiTK to be higly modular and easier to maintain.
* CamiTK is provided with its core and basic modules (to handle 2D and 3D images using VTK for instance). You can easily add new modules to the framework or create new camitk-application.
*
* @subsection design-pattern Design Pattern
* CamiTK core architecture follows the Model-View-Presenter (MVP) design-pattern. It helps dividing the logic in two parts : domain logic (data structures and algorithms) and application logic (the Model, GUI aspects to present and interact with the domain logic).
*
* \image html camitk_service_layer_1.png "The service layer" width=10cm
*
* To do so, 'viewers' (application logic modules) are used to present and interact with the domain logic : the 'components' (the data logic, the data structures) and the 'actions' (the processing logic, the algorithms to be used on these components).
* In order to easily glue together all this modules CamiTK uses a Service Layer Pattern. This service layer can be seen as a contract from the viewers consumers of services provided by the 'components' and 'actions'. The viewers interact with the components without knowing exactly which kind of data it represents.
*
* @subsection components Components
*
* \image html camitk_service_layer_2.png "The four interfaces implemented by the Component class" width=10cm
*
* CamiTK components describe data structure and therefore are used to represent the data logic. The @ref camitk::Component "Component" class implements four interfaces, which gather the different possibilities of a component in order to provide the service layer. See the @ref camitk::Component "Component" class to have more details.
*
* @subsection actions Actions
* The @ref camitk::Action "Action" class generalizes the notion of component processing. An action applies a given algorithm to one or several listed components.
* Generally viewers trigger actions on the currently selected components.
*
* @subsection viewers Viewers
* The @ref camitk::Viewer "Viewer" class handles all the presentation and interaction logic (the View and Presenter part of the MVP). The CamiTK viewers are using either Qt widget or VTK renderer but are not limited to that. Viewers manage the user interactions and map them into calls to the interface methods of the components.
*
* @section getting-started Getting started
*
* @subsection how-to-extend-camitk How to add a new action or component ?
* To add a new action or component to CamiTK, you will need to create a new dynamic link library that extends the framework with your desired data structure and / or algorithms. You may want to use the CamiTK wizard to automatically generate a code skeleton for your extension. Please check the wiki documentation about <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Create_your_own_custom_action_for_CamiTK">adding a new component / action</a>.
*
* @subsection how-to-create-new-application How to create a new application ?
* You may inherites the @ref camitk::MainWindow "MainWindow" class. The MainWindow class is a kind of super presenter : it instanciates and organizes all the viewers in an application GUI. Check the wiki tutorial : <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Create_your_own_application_for_CamiTK">create a new applicaiton</a>.
*
* @subsection tutorials Tutorials
* Many tutorials are proposed in the <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Main_Page">CamiTK wiki</a> (you may want to edit it and share your knowledge).
*
* @section HomePage Home Page
* The home page of the project can be found at : <a href="http://camitk.imag.fr">camitk.imag.fr</a>
*
* @section copyright (c) UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525
*/
// Here are the related pages of the documention
/**
* @page home-page CamiTK website
* The home page of the project can be found at : <a href="http://camitk.imag.fr">camitk.imag.fr</a>
*
* @page wiki CamiTK wiki
* Installation instructions, many tips and tutorials are proposed in the <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Main_Page">CamiTK wiki</a> (you may want to edit it and share your knowledge).
*
*
**/
// -- Core stuff
#include "CamiTKAPI.h"
#include "HistoryItem.h"
// -- Qt stuff
#include <QStack>
namespace camitk {
/**
* Core class specifies the basic static information for the CamiTK API.
*/
class CAMITK_API Core {
public:
/// @name runtime directory information
///@{
/// get the camitk component extension directory name
/// @return a null QString, checkable with isNull(), if no component dir found
static const QString getComponentDir();
/// get the camitk action directory name
/// @return a null QString, checkable with isNull(), if no action dir found
static const QString getActionDir();
/// get the camitk module extension directory name
/// @param subpath name of the module type (and subdirectory) to get (this simplifies getting the subdir name on plateform with hasBuildTypeDirectory()
/// @return a null QString, checkable with isNull(), if no module dir found
static const QString getModuleDir(const QString & subpath = QString());
/// get the camitk test data directory name
/// @return a null QString, checkable with isNull(), if no test data directory found
static const QString getTestDataDir();
/// get the camitk core lib directory name (where the camitkcore dll/shared/dynamic lib is)
static const QString getCoreLibDir();
/// get more information about installation, etc...
static const QString getConfig();
///@}
/// @name miscallaneous utility method or variables
///@{
/// complete version string
static const char *version;
/// short version string (all in lower case, without the patch number)
static const char *shortVersion;
/// fall-back install directory (if the autodetection did not work...)
static const char *installDir;
/// version used for so name
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef CAMITKCORE_H
#define CAMITKCORE_H
// The following content describes the index.html page of the API documentation.
// It uses CMake variable (surrounded by the '@' pattern), replaced by their content using the CONFIGURE_FILE CMake command
// This file is configured in camitk/cmake/modules/CamiTKApiDoc.cmake into the CamiTKVersion.h file.
/** @mainpage CamiTK API Documentation
*
* @section introduction Introduction
* Welcome to the Computer Assisted Medical Intervention Tool kit (CamiTK) API Documentation.
* CamiTK is an open-source framework that helps researchers and clinicians to easily and rapidly collaborate in order to prototype CAMI applications, that feature medical images, surgical navigation and biomechanical simulations. CamiTK uses famous tools such as Qt, ITK and VTK.
* This API documentation would introduce you to the architecture of the framework
*
* @section architecture Core Architecture
* CamiTK follows the Components Based Software Engineering (CBSE) principles. Each new functionality to the framework is a new module represented as a dynamic library (.dll on windows, .so on Linux systems). These principles guarantee CamiTK to be higly modular and easier to maintain.
* CamiTK is provided with its core and basic modules (to handle 2D and 3D images using VTK for instance). You can easily add new modules to the framework or create new camitk-application.
*
* @subsection design-pattern Design Pattern
* CamiTK core architecture follows the Model-View-Presenter (MVP) design-pattern. It helps dividing the logic in two parts : domain logic (data structures and algorithms) and application logic (the Model, GUI aspects to present and interact with the domain logic).
*
* \image html camitk_service_layer_1.png "The service layer" width=10cm
*
* To do so, 'viewers' (application logic modules) are used to present and interact with the domain logic : the 'components' (the data logic, the data structures) and the 'actions' (the processing logic, the algorithms to be used on these components).
* In order to easily glue together all this modules CamiTK uses a Service Layer Pattern. This service layer can be seen as a contract from the viewers consumers of services provided by the 'components' and 'actions'. The viewers interact with the components without knowing exactly which kind of data it represents.
*
* @subsection components Components
*
* \image html camitk_service_layer_2.png "The four interfaces implemented by the Component class" width=10cm
*
* CamiTK components describe data structure and therefore are used to represent the data logic. The @ref camitk::Component "Component" class implements four interfaces, which gather the different possibilities of a component in order to provide the service layer. See the @ref camitk::Component "Component" class to have more details.
*
* @subsection actions Actions
* The @ref camitk::Action "Action" class generalizes the notion of component processing. An action applies a given algorithm to one or several listed components.
* Generally viewers trigger actions on the currently selected components.
*
* @subsection viewers Viewers
* The @ref camitk::Viewer "Viewer" class handles all the presentation and interaction logic (the View and Presenter part of the MVP). The CamiTK viewers are using either Qt widget or VTK renderer but are not limited to that. Viewers manage the user interactions and map them into calls to the interface methods of the components.
*
* @section getting-started Getting started
*
* @subsection how-to-extend-camitk How to add a new action or component ?
* To add a new action or component to CamiTK, you will need to create a new dynamic link library that extends the framework with your desired data structure and / or algorithms. You may want to use the CamiTK wizard to automatically generate a code skeleton for your extension. Please check the wiki documentation about <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Create_your_own_custom_action_for_CamiTK">adding a new component / action</a>.
*
* @subsection how-to-create-new-application How to create a new application ?
* You may inherites the @ref camitk::MainWindow "MainWindow" class. The MainWindow class is a kind of super presenter : it instanciates and organizes all the viewers in an application GUI. Check the wiki tutorial : <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Create_your_own_application_for_CamiTK">create a new applicaiton</a>.
*
* @subsection tutorials Tutorials
* Many tutorials are proposed in the <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Main_Page">CamiTK wiki</a> (you may want to edit it and share your knowledge).
*
* @section HomePage Home Page
* The home page of the project can be found at : <a href="http://camitk.imag.fr">camitk.imag.fr</a>
*
* @section copyright (c) UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525
*/
// Here are the related pages of the documention
/**
* @page home-page CamiTK website
* The home page of the project can be found at : <a href="http://camitk.imag.fr">camitk.imag.fr</a>
*
* @page wiki CamiTK wiki
* Installation instructions, many tips and tutorials are proposed in the <a href="https://forge.imag.fr/plugins/mediawiki/wiki/camitk/index.php/Main_Page">CamiTK wiki</a> (you may want to edit it and share your knowledge).
*
*
**/
// -- Core stuff
#include "CamiTKAPI.h"
#include "HistoryItem.h"
// -- Qt stuff
#include <QStack>
namespace camitk {
/**
* Core class specifies the basic static information for the CamiTK API.
*/
class CAMITK_API Core {
public:
/// @name runtime directory information
///@{
/// get the camitk component extension directory name
/// @return a null QString, checkable with isNull(), if no component dir found
static const QString getComponentDir();
/// get the camitk action directory name
/// @return a null QString, checkable with isNull(), if no action dir found
static const QString getActionDir();
/// get the camitk module extension directory name
/// @param subpath name of the module type (and subdirectory) to get (this simplifies getting the subdir name on plateform with hasBuildTypeDirectory()
/// @return a null QString, checkable with isNull(), if no module dir found
static const QString getModuleDir(const QString & subpath = QString());
/// get the camitk test data directory name
/// @return a null QString, checkable with isNull(), if no test data directory found
static const QString getTestDataDir();
/// get the camitk core lib directory name (where the camitkcore dll/shared/dynamic lib is)
static const QString getCoreLibDir();
/// get more information about installation, etc...
static const QString getConfig();
///@}
/// @name miscallaneous utility method or variables
///@{
/// complete version string
static const char *version;
/// short version string (all in lower case, without the patch number)
static const char *shortVersion;
/// fall-back install directory (if the autodetection did not work...)
static const char *installDir;
/// version used for so name
static const char *soVersion;
///@}
private:
/// check if plateform has debug/release subdirs
/// @return null string if not debug/release plateform or build type if debug/release plateform
static const QString hasBuildTypeDirectory();
/// check if on MacOS (TODO test this!)
static const bool hasMacOSDirectory();
/// check if installed
static const bool isInstalled();
/// get the camitk root directory name (it is either the build dir or the installation directory)
/// @return a null QString, checkable with isNull(), if no installation dir found
static const QString getRootDir();
/// @return true only if the camitk core lib is in the given directory
static bool checkCoreLibDir(QString dir);
/// name of main directory where the shared lib (dll, so or dylib) can be found
/// It is "bin" on windows, "lib" on unix (unless isInstalled() is true, then it is still in bin)
static const QString sharedDirectory();
/// does this plateform puts all dll/so/dylib in a CamiTK::shortVersion directory
static const bool hasBinaryVersionSubdir();
/// return the name of the bin directory
static const QString getBinDirName();
/// name of the bin directory (can be "bin" or "binDebug" for installed debug version!)
static QString binDirName;
};
}
#endif // CAMITKCORE_H
///@}
private:
/// check if plateform has debug/release subdirs
/// @return null string if not debug/release plateform or build type if debug/release plateform
static const QString hasBuildTypeDirectory();
/// check if on MacOS (TODO test this!)
static const bool hasMacOSDirectory();
/// check if installed
static const bool isInstalled();
/// get the camitk root directory name (it is either the build dir or the installation directory)
/// @return a null QString, checkable with isNull(), if no installation dir found
static const QString getRootDir();
/// @return true only if the camitk core lib is in the given directory
static bool checkCoreLibDir(QString dir);
/// name of main directory where the shared lib (dll, so or dylib) can be found
/// It is "bin" on windows, "lib" on unix (unless isInstalled() is true, then it is still in bin)
static const QString sharedDirectory();
/// does this plateform puts all dll/so/dylib in a CamiTK::shortVersion directory
static const bool hasBinaryVersionSubdir();
/// return the name of the bin directory
static const QString getBinDirName();
/// name of the bin directory (can be "bin" or "binDebug" for installed debug version!)
static QString binDirName;
};
}
#endif // CAMITKCORE_H
This diff is collapsed.
......@@ -92,6 +92,11 @@ public:
/// get the list of all the name of the registered Component data directory
static QStringList getDataDirectoryExtNames();
/** Register the file extension with the current application for opening
** This function is called at launch time for registering file extension of component extensions
* @param fileExtension the file extension to associate with the current application for opening
**/
static void registerFileExtension(QString fileExtension);
///@}
......@@ -145,6 +150,8 @@ private:
* see http://www.parashift.com/c++-faq/ctors.html
*/
static QMap<QString, ActionExtension*> & getActionExtensionMap();
};
}
......
......@@ -203,7 +203,7 @@ Action::ApplyStatus Action::trigger ( QWidget * parent )
else
{
QMessageBox::information ( parent, "Cannot apply this Action to selection", "Sorry, but the action \"" + getName() + "\" cannot be applied on the currently selected component(s)" );
return FAILED;
return ERROR;
}
}
......
......@@ -176,7 +176,7 @@ public:
/// \enum ApplyStatus describes what happened during the application of an algorithm (i.e. results of the apply method)
enum ApplyStatus {
SUCCESS, ///< everything went according to plan
FAILED, ///< apply() failed : an error occured (usually it means that the apply() was interrupted)
ERROR, ///< apply() failed : an error occured (usually it means that the apply() was interrupted)
WARNING, ///< some (partial) error occured during the application of the algorithm
ABORTED, ///< the action was aborted before completion
TRIGGERED ///< the action was triggered only, but not applied
......
......@@ -56,6 +56,8 @@ QString Application::name=Core::version;
// ----------------- constructor --------------------
Application::Application(QString name, int & theArgc, char ** theArgv, bool autoloadExtensions): QApplication(theArgc, theArgv) {
this->name = name;
QApplication::setApplicationName(name); // associate the QProperty to the Qt meta-object
argc = theArgc;
argv = theArgv;
mainWindow = NULL;
......
// -------------------------------------------------------------------------------------------------
/**
* @file
* @brief
* @author Gerolf Reinwardt
* @date 30.01.2011
*
* Copyright (c) 2011, Gerolf Reinwardt. All rights reserved.
*
* Simplified BSD License
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of Gerolf Reinwardt.
*/
// -------------------------------------------------------------------------------------------------
#ifdef WIN32 // Do not compile this file if not on Windows
// ----- general includes --------------------------------------------------------------------------
#include <windows.h>
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QRegExp>
#include <QString>
// ----- local includes ----------------------------------------------------------------------------
#include "DocumentWindow.h"
#include <iostream>
// ----- construction ------------------------------------------------------------------------------
DocumentWindow::DocumentWindow(QWidget* parent, Qt::WindowFlags flags) :
QMainWindow(parent, flags),
m_registerForDDE(false),
m_appAtomName(),
m_systemTopicAtomName("system"),
m_appAtom(0),
m_systemTopicAtom(0)
{
QFileInfo fi(qApp->applicationFilePath());
m_appAtomName = fi.baseName();
}
DocumentWindow::~DocumentWindow()
{
if(0 != m_appAtom)
{
::GlobalDeleteAtom(m_appAtom);
m_appAtom = 0;
}
if(0 != m_systemTopicAtom)
{
::GlobalDeleteAtom(m_systemTopicAtom);
m_systemTopicAtom = 0;
}
}
// ----- operators ---------------------------------------------------------------------------------
// ----- methods -----------------------------------------------------------------------------------
// ----- accessors ---------------------------------------------------------------------------------
// ----- public slots ------------------------------------------------------------------------------
// ----- protected slots ---------------------------------------------------------------------------
// ----- events ------------------------------------------------------------------------------------
bool DocumentWindow::winEvent(MSG *message, long *result)
{
switch(message->message)
{
case WM_DDE_INITIATE:
return ddeInitiate(message, result);
break;
case WM_DDE_EXECUTE:
return ddeExecute(message, result);
break;
case WM_DDE_TERMINATE:
return ddeTerminate(message, result);
break;
}