mainwindow.cpp
changeset 823 0bba81dde1bc
parent 822 c2ce9944148c
child 824 36eb4b8f409e
     1.1 --- a/mainwindow.cpp	Wed Feb 10 13:48:42 2010 +0000
     1.2 +++ b/mainwindow.cpp	Fri Feb 19 13:47:03 2010 +0000
     1.3 @@ -1133,6 +1133,15 @@
     1.4  	connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleNoteEditor() ) );
     1.5  	actionViewToggleNoteEditor=a;
     1.6  
     1.7 +	a = new QAction(QPixmap(), tr( "Show tree editor","View action" ),this);
     1.8 +	a->setStatusTip ( tr( "Show tree editor" ));
     1.9 +	a->setShortcut ( Qt::CTRL + Qt::Key_T );	// Toggle Note Editor // FIXME-3 originally: color subtree
    1.10 +	a->setToggleAction(true);
    1.11 +	a->addTo( tb );
    1.12 +	viewMenu->addAction (a);
    1.13 +	connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleTreeEditor() ) );
    1.14 +	actionViewToggleTreeEditor=a;
    1.15 +
    1.16  	a = new QAction(QPixmap(iconPath+"history.png"),  tr( "History Window","View action" ),this );
    1.17  	a->setStatusTip ( tr( "Show History Window" ));
    1.18  	a->setShortcut ( Qt::CTRL + Qt::Key_H  );	// Toggle history window
    1.19 @@ -1220,22 +1229,25 @@
    1.20  	Flag *flag=new Flag;;
    1.21  	flag->setVisible(true);
    1.22  
    1.23 -	flag->load(QPixmap(flagsPath+"flag-note.png"));
    1.24 +	flag->load(flagsPath+"flag-note.png");
    1.25  	setupFlag (flag,tb,"system-note",tr("Note","SystemFlag"));
    1.26  
    1.27 -	flag->load(QPixmap(flagsPath+"flag-url.png"));
    1.28 +	flag->load(flagsPath+"flag-url.png");
    1.29  	setupFlag (flag,tb,"system-url",tr("URL to Document ","SystemFlag"));
    1.30  
    1.31 -	flag->load(QPixmap(flagsPath+"flag-vymlink.png"));
    1.32 +	flag->load(flagsPath+"flag-url-bugzilla-novell.png");
    1.33 +	setupFlag (flag,tb,"system-url-bugzilla-novell",tr("URL to Bugzilla ","SystemFlag"));
    1.34 +
    1.35 +	flag->load(flagsPath+"flag-vymlink.png");
    1.36  	setupFlag (flag,tb,"system-vymLink",tr("Link to another vym map","SystemFlag"));
    1.37  
    1.38 -	flag->load(QPixmap(flagsPath+"flag-scrolled-right.png"));
    1.39 +	flag->load(flagsPath+"flag-scrolled-right.png");
    1.40  	setupFlag (flag,tb,"system-scrolledright",tr("subtree is scrolled","SystemFlag"));
    1.41  
    1.42 -	flag->load(QPixmap(flagsPath+"flag-tmpUnscrolled-right.png"));
    1.43 +	flag->load(flagsPath+"flag-tmpUnscrolled-right.png");
    1.44  	setupFlag (flag,tb,"system-tmpUnscrolledRight",tr("subtree is temporary scrolled","SystemFlag"));
    1.45  
    1.46 -	flag->load(QPixmap(flagsPath+"flag-hideexport.png"));
    1.47 +	flag->load(flagsPath+"flag-hideexport.png");
    1.48  	setupFlag (flag,tb,"system-hideInExport",tr("Hide object in exported maps","SystemFlag"));
    1.49  
    1.50  	// Create Standard Flags
    1.51 @@ -1569,13 +1581,13 @@
    1.52  	QAction *a;
    1.53  	a = new QAction( "Test function 1" , this);
    1.54  	a->setStatusTip( "Call test function 1" );
    1.55 -	a->setShortcut (Qt::CTRL + Qt::Key_T);	// Test function 1  //FIXME-2 originally: color subtree
    1.56 +	a->setShortcut (Qt::SHIFT + Qt::Key_T);	// Test function 1  
    1.57  	testMenu->addAction (a);
    1.58  	connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) );
    1.59  
    1.60  	a = new QAction( "Test function 2" , this);
    1.61  	a->setStatusTip( "Call test function 2" );
    1.62 -	a->setShortcut (Qt::SHIFT + Qt::Key_T);		// Test function 2
    1.63 +	a->setShortcut (Qt::ALT + Qt::Key_T);	// Test function 2
    1.64  	testMenu->addAction (a);
    1.65  	connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) );
    1.66  
    1.67 @@ -1788,6 +1800,13 @@
    1.68  	return NULL;	
    1.69  }
    1.70  
    1.71 +VymModel* Main::getModel(uint id) const
    1.72 +{
    1.73 +	if ( tabWidget->currentPage())
    1.74 +		return vymViews.at(tabWidget->currentIndex())->getModel();
    1.75 +	return NULL;	
    1.76 +}
    1.77 +
    1.78  
    1.79  void Main::editorChanged(QWidget *)
    1.80  {
    1.81 @@ -3354,6 +3373,12 @@
    1.82  		windowShowNoteEditor();
    1.83  }
    1.84  
    1.85 +void Main::windowToggleTreeEditor()
    1.86 +{
    1.87 +	if ( tabWidget->currentPage())
    1.88 +		vymViews.at(tabWidget->currentIndex())->toggleTreeEditor();
    1.89 +}
    1.90 +
    1.91  void Main::windowToggleHistory()
    1.92  {
    1.93  	if (historyWindow->isVisible())
    1.94 @@ -3754,65 +3779,26 @@
    1.95  	}
    1.96  }
    1.97  
    1.98 +
    1.99 +#include "attributeitem.h"
   1.100  void Main::testFunction1()
   1.101  {
   1.102 -
   1.103 -	Process p;
   1.104 -	QString script="test/sleep.sh";
   1.105 -	p.start (script);
   1.106 -	if (!p.waitForStarted())
   1.107 +	VymModel *m=currentModel();
   1.108 +	if (!m) return;
   1.109 +
   1.110 +	BranchItem *selbi=m->getSelectedBranch();
   1.111 +	if (selbi)
   1.112  	{
   1.113 -		cout <<"VM::getBugzillaData couldn't start "<<script.toStdString()<<endl;
   1.114 -		return;
   1.115 -	}	
   1.116 -	if (!p.waitForFinished())
   1.117 -	{
   1.118 -		cout <<"VM::getBugzillaData couldn't finish "<<script.toStdString()<<endl;
   1.119 -		return;
   1.120 +		QList<QVariant> cData;
   1.121 +		cData << "new ai" << "undef";
   1.122 +
   1.123 +		AttributeItem *ai=new AttributeItem (cData,selbi);
   1.124 +		ai->set ("Key 1","Val a",AttributeItem::FreeString);
   1.125 +
   1.126 +		m->addAttribute (ai);
   1.127  	}
   1.128 -	//QByteArray result=p.readAll();
   1.129 -	QString result=p.getStdout();
   1.130 -	while (result.endsWith("\n")) result.chop(1); 
   1.131 -	//cout << QString(result).toStdString()<<endl;
   1.132 -	QString err=p.getErrout();
   1.133 -	if (!err.isEmpty())
   1.134 -	{
   1.135 -		cout << "VM::getBugzillaData Error:\n";
   1.136 -		cout <<err.toStdString()<<endl;
   1.137 -	}
   1.138 -	else if (!result.isEmpty())
   1.139 -	{
   1.140 -		cout << "ok\n";
   1.141 -	}	
   1.142 -/*
   1.143 -	int max=100000;
   1.144 -	QProgressDialog p ("testprogress","cancel",0,max,this);
   1.145 -	p.setWindowModality (Qt::WindowModal);
   1.146 -	p.setAutoReset (false);
   1.147 -	p.setAutoClose (false);
   1.148 -	p.show();
   1.149 -	for (int i=0;i<max;i++)
   1.150 -	{
   1.151 -		p.setValue(i);
   1.152 -		if (p.wasCanceled()) break;
   1.153 -	}
   1.154 -
   1.155 -	cout << "Doing it again...\n";
   1.156 -	p.reset();
   1.157 -	p.hide();
   1.158 -	max=max+10;
   1.159 -	p.setRange(0,max);
   1.160 -	p.setValue (0);
   1.161 -	p.show();
   1.162 -	for (int i=0;i<max;i++)
   1.163 -	{
   1.164 -		p.setValue (i);
   1.165 -		if (p.wasCanceled()) break;
   1.166 -	}
   1.167 -	p.setValue (max);
   1.168 -	cout << "Done.\n";
   1.169  	return;
   1.170 -*/
   1.171 +
   1.172  /*
   1.173  	if (!currentMapEditor()) return;
   1.174  	currentMapEditor()->testFunction1();