All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Slots | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions
QGpGuiTools::MultiDocumentEnvironment Class Reference

Brief description of class still missing. More...

#include <MultiDocumentEnvironment.h>

Inheritance diagram for QGpGuiTools::MultiDocumentEnvironment:
MainEnvironment

List of all members.

Public Slots

virtual MultiDocumentWindowaddWindow ()
virtual void copy ()
virtual void cut ()
virtual void helpAbout ()
virtual void helpDocumentation ()
virtual void newDocument ()
virtual void openDocument ()
virtual void paste ()
virtual void printDocument ()
virtual bool quit ()
virtual void redo ()
virtual void saveDocument ()
virtual void saveDocumentAs ()
virtual void undo ()

Public Member Functions

void addEditActions (QMenu *m, QToolBar *tb)
void addFileActions (QMenu *m, QToolBar *tb)
void addHelpActions (QMenu *m)
void addViewActions (QMenu *m, QToolBar *tb)
void addWindowsActions (QMenu *m)
MultiDocumentWindowcurrentWindow () const
 MultiDocumentEnvironment (QObject *parent=0)
const QList
< MultiDocumentWindow * > & 
windows () const
 ~MultiDocumentEnvironment ()

Static Public Member Functions

static MultiDocumentEnvironmentinstance ()

Public Attributes

QAction * _editCopyAction
QAction * _editCutAction
QAction * _editPasteAction
QAction * _editRedoAction
QAction * _editUndoAction
QAction * _fileNewAction
QAction * _fileOpenAction
QAction * _filePrintAction
QAction * _fileQuitAction
QAction * _fileSaveAction
QAction * _fileSaveAsAction
QAction * _helpAboutAction
QAction * _helpAboutQtAction
QAction * _helpDocumentationAction
QAction * _helpWhatsThisAction
QAction * _windowsNewWindowAction

Protected Slots

virtual void askForClose (bool &ok)

Protected Member Functions

void createEditActions ()
void createFileActions ()
void createHelpActions ()
void createViewActions ()
virtual MultiDocumentWindowcreateWindow ()
void createWindowsActions ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References TRACE.

    : QObject(parent)
{
  TRACE;
  ASSERT(!_instance);

  _instance=this;
}

Description of destructor still missing

References TRACE.

{
  TRACE;
  qDeleteAll(_windows);
}

Member Function Documentation

void QGpGuiTools::MultiDocumentEnvironment::addEditActions ( QMenu *  m,
QToolBar *  tb 
)

References _editCopyAction, _editCutAction, _editPasteAction, _editRedoAction, _editUndoAction, and TRACE.

Referenced by QGpGuiTools::MultiDocumentWindow::addEditActions().

{
  TRACE;
  if(m) {
    m->addAction(_editUndoAction);
    m->addAction(_editRedoAction);
    m->addSeparator();
    m->addAction(_editCutAction);
    m->addAction(_editCopyAction);
    m->addAction(_editPasteAction);
    m->addSeparator();
  }
  if(tb) {
    tb->addAction(_editUndoAction);
    tb->addAction(_editRedoAction);
    tb->addSeparator();
    tb->addAction(_editCutAction);
    tb->addAction(_editCopyAction);
    tb->addAction(_editPasteAction);
    tb->addSeparator();
  }
}
void QGpGuiTools::MultiDocumentEnvironment::addFileActions ( QMenu *  m,
QToolBar *  tb 
)

References _fileNewAction, _fileOpenAction, _filePrintAction, _fileQuitAction, _fileSaveAction, _fileSaveAsAction, and TRACE.

Referenced by QGpGuiTools::MultiDocumentWindow::addFileActions().

{
  TRACE;
  if(m) {
    m->addAction(_fileNewAction);
    m->addAction(_fileOpenAction);
    m->addAction(_fileSaveAction);
    m->addAction(_fileSaveAsAction);
    m->addSeparator();
    m->addAction(_filePrintAction);
    m->addSeparator();
    m->addAction(_fileQuitAction);
  }
  if(tb) {
    tb->addAction(_fileNewAction);
    tb->addAction(_fileOpenAction);
    tb->addAction(_fileSaveAction);
    tb->addSeparator();
    tb->addAction(_filePrintAction);
  }
}
void QGpGuiTools::MultiDocumentEnvironment::addViewActions ( QMenu *  m,
QToolBar *  tb 
)

References TRACE.

Referenced by QGpGuiTools::MultiDocumentWindow::addViewActions().

{
  TRACE;
  if(m) {
  }
  if(tb) {
  }
}

References askForClose(), createWindow(), TRACE, and w.

Referenced by createWindowsActions(), and main().

{
  TRACE;
  MultiDocumentWindow * w=createWindow();
  connect(w, SIGNAL(destroyed(QObject *)), this, SLOT(removeWindow(QObject *)));
  connect(w, SIGNAL(clearCloseMarks()), this, SLOT(clearCloseMarks()));
  connect(w, SIGNAL(askForClose(bool&)), this, SLOT(askForClose(bool&)));
  _windows.append(w);
  w->show();
  return w;
}
virtual void QGpGuiTools::MultiDocumentEnvironment::askForClose ( bool &  ok) [inline, protected, virtual, slot]

Reimplemented in MainEnvironment.

Referenced by addWindow().

{ok=true;}

Referenced by createEditActions().

{
}

References _editCopyAction, _editCutAction, _editPasteAction, _editRedoAction, _editUndoAction, copy(), cut(), paste(), redo(), QGpCoreTools::tr(), TRACE, and undo().

Referenced by MainEnvironment::MainEnvironment().

{
  TRACE;
  QAction * a;

  a=new QAction(QIcon(":/images/editundo.png"), tr("&Undo"), this);
  a->setShortcut(tr("Ctrl+Z"));
  a->setToolTip(tr("Undo last operation"));
  connect(a, SIGNAL(triggered()), this, SLOT(undo()));
  _editUndoAction=a;

  a=new QAction(QIcon(":/images/editredo.png"), tr("Re&do"), this);
  a->setShortcut(tr("Ctrl+Shift+Z"));
  a->setToolTip(tr("Redo last operation"));
  connect(a, SIGNAL(triggered()), this, SLOT(redo()));
  _editRedoAction=a;

  a=new QAction(QIcon(":/images/editcut.png"), tr("Cu&t"), this);
  a->setShortcut(tr("Ctrl+X"));
  a->setToolTip(tr("Cut the current selection's contents to the clipboard"));
  connect(a, SIGNAL(triggered()), this, SLOT(cut()));
  _editCutAction=a;

  a=new QAction(QIcon(":/images/editcopy.png"), tr("&Copy"), this);
  a->setShortcut(tr("Ctrl+C"));
  a->setToolTip(tr("Copy the current selection's contents to the clipboard"));
  connect(a, SIGNAL(triggered()), this, SLOT(copy()));
  _editCopyAction=a;

  a=new QAction(QIcon(":/images/editpaste.png"), tr("&Paste"), this);
  a->setShortcut(tr("Ctrl+V"));
  a->setToolTip(tr("Paste the clipboard's contents in the sheet"));
  connect(a, SIGNAL(triggered()), this, SLOT(paste()));
  _editPasteAction=a;
}

References _fileNewAction, _fileOpenAction, _filePrintAction, _fileQuitAction, _fileSaveAction, _fileSaveAsAction, newDocument(), openDocument(), printDocument(), quit(), saveDocument(), saveDocumentAs(), QGpCoreTools::tr(), and TRACE.

Referenced by MainEnvironment::MainEnvironment().

{
  TRACE;
  QAction * a;

  a=new QAction(QIcon(":/images/filenew.png"), tr("New"), this);
  a->setToolTip(tr("Create a new document"));
  connect(a, SIGNAL(triggered()), this, SLOT(newDocument()));
  _fileNewAction=a;

  a=new QAction(QIcon(":/images/fileopen.png"), tr("Open"), this);
  a->setToolTip(tr("Open an existing document"));
  connect(a, SIGNAL(triggered()), this, SLOT(openDocument()));
  _fileOpenAction=a;

  a=new QAction(QIcon(":/images/filesave.png"), tr("Save"), this);
  a->setToolTip(tr("Save current document"));
  a->setShortcut(tr("Ctrl+S"));
  connect(a, SIGNAL(triggered()), this, SLOT(saveDocument()));
  _fileSaveAction=a;

  a=new QAction(tr("Save as ..."), this);
  a->setShortcut(tr("Ctrl+Shift+S"));
  a->setToolTip(tr("Save current document"));
  connect(a, SIGNAL(triggered()), this, SLOT(saveDocumentAs()));
  _fileSaveAsAction=a;

  a=new QAction(QIcon(":/images/fileprint.png"), tr("&Print"), this);
  a->setShortcut(tr("Ctrl+P"));
  a->setToolTip(tr("Print current document"));
  connect(a, SIGNAL(triggered()), this, SLOT(printDocument()));
  _filePrintAction=a;

  a=new QAction(tr("&Quit"), this);
  a->setShortcut(tr("Ctrl+Q"));
  a->setToolTip(tr("Quit application"));
  connect(a, SIGNAL(triggered()), this, SLOT(quit()));
  _fileQuitAction=a;
}

References _helpAboutAction, _helpAboutQtAction, _helpDocumentationAction, _helpWhatsThisAction, helpAbout(), helpDocumentation(), QGpCoreTools::tr(), and TRACE.

Referenced by MainEnvironment::MainEnvironment().

{
  TRACE;
  QAction * a;

  a=new QAction(tr("Online &Documentation"), this);
  a->setShortcut(tr("F1"));
  a->setToolTip(tr("Access to online html documentation"));
  connect(a, SIGNAL(triggered()), this, SLOT(helpDocumentation()));
  _helpDocumentationAction=a;

  a=QWhatsThis::createAction(this);
  _helpWhatsThisAction=a;

  a=new QAction(tr("&About"), this);
  a->setToolTip(tr("Shows application about box"));
  connect(a, SIGNAL(triggered()), this, SLOT(helpAbout()));
  _helpAboutAction=a;

  a=new QAction(tr("About &Qt"), this);
  a->setToolTip(tr("Shows the Qt library's About box"));
  connect(a, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
  _helpAboutQtAction=a;
}

Referenced by addWindow().

{
  return new MultiDocumentWindow;
}

References _windowsNewWindowAction, addWindow(), QGpCoreTools::tr(), and TRACE.

Referenced by MainEnvironment::MainEnvironment().

{
  TRACE;
  QAction * a;

  a=new QAction(tr("New &window"), this);
  a->setToolTip(tr("Create a new main window"));
  connect(a, SIGNAL(triggered()), this, SLOT(addWindow()));
  _windowsNewWindowAction=a;
}

Returns the current active window or the first one if none is active.

References TRACE.

Referenced by MainEnvironment::newDocument(), newDocument(), MainEnvironment::openDocument(), openDocument(), printDocument(), saveDocument(), and saveDocumentAs().

{
  TRACE;
  QWidget * aw=QApplication::activeWindow();
  foreach(MultiDocumentWindow * w, _windows) {
    if(w->isAncestorOf(aw)) {
      return w;
    }
  }
  // Make sure that at least one window exists.
  ASSERT(!_windows.isEmpty());
  return _windows.first();
}

Referenced by createEditActions().

{
}

Reimplemented in MainEnvironment.

References MSG_ID, QGpCoreTools::tr(), and TRACE.

Referenced by createHelpActions().

{
  TRACE;
  Message::information(MSG_ID, tr("About %1").arg(QApplication::applicationName()),
                       tr("Comments still missing"));
}

References TRACE.

Referenced by createHelpActions().

{
  TRACE;
  QUrl doc("http://www.geopsy.org/wiki/index.php");
  QDesktopServices::openUrl(doc);
}

Reimplemented in MainEnvironment.

References currentWindow(), QGpGuiTools::MultiDocumentWindow::newDocument(), TRACE, and w.

Referenced by createFileActions().

{
  TRACE;
  MultiDocumentWindow * w=currentWindow();
  w->newDocument();
}

Reimplemented in MainEnvironment.

References currentWindow(), QGpGuiTools::MultiDocumentWindow::openDocument(), TRACE, and w.

Referenced by createFileActions().

{
  TRACE;
  MultiDocumentWindow * w=currentWindow();
  w->openDocument();
}

Referenced by createEditActions().

{
}

References currentWindow(), QGpGuiTools::MultiDocumentWindow::printDocument(), TRACE, and w.

Referenced by createFileActions().

{
  TRACE;
  MultiDocumentWindow * w=currentWindow();
  w->printDocument();
}

Return true to accept quitting application

Reimplemented in MainEnvironment.

References TRACE.

Referenced by createFileActions().

{
  TRACE;
  QApplication::quit();
  return true;
}

Referenced by createEditActions().

{
}

References currentWindow(), QGpGuiTools::MultiDocumentWindow::saveDocument(), TRACE, and w.

Referenced by createFileActions().

{
  TRACE;
  MultiDocumentWindow * w=currentWindow();
  w->saveDocument();
}

References currentWindow(), QGpGuiTools::MultiDocumentWindow::saveDocumentAs(), TRACE, and w.

Referenced by createFileActions().

{
  TRACE;
  MultiDocumentWindow * w=currentWindow();
  w->saveDocumentAs();
}

Referenced by createEditActions().

{
}

Referenced by MainEnvironment::projects(), and MainEnvironment::quit().

{return _windows;}

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines