From 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 01:49:02 +0000 Subject: Added KDE3 version of ktechlab git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/flowcodeview.cpp | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/flowcodeview.cpp (limited to 'src/flowcodeview.cpp') diff --git a/src/flowcodeview.cpp b/src/flowcodeview.cpp new file mode 100644 index 0000000..8f3cfd1 --- /dev/null +++ b/src/flowcodeview.cpp @@ -0,0 +1,82 @@ +/*************************************************************************** + * Copyright (C) 2005 by David Saxton * + * david@bluehaze.org * + * * + * 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. * + ***************************************************************************/ + +#include "flowcodedocument.h" +#include "flowcodeview.h" +#include "ktechlab.h" +#include "viewiface.h" + +#include +#include +#include +#include + +FlowCodeView::FlowCodeView( FlowCodeDocument * flowCodeDocument, ViewContainer *viewContainer, uint viewAreaId, const char *name ) + : ICNView( flowCodeDocument, viewContainer, viewAreaId, name ) +{ + KActionCollection * ac = actionCollection(); + + //BEGIN Convert To * Actions + KToolBarPopupAction * pa = new KToolBarPopupAction( i18n("Convert to ..."), "fork", 0, 0, 0, ac, "program_convert" ); + pa->setDelayed(false); + + KPopupMenu * m = pa->popupMenu(); + + m->insertTitle( i18n("Convert to") ); + m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_microbe", KIcon::Small ), i18n("Microbe"), FlowCodeDocument::MicrobeOutput ); + m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_assembly", KIcon::Small ), i18n("Assembly"), FlowCodeDocument::AssemblyOutput ); + m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_hex", KIcon::Small ), i18n("Hex"), FlowCodeDocument::HexOutput ); + m->insertItem( KGlobal::iconLoader()->loadIcon( "convert_to_pic", KIcon::Small ), i18n("PIC (upload)"), FlowCodeDocument::PICOutput ); + connect( m, SIGNAL(activated(int)), flowCodeDocument, SLOT(slotConvertTo(int)) ); + //END Convert To * Actions + + + + +// new KAction( i18n("Convert to Microbe"), "convert_to_microbe", Qt::Key_F7, flowCodeDocument, SLOT(convertToMicrobe()), ac, "tools_to_microbe" ); +// new KAction( i18n("Convert to Assembly"), "convert_to_assembly", Qt::Key_F8, flowCodeDocument, SLOT(convertToAssembly()), ac, "tools_to_assembly" ); +// new KAction( i18n("Convert to Hex"), "convert_to_hex", Qt::Key_F9, flowCodeDocument, SLOT(convertToHex()), ac, "tools_to_hex" ); +// new KAction( i18n("Upload PIC Program"), "convert_to_pic", 0, flowCodeDocument, SLOT(convertToPIC()), ac, "tools_to_pic" ); + + + + + setXMLFile( "ktechlabflowcodeui.rc", true ); + + QWhatsThis::add( this, i18n( + "Construct a FlowCode document by dragging FlowParts from the list on the left. All FlowCharts require an initial \"Start\" part, of which there can only be one.

" + + "Some FlowParts, such as Subroutines, act as a container element for other FlowParts. Drag the items in or out of a container as appropritate. The container that will become the parent of the part being dragged is indicated by being selected.

" + + "Note that connections cannot be made between FlowParts in different containers, or at different levels." + ) ); + + m_pViewIface = new FlowCodeViewIface(this); +} + + +FlowCodeView::~FlowCodeView() +{ + delete m_pViewIface; + m_pViewIface = 0l; +} + + + +void FlowCodeView::dragEnterEvent( QDragEnterEvent * e ) +{ + ICNView::dragEnterEvent(e); + if ( e->isAccepted() ) + return; + + e->accept( e->provides("ktechlab/flowpart") ); +} + +#include "flowcodeview.moc" -- cgit v1.2.1