mainwindow.cpp
changeset 528 36d140349897
parent 527 f19bbd639726
child 531 be24af55da40
     1.1 --- a/mainwindow.cpp	Thu Jun 21 14:27:46 2007 +0000
     1.2 +++ b/mainwindow.cpp	Mon Jun 25 12:54:19 2007 +0000
     1.3 @@ -175,6 +175,7 @@
     1.4      setupViewActions();
     1.5      setupModeActions();
     1.6  	setupFlagActions();
     1.7 +    setupNetworkActions();
     1.8      setupSettingsActions();
     1.9  	setupContextMenus();
    1.10  	setupMacros();
    1.11 @@ -623,7 +624,7 @@
    1.12  
    1.13  	a = new QAction( tr( "Open URL in new tab","Edit menu" ), this);
    1.14  	a->setStatusTip (tr( "Open URL in new tab" ));
    1.15 -	a->setShortcut (Qt::CTRL+Qt::Key_U );
    1.16 +	//a->setShortcut (Qt::CTRL+Qt::Key_U );
    1.17  	addAction(a);
    1.18      connect( a, SIGNAL( triggered() ), this, SLOT( editOpenURLTab() ) );
    1.19  	actionEditOpenURLTab=a;
    1.20 @@ -637,14 +638,23 @@
    1.21  
    1.22  	a = new QAction(QPixmap(), tr( "Edit URL...","Edit menu"), this);
    1.23  	a->setStatusTip ( tr( "Edit URL" ) );
    1.24 -	a->setShortcut (Qt::SHIFT + Qt::CTRL + Qt::Key_U );
    1.25 -	//a->setShortcut ( Qt::Key_U );
    1.26 +	//a->setShortcut (Qt::SHIFT + Qt::CTRL + Qt::Key_U );
    1.27 +	a->setShortcut ( Qt::Key_U );
    1.28  	a->setShortcutContext (Qt::WindowShortcut);
    1.29  	actionListBranches.append(a);
    1.30  	addAction(a);
    1.31      connect( a, SIGNAL( triggered() ), this, SLOT( editURL() ) );
    1.32  	actionEditURL=a;
    1.33  	
    1.34 +	a = new QAction(QPixmap(), tr( "Edit local URL...","Edit menu"), this);
    1.35 +	a->setStatusTip ( tr( "Edit local URL" ) );
    1.36 +	a->setShortcut (Qt::SHIFT +  Qt::Key_U );
    1.37 +	a->setShortcutContext (Qt::WindowShortcut);
    1.38 +	actionListBranches.append(a);
    1.39 +	addAction(a);
    1.40 +    connect( a, SIGNAL( triggered() ), this, SLOT( editLocalURL() ) );
    1.41 +	actionEditURL=a;
    1.42 +	
    1.43  	a = new QAction( tr( "Use heading for URL","Edit menu" ), this);
    1.44  	a->setStatusTip ( tr( "Use heading of selected branch as URL" ));
    1.45  	a->setEnabled (false);
    1.46 @@ -1371,6 +1381,28 @@
    1.47  	delete (fo);
    1.48  }
    1.49  
    1.50 +// Network Actions
    1.51 +void Main::setupNetworkActions()
    1.52 +{
    1.53 +	if (!settings.value( "/mainwindow/showTestMenu",false).toBool() ) 
    1.54 +		return;
    1.55 +    QMenu *netMenu = menuBar()->addMenu(  "&Network" );
    1.56 +
    1.57 +	QAction *a;
    1.58 +
    1.59 +    a = new QAction(  "Start TCPserver for MapEditor",this);
    1.60 +    //a->setStatusTip ( "Set application to open pdf files"));
    1.61 +	a->setShortcut ( Qt::Key_T );		//New TCP server
    1.62 +    connect( a, SIGNAL( triggered() ), this, SLOT( networkStartServer() ) );
    1.63 +	netMenu->addAction (a);
    1.64 +
    1.65 +    a = new QAction(  "Connect MapEditor to server",this);
    1.66 +    //a->setStatusTip ( "Set application to open pdf files"));
    1.67 +	a->setShortcut ( Qt::Key_C );		// Connect to server
    1.68 +    connect( a, SIGNAL( triggered() ), this, SLOT( networkConnect() ) );
    1.69 +	netMenu->addAction (a);
    1.70 +}
    1.71 +	
    1.72  // Settings Actions
    1.73  void Main::setupSettingsActions()
    1.74  {
    1.75 @@ -1557,7 +1589,7 @@
    1.76  		branchLinksContextMenu->addAction ( actionEditURL );
    1.77  		branchLinksContextMenu->addAction ( actionEditHeading2URL );
    1.78  		branchLinksContextMenu->addAction ( actionEditBugzilla2URL );
    1.79 -		if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
    1.80 +		if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
    1.81  		{
    1.82  			branchLinksContextMenu->addAction ( actionEditFATE2URL );
    1.83  		}	
    1.84 @@ -2650,6 +2682,12 @@
    1.85  	    currentMapEditor()->editURL();
    1.86  }
    1.87  
    1.88 +void Main::editLocalURL()
    1.89 +{
    1.90 +	if (currentMapEditor())
    1.91 +	    currentMapEditor()->editLocalURL();
    1.92 +}
    1.93 +
    1.94  void Main::editHeading2URL()
    1.95  {
    1.96  	if (currentMapEditor())
    1.97 @@ -3163,6 +3201,18 @@
    1.98  	}	
    1.99  }
   1.100  
   1.101 +void Main::networkStartServer()
   1.102 +{
   1.103 +	MapEditor *me=currentMapEditor();
   1.104 +	if (me) me->newServer();
   1.105 +}
   1.106 +
   1.107 +void Main::networkConnect()
   1.108 +{
   1.109 +	MapEditor *me=currentMapEditor();
   1.110 +	if (me) me->newServer();
   1.111 +}
   1.112 +
   1.113  bool Main::settingsPDF()
   1.114  {
   1.115  	// Default browser is set in constructor
   1.116 @@ -3591,7 +3641,7 @@
   1.117  void Main::testFunction1()
   1.118  {
   1.119  	if (!currentMapEditor()) return;
   1.120 -	currentMapEditor()->testFunction1();
   1.121 +	currentMapEditor()->newServer();
   1.122  }
   1.123  
   1.124  void Main::testFunction2()