Remove incomplete and useless server code

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
master
Michele Calgaro 2 months ago
parent 281a7702cf
commit 2d49c44c47
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -130,12 +130,6 @@ a.external
<li>A nice about dialog. Errrmm, ok beneath all the mean stuff this is somehow the programmers playground ;-)</li>
</ul>
</p>
<p>
Also a <a class="external" href="http://notepad-plus.sourceforge.net/">Notepad++</a> plugin version is available.
The programming project for that is currently only available as Visual Studio C++ 2005 project file.
Also this plugin has some problems with its event handling, because it is running as a DLL inside of Notepad++ event loop.
This will be replaced with the upcoming UiGUI server functionality. See future plans for more about that.
</p>
<h3>Supported and tested platforms</h3>
<p>
@ -189,46 +183,6 @@ a.external
and XCode are included.</p>
</p>
<h3>Used TQt techniques</h3>
<p>This list shows some selected functionalities that TQt offers and that I use with UiGUI.</p>
<ul>
<li>Translations are done with
<a class="external" href="http://doc.trolltech.com/4.4/tqtranslator.html">TQTranslator</a>,
<a class="external" href="http://doc.trolltech.com/4.4/tqlocale.html">TQLocale</a> and Linguist.</li>
<li>File encodings are supported by using
<a class="external" href="http://doc.trolltech.com/4.4/tqtextcodec.html">TQTextCodec</a>
and <a class="external" href="http://doc.trolltech.com/4.4/tqtextstream.html">TQTextStream</a>.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qscriptengine.html">TQScriptEngine</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qscriptvalue.html">TQScriptValue</a>
is included for executing JavaScript files used as indenters.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qgraphicsview.html">TQGraphicsView</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qgraphicsproxywidget.html">TQGraphicsProxyWidget</a>
for creating an animated 3D about dialog, simulating that is done on the whole desktop by using
the screenshot capability of TQt.</li>
<li>Stylesheet settings give the about dialog a special look. Also gradients are used.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/tqhttp.html">TQHttp</a>
and <a class="external" href="http://doc.trolltech.com/4.4/tqurl.html">TQUrl</a>
are used for the update check.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/tqsettings.html">TQSettings</a>
is responsible for storing the application and syntax highlighter settings.</li>
<li><a class="external" href="http://doc.trolltech.com/4.4/qtcpserver.html">TQTcpServer</a>
and <a class="external" href="http://doc.trolltech.com/4.4/qtcpsocket.html">TQTcpSocket</a>
build the base for the UiGUI Server.</li>
<li>Of course I use the TQt tools qmake, lupdate, lrelease, Designer, Linguist and my very best friend the Assistant.</li>
</ul>
<h3>Future plans</h3>
<ul>
<li>Exchangeable source code view. Mainly adding a "Live Diff View" where you can see the unformatted
code and the formatted one side by side with changes highlighted.</li>
<li>Bring functionality to the UiGUI server so that he can be run anywhere and a client plugin in any editor
like Eclipse or Notepad++ can communicate with it. Thus the client plugin can be written in any language
supporting TCP/IP connections and send to be formatted code to the server. Also some settings might be
made via that conncection. Plans are going on, so stay tuned.</li>
<li>Batch/Multiple file and directory indenting, so that the user can throw a bunch of files or directories
into a list and click on "Do it", so they all will get formatted.</li>
</ul>
<h3>Thanks</h3>
Here I'd like to say "thank you" to all those guys, who helped me improving UiGUI. May it be doing some
translations, creating packages for Linux, letting me know about bugs or ways to improve or just saying

@ -1,175 +0,0 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "UiGuiIndentServer.h"
#include <tqtcpserver.h>
#include <tqtcpsocket.h>
#include <tqmessagebox.h>
#include <tqtdebug.h>
// \defgroup grp_Server All concerning the server component.
/*
\class UiGuiIndentServer
\ingroup grp_Server
\brief UiGuiIndentServer is in such an early state, that even the communication
protocol isn't completely planned. So this class lacks documentation until
I really know where all this will lead to.
The plan however is to have a server that receives commands for selecting an
indenter and perhaps load some by the user predefined indenter config file. Then
the client can send a text to it and will receive it formatted.
The idea behind that is to make UiGUIs use as plugin or whatever more flexible.
So the plugin is developed for Eclipse for example and it takes the client role,
making it possible to use UiGUI from within Eclipse. Choosing a network protocol
makes everything platform and programming language independent, so it doesn't
matter for which application the plugin/client is developed.
*/
UiGuiIndentServer::UiGuiIndentServer(void) :
TQObject()
{
_tcpServer = NULL;
_currentClientConnection = NULL;
_readyForHandleRequest = false;
}
UiGuiIndentServer::~UiGuiIndentServer(void)
{
}
void UiGuiIndentServer::startServer()
{
if (_tcpServer == NULL)
{
_tcpServer = new TQTcpServer(this);
}
if (!_tcpServer->isListening())
{
if (!_tcpServer->listen(TQHostAddress::Any, tquint16(84484)))
{
TQMessageBox::critical(NULL, tr("UiGUI Server"),
tr("Unable to start the server: %1.").arg(_tcpServer->errorString()));
return;
}
}
connect(_tcpServer, TQ_SIGNAL(newConnection()), this, TQ_SLOT(handleNewConnection()));
_readyForHandleRequest = true;
_blockSize = 0;
}
void UiGuiIndentServer::stopServer()
{
if (_tcpServer != NULL)
{
_tcpServer->close();
delete _tcpServer;
_tcpServer = NULL;
}
_currentClientConnection = NULL;
_readyForHandleRequest = false;
}
void UiGuiIndentServer::handleNewConnection()
{
TQTcpSocket *clientConnection = _tcpServer->nextPendingConnection();
connect(clientConnection, TQ_SIGNAL(disconnected()), clientConnection, TQ_SLOT(deleteLater()));
connect(clientConnection, TQ_SIGNAL(readyRead()), this, TQ_SLOT(handleReceivedData()));
}
void UiGuiIndentServer::handleReceivedData()
{
if (!_readyForHandleRequest)
{
return;
}
_currentClientConnection = qobject_cast<TQTcpSocket*>(sender());
TQString receivedData = "";
if (_currentClientConnection != NULL)
{
TQDataStream in(_currentClientConnection);
in.setVersion(TQDataStream::TQt_4_0);
if (_blockSize == 0)
{
if (_currentClientConnection->bytesAvailable() < (int)sizeof(tquint32))
{
return;
}
in >> _blockSize;
}
if (_currentClientConnection->bytesAvailable() < _blockSize)
{
return;
}
TQString receivedMessage;
in >> receivedMessage;
_blockSize = 0;
tqDebug() << "receivedMessage: " << receivedMessage;
if (receivedMessage == "ts")
{
sendMessage("Toll");
}
else
{
sendMessage("irgendwas");
}
}
}
void UiGuiIndentServer::sendMessage(const TQString &message)
{
_readyForHandleRequest = false;
_dataToSend = "";
TQDataStream out(&_dataToSend, TQIODevice::WriteOnly);
out.setVersion(TQDataStream::TQt_4_0);
out << (tquint32)0;
out << message;
out.device()->seek(0);
out << (tquint32)(_dataToSend.size() - sizeof(tquint32));
connect(_currentClientConnection, TQ_SIGNAL(bytesWritten(qint64)), this,
TQ_SLOT(checkIfReadyForHandleRequest()));
_currentClientConnection->write(_dataToSend);
}
void UiGuiIndentServer::checkIfReadyForHandleRequest()
{
if (_currentClientConnection->bytesToWrite() == 0)
{
TQString dataToSendStr = _dataToSend.right(_dataToSend.size() - sizeof(tquint32));
tqDebug() << "checkIfReadyForHandleRequest _dataToSend was: " << dataToSendStr;
disconnect(_currentClientConnection, TQ_SIGNAL(bytesWritten(qint64)), this,
TQ_SLOT(checkIfReadyForHandleRequest()));
_readyForHandleRequest = true;
}
}

@ -1,55 +0,0 @@
/***************************************************************************
* Copyright (C) 2006-2012 by Thomas Schweitzer *
* thomas-schweitzer(at)arcor.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2.0 as *
* published by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program in the file LICENSE.GPL; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef UIGUIINDENTSERVER_H
#define UIGUIINDENTSERVER_H
#include <tqobject.h>
class TQTcpServer;
class TQTcpSocket;
class UiGuiIndentServer : public TQObject
{
TQ_OBJECT
public:
UiGuiIndentServer(void);
~UiGuiIndentServer(void);
public slots:
void startServer();
void stopServer();
private slots:
void handleNewConnection();
void handleReceivedData();
void sendMessage(const TQString &message);
void checkIfReadyForHandleRequest();
private:
TQTcpServer *_tcpServer;
TQByteArray _dataToSend;
bool _readyForHandleRequest;
TQTcpSocket *_currentClientConnection;
TQ_UINT32 _blockSize;
};
#endif // UIGUIINDENTSERVER_H

@ -21,7 +21,6 @@
// -- #include "IndentHandler.h"
#include "SettingsPaths.h"
// -- #include "UiGuiIndentServer.h"
// -- #include "UiGuiIniFileParser.h"
#include "UiGuiVersion.h"
@ -38,21 +37,10 @@
/*!
/brief Entry point to UniversalIndentGUI application.
Evaluates the following parameters:
No parameters starts without server and full gui.
A string without any parameter prefix will be loaded as file on start.
-p --plugin : Run as plugin. Server will be started with a simplified gui.
-s --server : Run as server only, without gui.
If -p and -s are set, -p will be used.
-v --verbose needs a following parameter defining the verbose level as a number from 0 to 3.
*/
int main(int argc, char *argv[])
{
TQString file2OpenOnStart = "";
int verboseLevel = 1;
bool startAsPlugin = false;
bool startAsServer = false;
bool tclapExitExceptionThrown = false;
int returnValue = 0;
@ -61,9 +49,7 @@ int main(int argc, char *argv[])
try
{
// Define the command line object.
TCLAP::CmdLine cmd("If -p and -s are set, -p will be used.\n"
"Giving no parameters starts full gui without server.",
' ', PROGRAM_VERSION_STRING);
TCLAP::CmdLine cmd("Starts full gui", ' ', PROGRAM_VERSION_STRING);
cmd.setExceptionHandling(false);
// Define a value argument and add it to the command line.
@ -71,30 +57,11 @@ int main(int argc, char *argv[])
"Opens the by filename defined file on start" , false, "", "filename");
cmd.add(filenameArg);
// Define a switch and add it to the command line.
TCLAP::SwitchArg pluginSwitch("p", "plugin",
"Run as plugin. Server will be started with a simplified gui", false);
cmd.add(pluginSwitch);
// Define a switch and add it to the command line.
TCLAP::SwitchArg serverSwitch("s", "server",
"Run as server only without gui", false);
cmd.add(serverSwitch);
// Define a value argument and add it to the command line.
TCLAP::ValueArg<int> verboselevelArg("v", "verbose",
"Sets how many info is written to the log. 0 means with debug info, "
"3 means critical messages only" , false, 1, "int");
cmd.add(verboselevelArg);
// Parse the args.
cmd.parse(argc, argv);
// Get the value parsed by each arg.
file2OpenOnStart = filenameArg.getValue().c_str();
startAsPlugin = pluginSwitch.getValue();
startAsServer = serverSwitch.getValue();
verboseLevel = verboselevelArg.getValue();
}
catch (TCLAP::ArgException &e)
{
@ -122,7 +89,6 @@ int main(int argc, char *argv[])
}
TQApplication app(argc, argv);
// -- UiGuiIndentServer server;
MainWindow *mainWindow = NULL;
// -- IndentHandler *indentHandler = NULL;
@ -130,21 +96,8 @@ int main(int argc, char *argv[])
TQTextCodec::setCodecForCStrings(TQTextCodec::codecForName("UTF-8"));
TQTextCodec::setCodecForLocale(TQTextCodec::codecForName("UTF-8"));
// Start normal with full gui and without server.
if (!startAsPlugin && !startAsServer) {
mainWindow = new MainWindow(file2OpenOnStart);
mainWindow->show();
}
// -- // Start as plugin with server.
// -- else if (startAsPlugin) {
// -- server.startServer();
// -- indentHandler = new IndentHandler(0);
// -- indentHandler->show();
// -- }
// -- // Start as server only without any gui.
// -- else if (startAsServer) {
// -- server.startServer();
// -- }
mainWindow = new MainWindow(file2OpenOnStart);
mainWindow->show();
try
{
@ -155,10 +108,7 @@ int main(int argc, char *argv[])
{
tqDebug(TQString() + __LINE__ + " " + __FUNCTION__ + ": Something went terribly wrong: " + ex.what());
}
// --
// -- if (startAsPlugin || startAsServer)
// -- server.stopServer();
// --
// -- delete indentHandler;
delete mainWindow;

Loading…
Cancel
Save