mainwindow.cpp
changeset 795 6b0a5f4923d3
parent 793 cac93797c580
child 800 959bd133cd1a
     1.1 --- a/mainwindow.cpp	Fri Sep 11 12:56:15 2009 +0000
     1.2 +++ b/mainwindow.cpp	Thu Sep 17 09:41:09 2009 +0000
     1.3 @@ -23,7 +23,7 @@
     1.4  #include "warningdialog.h"
     1.5  #include "xlinkitem.h"
     1.6  
     1.7 -#include <modeltest.h>	// FIXME-3
     1.8 +//#include <modeltest.h>	// FIXME-3
     1.9  
    1.10  #if defined(Q_OS_WIN32)
    1.11  // Define only this structure as opposed to
    1.12 @@ -665,6 +665,13 @@
    1.13  	editMenu->addAction (a);
    1.14  	actionMoveDown=a;
    1.15  	
    1.16 +    a = new QAction(QPixmap(), tr( "&Detach","Context menu" ),this);
    1.17 +	a->setStatusTip ( tr( "Detach branch and use as mapcenter","Context menu" ) );
    1.18 +	a->setShortcut ( Qt::Key_D );					// Detach branch
    1.19 +	editMenu->addAction (a);
    1.20 +    connect( a, SIGNAL( triggered() ), this, SLOT( editDetach() ) );
    1.21 +	actionDetach=a;
    1.22 +	
    1.23  	a = new QAction( QPixmap(iconPath+"editsort.png" ), tr( "Sort children","Edit menu" ), this );
    1.24  	connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) );
    1.25  	a->setEnabled (true);
    1.26 @@ -1547,6 +1554,7 @@
    1.27  
    1.28  	actionSaveBranch->addTo( branchContextMenu );
    1.29  	actionFileNewCopy->addTo (branchContextMenu );
    1.30 +	actionDetach->addTo (branchContextMenu );
    1.31  
    1.32  	branchContextMenu->addSeparator();	
    1.33  	branchContextMenu->addAction ( actionLoadImage);
    1.34 @@ -1710,7 +1718,7 @@
    1.35  {
    1.36  	VymModel *vm=new VymModel;
    1.37  
    1.38 -new ModelTest(vm, this);	//FIXME-3
    1.39 +//new ModelTest(vm, this);	//FIXME-3
    1.40  
    1.41  
    1.42  	VymView *vv=new VymView (vm);
    1.43 @@ -2699,6 +2707,7 @@
    1.44  void Main::editMapInfo()
    1.45  {
    1.46  	VymModel *m=currentModel();
    1.47 +	if (!m) return;
    1.48  
    1.49  	ExtraInfoDialog dia;
    1.50  	dia.setMapName (m->getFileName() );
    1.51 @@ -2707,27 +2716,27 @@
    1.52  
    1.53  	// Calc some stats
    1.54  	QString stats;
    1.55 -/* FIXME-2 no stats at the moment (view dependent...)
    1.56 -    stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6);
    1.57 +    stats+=tr("%1 items on map\n","Info about map").arg (m->getScene()->items().size(),6);
    1.58  
    1.59  	uint b=0;
    1.60  	uint f=0;
    1.61  	uint n=0;
    1.62  	uint xl=0;
    1.63 -	BranchObj *bo;
    1.64 -	bo=m->first();
    1.65 -	while (bo) 
    1.66 +	BranchItem *cur=NULL;
    1.67 +	BranchItem *prev=NULL;
    1.68 +	m->next(cur,prev);
    1.69 +	while (cur) 
    1.70  	{
    1.71 -		if (!bo->getNote().isEmpty() ) n++;
    1.72 -		f+= bo->countFloatImages();
    1.73 +		if (!cur->getNote().isEmpty() ) n++;
    1.74 +		f+= cur->imageCount();
    1.75  		b++;
    1.76 -		xl+=bo->countXLinks();
    1.77 -		bo=m->next(bo);
    1.78 +		xl+=cur->xlinkCount();
    1.79 +		m->next(cur,prev);
    1.80  	}
    1.81 +
    1.82      stats+=QString ("%1 xLinks \n").arg (xl,6);
    1.83      stats+=QString ("%1 notes\n").arg (n,6);
    1.84      stats+=QString ("%1 images\n").arg (f,6);
    1.85 -*/
    1.86      stats+=QString ("%1 branches\n").arg (m->branchCount(),6);
    1.87  	dia.setStats (stats);
    1.88  
    1.89 @@ -2751,6 +2760,12 @@
    1.90  	if (m) m->moveDown();
    1.91  }
    1.92  
    1.93 +void Main::editDetach()
    1.94 +{
    1.95 +	VymModel *m=currentModel();
    1.96 +	if (m) m->detach();
    1.97 +}
    1.98 +
    1.99  void Main::editSortChildren()
   1.100  {
   1.101  	VymModel *m=currentModel();
   1.102 @@ -3591,6 +3606,11 @@
   1.103  {
   1.104  	if (!currentMapEditor()) return;
   1.105  	currentMapEditor()->testFunction1();
   1.106 +	/*
   1.107 +	VymModel *m=currentModel();
   1.108 +	if (!m) return;
   1.109 +	m->clearItem (m->getSelectedItem());
   1.110 +	*/
   1.111  }
   1.112  
   1.113  void Main::testFunction2()