${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_workbench.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_settings.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_actions.h
- ${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_server.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_appearanceoptions.h
${CMAKE_CURRENT_SOURCE_DIR}/saveformastemplate.h
${CMAKE_CURRENT_SOURCE_DIR}/newform.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_formwindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_workbench.cpp
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_settings.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_server.cpp
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_actions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_appearanceoptions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/saveformastemplate.cpp
// designer
#include "qdesigner.h"
#include "qdesigner_actions.h"
-#include "qdesigner_server.h"
#include "qdesigner_settings.h"
#include "qdesigner_workbench.h"
#include "mainwindow.h"
QDesigner::QDesigner(int &argc, char **argv)
: QApplication(argc, argv),
- m_server(0),
- m_client(0),
m_workbench(0), m_suppressNewFormShow(false)
{
setOrganizationName(QLatin1String("Trolltech"));
{
if (m_workbench)
delete m_workbench;
- if (m_server)
- delete m_server;
- if (m_client)
- delete m_client;
}
void QDesigner::showErrorMessage(const char *message)
return m_workbench;
}
-QDesignerServer *QDesigner::server() const
-{
- return m_server;
-}
-
bool QDesigner::parseCommandLineArgs(QStringList &fileNames, QString &resourceDir)
{
const QStringList args = arguments();
break;
}
// Options
- if (argument == QLatin1String("-server")) {
- m_server = new QDesignerServer();
- printf("%d\n", m_server->serverPort());
- fflush(stdout);
- break;
- }
- if (argument == QLatin1String("-client")) {
- bool ok = true;
- if (++it == acend) {
- qWarning("** WARNING The option -client requires an argument");
- return false;
- }
- const quint16 port = it->toUShort(&ok);
- if (ok) {
- m_client = new QDesignerClient(port, this);
- } else {
- qWarning("** WARNING Non-numeric argument specified for -client");
- return false;
- }
- break;
- }
if (argument == QLatin1String("-resourcedir")) {
if (++it == acend) {
qWarning("** WARNING The option -resourcedir requires an argument");
class QDesignerWorkbench;
class QDesignerToolWindow;
class MainWindowBase;
-class QDesignerServer;
-class QDesignerClient;
class QErrorMessage;
class QDesigner: public QApplication
virtual ~QDesigner();
QDesignerWorkbench *workbench() const;
- QDesignerServer *server() const;
MainWindowBase *mainWindow() const;
void setMainWindow(MainWindowBase *tw);
bool parseCommandLineArgs(QStringList &fileNames, QString &resourceDir);
void showErrorMessageBox(const QString &);
- QDesignerServer *m_server;
- QDesignerClient *m_client;
QDesignerWorkbench *m_workbench;
QPointer<MainWindowBase> m_mainWindow;
QPointer<QErrorMessage> m_errorMessageDialog;
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QFileInfo>
-#include <QtCore/QStringList>
-
-#include <QtNetwork/QHostAddress>
-#include <QtNetwork/QTcpServer>
-#include <QtNetwork/QTcpSocket>
-
-#include "qdesigner.h"
-#include "qdesigner_server.h"
-
-#include <qevent.h>
-
-QT_BEGIN_NAMESPACE
-
-// ### review
-
-QDesignerServer::QDesignerServer(QObject *parent)
- : QObject(parent)
-{
- m_socket = 0;
- m_server = new QTcpServer(this);
- m_server->listen(QHostAddress::LocalHost, 0);
- if (m_server->isListening())
- {
- connect(m_server, SIGNAL(newConnection()),
- this, SLOT(handleNewConnection()));
- }
-}
-
-QDesignerServer::~QDesignerServer()
-{
-}
-
-quint16 QDesignerServer::serverPort() const
-{
- return m_server ? m_server->serverPort() : 0;
-}
-
-void QDesignerServer::sendOpenRequest(int port, const QStringList &files)
-{
- QTcpSocket *sSocket = new QTcpSocket();
- sSocket->connectToHost(QHostAddress::LocalHost, port);
- if(sSocket->waitForConnected(3000))
- {
- foreach(const QString &file, files)
- {
- QFileInfo fi(file);
- sSocket->write(fi.absoluteFilePath().toUtf8() + '\n');
- }
- sSocket->waitForBytesWritten(3000);
- sSocket->close();
- }
- delete sSocket;
-}
-
-void QDesignerServer::readFromClient()
-{
- while (m_socket->canReadLine()) {
- QString file = QString::fromUtf8(m_socket->readLine());
- if (!file.isNull()) {
- file.remove(QLatin1Char('\n'));
- file.remove(QLatin1Char('\r'));
- qDesigner->postEvent(qDesigner, new QFileOpenEvent(file));
- }
- }
-}
-
-void QDesignerServer::socketClosed()
-{
- m_socket = 0;
-}
-
-void QDesignerServer::handleNewConnection()
-{
- // no need for more than one connection
- if (m_socket == 0) {
- m_socket = m_server->nextPendingConnection();
- connect(m_socket, SIGNAL(readyRead()),
- this, SLOT(readFromClient()));
- connect(m_socket, SIGNAL(disconnected()),
- this, SLOT(socketClosed()));
- }
-}
-
-
-QDesignerClient::QDesignerClient(quint16 port, QObject *parent)
-: QObject(parent)
-{
- m_socket = new QTcpSocket(this);
- m_socket->connectToHost(QHostAddress::LocalHost, port);
- connect(m_socket, SIGNAL(readyRead()),
- this, SLOT(readFromSocket()));
-
-}
-
-QDesignerClient::~QDesignerClient()
-{
- m_socket->close();
- m_socket->flush();
-}
-
-void QDesignerClient::readFromSocket()
-{
- while (m_socket->canReadLine()) {
- QString file = QString::fromUtf8(m_socket->readLine());
- if (!file.isNull()) {
- file.remove(QLatin1Char('\n'));
- file.remove(QLatin1Char('\r'));
- if (QFile::exists(file))
- qDesigner->postEvent(qDesigner, new QFileOpenEvent(file));
- }
- }
-}
-
-QT_END_NAMESPACE
-#include <moc_qdesigner_server.h>
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDESIGNER_SERVER_H
-#define QDESIGNER_SERVER_H
-
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-class QTcpServer;
-class QTcpSocket;
-
-class QDesignerServer: public QObject
-{
- Q_OBJECT
-public:
- explicit QDesignerServer(QObject *parent = 0);
- virtual ~QDesignerServer();
-
- quint16 serverPort() const;
-
- static void sendOpenRequest(int port, const QStringList &files);
-
-private slots:
- void handleNewConnection();
- void readFromClient();
- void socketClosed();
-
-private:
- QTcpServer *m_server;
- QTcpSocket *m_socket;
-};
-
-class QDesignerClient: public QObject
-{
- Q_OBJECT
-public:
- explicit QDesignerClient(quint16 port, QObject *parent = 0);
- virtual ~QDesignerClient();
-
-private slots:
- void readFromSocket();
-
-private:
- QTcpSocket *m_socket;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDESIGNER_SERVER_H