-/***************************************************************************
- bc.cpp - description
- -------------------
- begin : Sun May 27 22:13:58 CEST 2001
- copyright : (C) 2001 by Michael Andreen
- email : whale@linux.nu
- ***************************************************************************/
+#include "bs.h"
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+//Own includes
-#include "../config.h"
-
-#include <qaccel.h>
-#include "bc.h"
-#include "filesave.xpm"
-#include "fileopen.xpm"
-#include "filenew.xpm"
-
-BcApp::BcApp()
+#include "bsdoc.h"
+#include "bsview.h"
+/*
+ * Constructs a BSApp which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+BSApp::BSApp( QWidget* parent, const char* name, WFlags fl )
+ : BSAppBase( parent, name, fl )
{
- setCaption(tr("Bc " VERSION));
-
- ///////////////////////////////////////////////////////////////////
- // call inits to invoke all other construction parts
- initActions();
- initMenuBar();
- initToolBar();
- initStatusBar();
-
- initDoc();
- initView();
-
- viewToolBar->setOn(true);
- viewStatusBar->setOn(true);
+/* doc = new BSDoc();
+ view = new BSView(this,doc);
+ setCentralWidget(view);
+ */
}
-BcApp::~BcApp()
+/*
+ * Destroys the object and frees any allocated resources
+ */
+BSApp::~BSApp()
{
+ // no need to delete child widgets, Qt does it all for us
}
-/** initializes all QActions of the application */
-void BcApp::initActions(){
-
- QPixmap openIcon, saveIcon, newIcon;
- newIcon = QPixmap(filenew);
- openIcon = QPixmap(fileopen);
- saveIcon = QPixmap(filesave);
-
-
- fileNew = new QAction(tr("New File"), newIcon, tr("&New"), QAccel::stringToKey(tr("Ctrl+N")), this);
- fileNew->setStatusTip(tr("Creates a new document"));
- fileNew->setWhatsThis(tr("New File\n\nCreates a new document"));
- connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
-
- fileOpen = new QAction(tr("Open File"), openIcon, tr("&Open..."), 0, this);
- fileOpen->setStatusTip(tr("Opens an existing document"));
- fileOpen->setWhatsThis(tr("Open File\n\nOpens an existing document"));
- connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
-
- fileSave = new QAction(tr("Save File"), saveIcon, tr("&Save"), QAccel::stringToKey(tr("Ctrl+S")), this);
- fileSave->setStatusTip(tr("Saves the actual document"));
- fileSave->setWhatsThis(tr("Save File.\n\nSaves the actual document"));
- connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
-
- fileSaveAs = new QAction(tr("Save File As"), tr("Save &as..."), 0, this);
- fileSaveAs->setStatusTip(tr("Saves the actual document under a new filename"));
- fileSaveAs->setWhatsThis(tr("Save As\n\nSaves the actual document under a new filename"));
- connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSave()));
-
- fileClose = new QAction(tr("Close File"), tr("&Close"), QAccel::stringToKey(tr("Ctrl+W")), this);
- fileClose->setStatusTip(tr("Closes the actual document"));
- fileClose->setWhatsThis(tr("Close File\n\nCloses the actual document"));
- connect(fileClose, SIGNAL(activated()), this, SLOT(slotFileClose()));
-
- filePrint = new QAction(tr("Print File"), tr("&Print"), QAccel::stringToKey(tr("Ctrl+P")), this);
- filePrint->setStatusTip(tr("Prints out the actual document"));
- filePrint->setWhatsThis(tr("Print File\n\nPrints out the actual document"));
- connect(filePrint, SIGNAL(activated()), this, SLOT(slotFilePrint()));
-
- fileQuit = new QAction(tr("Exit"), tr("E&xit"), QAccel::stringToKey(tr("Ctrl+Q")), this);
- fileQuit->setStatusTip(tr("Quits the application"));
- fileQuit->setWhatsThis(tr("Exit\n\nQuits the application"));
- connect(fileQuit, SIGNAL(activated()), this, SLOT(slotFileQuit()));
-
- editCut = new QAction(tr("Cut"), tr("Cu&t"), QAccel::stringToKey(tr("Ctrl+X")), this);
- editCut->setStatusTip(tr("Cuts the selected section and puts it to the clipboard"));
- editCut->setWhatsThis(tr("Cut\n\nCuts the selected section and puts it to the clipboard"));
- connect(editCut, SIGNAL(activated()), this, SLOT(slotEditCut()));
-
- editCopy = new QAction(tr("Copy"), tr("&Copy"), QAccel::stringToKey(tr("Ctrl+C")), this);
- editCopy->setStatusTip(tr("Copies the selected section to the clipboard"));
- editCopy->setWhatsThis(tr("Copy\n\nCopies the selected section to the clipboard"));
- connect(editCopy, SIGNAL(activated()), this, SLOT(slotEditCopy()));
-
- editPaste = new QAction(tr("Paste"), tr("&Paste"), QAccel::stringToKey(tr("Ctrl+V")), this);
- editPaste->setStatusTip(tr("Pastes the clipboard contents to actual position"));
- editPaste->setWhatsThis(tr("Paste\n\nPastes the clipboard contents to actual position"));
- connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
-
- viewToolBar = new QAction(tr("Toolbar"), tr("Tool&bar"), 0, this, 0, true);
- viewToolBar->setStatusTip(tr("Enables/disables the toolbar"));
- viewToolBar->setWhatsThis(tr("Toolbar\n\nEnables/disables the toolbar"));
- connect(viewToolBar, SIGNAL(toggled(bool)), this, SLOT(slotViewToolBar(bool)));
-
- viewStatusBar = new QAction(tr("Statusbar"), tr("&Statusbar"), 0, this, 0, true);
- viewStatusBar->setStatusTip(tr("Enables/disables the statusbar"));
- viewStatusBar->setWhatsThis(tr("Statusbar\n\nEnables/disables the statusbar"));
- connect(viewStatusBar, SIGNAL(toggled(bool)), this, SLOT(slotViewStatusBar(bool)));
-
- helpAboutApp = new QAction(tr("About"), tr("&About..."), 0, this);
- helpAboutApp->setStatusTip(tr("About the application"));
- helpAboutApp->setWhatsThis(tr("About\n\nAbout the application"));
- connect(helpAboutApp, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
-
-}
-
-void BcApp::initMenuBar()
+/*
+ * public slot
+ */
+void BSApp::fileNew()
{
- ///////////////////////////////////////////////////////////////////
- // MENUBAR
-
- ///////////////////////////////////////////////////////////////////
- // menuBar entry fileMenu
- fileMenu=new QPopupMenu();
- fileNew->addTo(fileMenu);
- fileOpen->addTo(fileMenu);
- fileClose->addTo(fileMenu);
- fileMenu->insertSeparator();
- fileSave->addTo(fileMenu);
- fileSaveAs->addTo(fileMenu);
- fileMenu->insertSeparator();
- filePrint->addTo(fileMenu);
- fileMenu->insertSeparator();
- fileQuit->addTo(fileMenu);
-
- ///////////////////////////////////////////////////////////////////
- // menuBar entry editMenu
- editMenu=new QPopupMenu();
- editCut->addTo(editMenu);
- editCopy->addTo(editMenu);
- editPaste->addTo(editMenu);
-
- ///////////////////////////////////////////////////////////////////
- // menuBar entry viewMenu
- viewMenu=new QPopupMenu();
- viewMenu->setCheckable(true);
- viewToolBar->addTo(viewMenu);
- viewStatusBar->addTo(viewMenu);
- ///////////////////////////////////////////////////////////////////
- // EDIT YOUR APPLICATION SPECIFIC MENUENTRIES HERE
-
- ///////////////////////////////////////////////////////////////////
- // menuBar entry helpMenu
- helpMenu=new QPopupMenu();
- helpAboutApp->addTo(helpMenu);
-
- ///////////////////////////////////////////////////////////////////
- // MENUBAR CONFIGURATION
- menuBar()->insertItem(tr("&File"), fileMenu);
- menuBar()->insertItem(tr("&Edit"), editMenu);
- menuBar()->insertItem(tr("&View"), viewMenu);
- menuBar()->insertSeparator();
- menuBar()->insertItem(tr("&Help"), helpMenu);
-
+ qWarning( "BSApp::fileNew() not yet implemented!" );
}
-void BcApp::initToolBar()
+/*
+ * public slot
+ */
+void BSApp::fileOpen()
{
- ///////////////////////////////////////////////////////////////////
- // TOOLBAR
- fileToolbar = new QToolBar(this, "file operations");
- fileNew->addTo(fileToolbar);
- fileOpen->addTo(fileToolbar);
- fileSave->addTo(fileToolbar);
- fileToolbar->addSeparator();
- QWhatsThis::whatsThisButton(fileToolbar);
-
+ qWarning( "BSApp::fileOpen() not yet implemented!" );
}
-void BcApp::initStatusBar()
+/*
+ * public slot
+ */
+void BSApp::fileSave()
{
- ///////////////////////////////////////////////////////////////////
- //STATUSBAR
- statusBar()->message(tr("Ready."), 2000);
+ qWarning( "BSApp::fileSave() not yet implemented!" );
}
-void BcApp::initDoc()
+/*
+ * public slot
+ */
+void BSApp::fileSaveAs()
{
- doc=new BcDoc();
+ qWarning( "BSApp::fileSaveAs() not yet implemented!" );
}
-void BcApp::initView()
+/*
+ * public slot
+ */
+void BSApp::filePrint()
{
- ////////////////////////////////////////////////////////////////////
- // set the main widget here
- view=new BcView(this, doc);
- setCentralWidget(view);
+ qWarning( "BSApp::filePrint() not yet implemented!" );
}
-bool BcApp::queryExit()
+/*
+ * public slot
+ */
+void BSApp::fileExit()
{
- int exit=QMessageBox::information(this, tr("Quit..."),
- tr("Do your really want to quit?"),
- QMessageBox::Ok, QMessageBox::Cancel);
-
- if (exit==1)
- {
-
- }
- else
- {
-
- };
-
- return (exit==1);
-}
-
-/////////////////////////////////////////////////////////////////////
-// SLOT IMPLEMENTATION
-/////////////////////////////////////////////////////////////////////
-
-
-void BcApp::slotFileNew()
-{
- statusBar()->message(tr("Creating new file..."));
- doc->newDoc();
- statusBar()->message(tr("Ready."));
-}
-
-void BcApp::slotFileOpen()
-{
- statusBar()->message(tr("Opening file..."));
-
- QString fileName = QFileDialog::getOpenFileName(0,0,this);
- if (!fileName.isEmpty())
- {
- doc->load(fileName);
- setCaption(fileName);
- QString message=tr("Loaded document: ")+fileName;
- statusBar()->message(message, 2000);
- }
- else
- {
- statusBar()->message(tr("Opening aborted"), 2000);
- }
-}
-
-
-void BcApp::slotFileSave()
-{
- statusBar()->message(tr("Saving file..."));
- doc->save();
- statusBar()->message(tr("Ready."));
-}
-
-void BcApp::slotFileSaveAs()
-{
- statusBar()->message(tr("Saving file under new filename..."));
- QString fn = QFileDialog::getSaveFileName(0, 0, this);
- if (!fn.isEmpty())
- {
- doc->saveAs(fn);
- }
- else
- {
- statusBar()->message(tr("Saving aborted"), 2000);
- }
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::fileExit() not yet implemented!" );
}
-void BcApp::slotFileClose()
+/*
+ * public slot
+ */
+void BSApp::editUndo()
{
- statusBar()->message(tr("Closing file..."));
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::editUndo() not yet implemented!" );
}
-void BcApp::slotFilePrint()
+/*
+ * public slot
+ */
+void BSApp::editRedo()
{
- statusBar()->message(tr("Printing..."));
- QPrinter printer;
- if (printer.setup(this))
- {
- QPainter painter;
- painter.begin(&printer);
-
- ///////////////////////////////////////////////////////////////////
- // TODO: Define printing by using the QPainter methods here
-
- painter.end();
- };
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::editRedo() not yet implemented!" );
}
-void BcApp::slotFileQuit()
+/*
+ * public slot
+ */
+void BSApp::editCut()
{
- statusBar()->message(tr("Exiting application..."));
- ///////////////////////////////////////////////////////////////////
- // exits the Application
- if(doc->isModified())
- {
- if(queryExit())
- {
- qApp->quit();
- }
- else
- {
-
- };
- }
- else
- {
- qApp->quit();
- };
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::editCut() not yet implemented!" );
}
-void BcApp::slotEditCut()
+/*
+ * public slot
+ */
+void BSApp::editCopy()
{
- statusBar()->message(tr("Cutting selection..."));
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::editCopy() not yet implemented!" );
}
-void BcApp::slotEditCopy()
+/*
+ * public slot
+ */
+void BSApp::editPaste()
{
- statusBar()->message(tr("Copying selection to clipboard..."));
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::editPaste() not yet implemented!" );
}
-void BcApp::slotEditPaste()
+/*
+ * public slot
+ */
+void BSApp::editFind()
{
- statusBar()->message(tr("Inserting clipboard contents..."));
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::editFind() not yet implemented!" );
}
-
-void BcApp::slotViewToolBar(bool toggle)
+/*
+ * public slot
+ */
+void BSApp::helpIndex()
{
- statusBar()->message(tr("Toggle toolbar..."));
- ///////////////////////////////////////////////////////////////////
- // turn Toolbar on or off
-
- if (toggle== false)
- {
- fileToolbar->hide();
- }
- else
- {
- fileToolbar->show();
- };
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::helpIndex() not yet implemented!" );
}
-void BcApp::slotViewStatusBar(bool toggle)
+/*
+ * public slot
+ */
+void BSApp::helpContents()
{
- statusBar()->message(tr("Toggle statusbar..."));
- ///////////////////////////////////////////////////////////////////
- //turn Statusbar on or off
-
- if (toggle == false)
- {
- statusBar()->hide();
- }
- else
- {
- statusBar()->show();
- }
-
- statusBar()->message(tr("Ready."));
+ qWarning( "BSApp::helpContents() not yet implemented!" );
}
-void BcApp::slotHelpAbout()
+/*
+ * public slot
+ */
+void BSApp::helpAbout()
{
- QMessageBox::about(this,tr("About..."),
- tr("Bc\nVersion " VERSION "\n(c) 2001 by Michael Andreen") );
+ qWarning( "BSApp::helpAbout() not yet implemented!" );
}