1.9.0-beta1
authorinsilmaril
Thu, 21 Jun 2007 14:27:46 +0000
changeset 527f19bbd639726
parent 526 eacf1b165d2d
child 528 36d140349897
1.9.0-beta1
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
tex/vym.tex
version.h
vym.pro
     1.1 --- a/mainwindow.cpp	Wed Jun 20 11:58:47 2007 +0000
     1.2 +++ b/mainwindow.cpp	Thu Jun 21 14:27:46 2007 +0000
     1.3 @@ -1466,11 +1466,18 @@
     1.4      QMenu *testMenu = menuBar()->addMenu( tr( "&Test" ));
     1.5  
     1.6      QAction *a;
     1.7 -    a = new QAction( "Test function" , this);
     1.8 -    a->setStatusTip( "Call test function" );
     1.9 +    a = new QAction( "Test function 1" , this);
    1.10 +    a->setStatusTip( "Call test function 1" );
    1.11 +	testMenu->addAction (a);
    1.12  	//a->setShortcut (Qt::Key_F4 );
    1.13 -    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) );
    1.14 +    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction1() ) );
    1.15 +
    1.16 +    a = new QAction( "Test function 2" , this);
    1.17 +    a->setStatusTip( "Call test function 2" );
    1.18 +	//a->setShortcut (Qt::Key_F4 );
    1.19  	testMenu->addAction (a);
    1.20 +    connect( a, SIGNAL( triggered() ), this, SLOT( testFunction2() ) );
    1.21 +
    1.22      a = new QAction( "Command" , this);
    1.23      a->setStatusTip( "Enter command to call in editor" );
    1.24  	//a->setShortcut (Qt::Key_F5 );
    1.25 @@ -3581,10 +3588,16 @@
    1.26  		currentMapEditor()->toggleStandardFlag(sender()->name());
    1.27  }
    1.28  
    1.29 -void Main::testFunction()
    1.30 +void Main::testFunction1()
    1.31  {
    1.32  	if (!currentMapEditor()) return;
    1.33 -	currentMapEditor()->testFunction();
    1.34 +	currentMapEditor()->testFunction1();
    1.35 +}
    1.36 +
    1.37 +void Main::testFunction2()
    1.38 +{
    1.39 +	if (!currentMapEditor()) return;
    1.40 +	currentMapEditor()->testFunction2();
    1.41  }
    1.42  
    1.43  void Main::testCommand()
     2.1 --- a/mainwindow.h	Wed Jun 20 11:58:47 2007 +0000
     2.2 +++ b/mainwindow.h	Thu Jun 21 14:27:46 2007 +0000
     2.3 @@ -200,7 +200,8 @@
     2.4  
     2.5  	void standardFlagChanged();
     2.6  
     2.7 -    void testFunction();
     2.8 +    void testFunction1();
     2.9 +    void testFunction2();
    2.10      void testCommand();
    2.11  
    2.12      void helpDoc();
     3.1 --- a/mapeditor.cpp	Wed Jun 20 11:58:47 2007 +0000
     3.2 +++ b/mapeditor.cpp	Thu Jun 21 14:27:46 2007 +0000
     3.3 @@ -4041,10 +4041,25 @@
     3.4  	}
     3.5  }
     3.6  
     3.7 -void MapEditor::testFunction()
     3.8 +void MapEditor::testFunction1()
     3.9  {
    3.10 +
    3.11 +    tcpServer = new QTcpServer(this);
    3.12 +    if (!tcpServer->listen(QHostAddress::Any,54321)) {
    3.13 +        QMessageBox::critical(this, tr("Fortune Server"),
    3.14 +                              tr("Unable to start the server: %1.")
    3.15 +                              .arg(tcpServer->errorString()));
    3.16 +        close();
    3.17 +        return;
    3.18 +    }
    3.19 +	connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient()));
    3.20 +	if (debug)
    3.21 +		cout<<"Server is running on port "<<tcpServer->serverPort()<<endl;
    3.22 +
    3.23 +/*
    3.24  	BranchObj *bo=xelection.getBranch();
    3.25  	if (bo) animObjList.append( bo );
    3.26 +*/	
    3.27  	
    3.28  /*
    3.29  	WarningDialog dia;
    3.30 @@ -4084,6 +4099,23 @@
    3.31  	}	
    3.32  	cout <<"  hidemode="<<hidemode<<endl;
    3.33  	*/
    3.34 +}	
    3.35 +	
    3.36 +void MapEditor::testFunction2()
    3.37 +{
    3.38 +   QByteArray block;
    3.39 +    QDataStream out(&block, QIODevice::WriteOnly);
    3.40 +    out.setVersion(QDataStream::Qt_4_0);
    3.41 +    out << (quint16)0;
    3.42 +    out << xelection.getSelectString();
    3.43 +    out.device()->seek(0);
    3.44 +    out << (quint16)(block.size() - sizeof(quint16));
    3.45 +
    3.46 +	for (int i=0; i<clientList.size(); ++i)
    3.47 +	{
    3.48 +		cout << "Sending to "<<clientList.at(i)->peerAddress().toString().ascii()<<endl;
    3.49 +		clientList.at(i)->write (block);
    3.50 +	}
    3.51  }
    3.52  
    3.53  void MapEditor::contextMenuEvent ( QContextMenuEvent * e )
    3.54 @@ -4735,6 +4767,27 @@
    3.55  		mainWindow->fileSave (this);
    3.56  }
    3.57  
    3.58 +void MapEditor::newClient()
    3.59 +{
    3.60 +    QByteArray block;
    3.61 +    QDataStream out(&block, QIODevice::WriteOnly);
    3.62 +    out.setVersion(QDataStream::Qt_4_0);
    3.63 +    out << (quint16)0;
    3.64 +    out << xelection.getSelectString();
    3.65 +    out.device()->seek(0);
    3.66 +    out << (quint16)(block.size() - sizeof(quint16));
    3.67 +
    3.68 +    QTcpSocket *newClient = tcpServer->nextPendingConnection();
    3.69 +    connect(newClient, SIGNAL(disconnected()),
    3.70 +            newClient, SLOT(deleteLater()));
    3.71 +
    3.72 +	cout <<"ME::newClient  at "<<newClient->peerAddress().toString().ascii()<<endl;
    3.73 +
    3.74 +	clientList.append (newClient);
    3.75 +
    3.76 +    newClient->write(block);
    3.77 +    //newClient->disconnectFromHost();
    3.78 +}
    3.79  
    3.80  /*TODO not needed? void MapEditor::contentsDropEvent(QDropEvent *event) 
    3.81  {
     4.1 --- a/mapeditor.h	Wed Jun 20 11:58:47 2007 +0000
     4.2 +++ b/mapeditor.h	Thu Jun 21 14:27:46 2007 +0000
     4.3 @@ -2,6 +2,7 @@
     4.4  #define MAPEDITOR_H
     4.5  
     4.6  #include <QGraphicsView>
     4.7 +#include <QtNetwork>
     4.8  
     4.9  #include "mapcenterobj.h"
    4.10  #include "file.h"
    4.11 @@ -308,7 +309,8 @@
    4.12      void importDir();
    4.13  	void followXLink (int);
    4.14  	void editXLink (int);
    4.15 -    void testFunction();					// just testing new stuff
    4.16 +    void testFunction1();					// just testing new stuff
    4.17 +    void testFunction2();					// just testing new stuff
    4.18  											// set /mainwindo/showTestMenu=true...
    4.19  
    4.20  protected:
    4.21 @@ -330,6 +332,7 @@
    4.22  
    4.23  private slots:	
    4.24  	void autosave ();
    4.25 +	void newClient();
    4.26  
    4.27  private:
    4.28  	State state;				// State of MapEditor
    4.29 @@ -399,6 +402,9 @@
    4.30  	QPoint exportOffset;		// set before export, used in save
    4.31  	BranchObj::HideTmpMode hidemode;	// true while exporting to hide some stuff
    4.32  
    4.33 +	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
    4.34 +	QList <QTcpSocket*> clientList;
    4.35 +
    4.36  	int timerId;				// animation timer
    4.37  	QList <MapObj*> animObjList;// list with animated objects
    4.38  };
     5.1 --- a/tex/vym.tex	Wed Jun 20 11:58:47 2007 +0000
     5.2 +++ b/tex/vym.tex	Thu Jun 21 14:27:46 2007 +0000
     5.3 @@ -866,7 +866,12 @@
     5.4  }
     5.5  
     5.6  \subsection{Macros} \label{macros}
     5.7 -Macros have been added to \vym in version~1.9.0. Each function key
     5.8 +Macros have been added to \vym in version~1.9.0. 
     5.9 +So far they have a preliminary character, maybe they are going to be
    5.10 +replaced by full-featured scripting functionality later (though the
    5.11 +commands will be more or less the same).
    5.12 +
    5.13 +Each function key
    5.14  \key{F1} to \key{F12} holds a macro, which is executed on the current
    5.15  selection if the key is pressed. The default macros change the colour of
    5.16  a subtree or set the frame of a branch:
     6.1 --- a/version.h	Wed Jun 20 11:58:47 2007 +0000
     6.2 +++ b/version.h	Thu Jun 21 14:27:46 2007 +0000
     6.3 @@ -5,9 +5,9 @@
     6.4  
     6.5  #define __VYM_NAME "VYM"
     6.6  #define __VYM_VERSION "1.8.74"
     6.7 -//#define __VYM_CODENAME "Codename: 1.9.0-beta-1"
     6.8 -#define __VYM_CODENAME "Codename: development version"
     6.9 -#define __VYM_BUILD_DATE "June 20, 2007"
    6.10 +#define __VYM_CODENAME "Codename: 1.9.0-beta-1"
    6.11 +//#define __VYM_CODENAME "Codename: development version"
    6.12 +#define __VYM_BUILD_DATE "June 21, 2007"
    6.13  
    6.14  
    6.15  bool checkVersion(const QString &);
     7.1 --- a/vym.pro	Wed Jun 20 11:58:47 2007 +0000
     7.2 +++ b/vym.pro	Thu Jun 21 14:27:46 2007 +0000
     7.3 @@ -6,6 +6,7 @@
     7.4  ICON =icons/vym.icns
     7.5  
     7.6  QT += qt3support
     7.7 +QT += network
     7.8  
     7.9  HEADERS	+= \	
    7.10  	aboutdialog.h \