-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved TED to QT5.9.2, added modifications from Dawlane
Moved TED to QT5.9.2, added modifications from Dawlane
- Loading branch information
1 parent
2457fc7
commit 5d01c19
Showing
33 changed files
with
1,526 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
cerberusx3b | ||
cerberusx3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "cerberusapplication.h" | ||
|
||
|
||
CerberusApplication::CerberusApplication(int &argc, char **argv) : QApplication(argc, argv) | ||
{ | ||
#ifdef Q_OS_MACX | ||
firstRun=true; | ||
#endif | ||
} | ||
|
||
CerberusApplication::~CerberusApplication() | ||
{ | ||
delete mainWindow; | ||
} | ||
|
||
#ifdef Q_OS_MACX | ||
void CerberusApplication::processFiles() | ||
{ | ||
if(!files.empty()){ | ||
foreach(QString file, files){ | ||
CerberusApplication::mainWindow->openFile(file, true); | ||
} | ||
} | ||
firstRun=false; | ||
} | ||
|
||
// Capture any Mac OS X events. Only interested in the FileOpen event here. | ||
bool CerberusApplication::event(QEvent *event) | ||
{ | ||
if(event->type()==QEvent::FileOpen) | ||
{ | ||
QFileOpenEvent * fileOpenEvent = static_cast<QFileOpenEvent *>(event); | ||
if(fileOpenEvent) | ||
{ | ||
if(firstRun){ | ||
if(fileOpenEvent->file() != "") files.append(fileOpenEvent->file()); | ||
} else { | ||
if(fileOpenEvent->file() != "") mainWindow->openFile(fileOpenEvent->file(), true); | ||
} | ||
} | ||
} | ||
return QApplication::event(event); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef CERBERUSAPPLICATION_H | ||
#define CERBERUSAPPLICATION_H | ||
|
||
#include <QApplication> | ||
#include <QFileOpenEvent> | ||
#include "mainwindow.h" | ||
|
||
class CerberusApplication : public QApplication | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
CerberusApplication(int &argc, char **argv); | ||
~CerberusApplication(); | ||
static MainWindow *mainWindow; | ||
#ifdef Q_OS_MACX | ||
void processFiles(); | ||
private: | ||
QStringList files; | ||
bool firstRun; | ||
bool event(QEvent *event); | ||
#endif | ||
}; | ||
|
||
#endif // CERBERUSAPPLICATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
Class to allow only a single instance of a running version of Ted. | ||
*/ | ||
#include "cerberusguard.h" | ||
|
||
// Connet the classes own QLocalServer to call the newConnection method. | ||
CerberusGuard::CerberusGuard(QObject *parent) : QObject(parent) | ||
{ | ||
connect(&m_server, SIGNAL(newConnection()), this, SLOT(newConnection())); | ||
} | ||
|
||
// Close the lisening server. This will also close the socket. | ||
CerberusGuard::~CerberusGuard() | ||
{ | ||
m_server.close(); | ||
} | ||
|
||
// Stop listening to the old and start lisening to a new connection. | ||
void CerberusGuard::listen(QString name) | ||
{ | ||
m_server.removeServer(name); | ||
m_server.listen(name); | ||
} | ||
|
||
// Create a socket and when the connection is established, buffer the arguments pased | ||
// Before writting them out to the socket. | ||
bool CerberusGuard::hasPrevious(QString name, QStringList arguments) | ||
{ | ||
QLocalSocket socket; | ||
socket.connectToServer(name); | ||
if(socket.waitForConnected()) | ||
{ | ||
QByteArray buffer; | ||
foreach(QString item, arguments) | ||
{ | ||
buffer.append(item+"\n"); | ||
} | ||
socket.write(buffer); | ||
socket.waitForBytesWritten(); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
// Make a new connection and connet the socket to the readyRead method. | ||
void CerberusGuard::newConnection() | ||
{ | ||
emit newInstance(); | ||
m_socket=m_server.nextPendingConnection(); | ||
connect(m_socket, SIGNAL(readyRead()), this, SLOT(readyRead())); | ||
} | ||
|
||
// Make a temporary socket, read and convert the stream passed before passing it to the MainWindow. | ||
void CerberusGuard::readyRead() | ||
{ | ||
QLocalSocket *socket = qobject_cast<QLocalSocket*>(sender()); | ||
QStringList list = QString(socket->readAll()).split("\n"); | ||
CerberusApplication::mainWindow->parseAppArgs(list); | ||
socket->deleteLater(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef CERBERUSGUARD_H | ||
#define CERBERUSGUARD_H | ||
#include <QObject> | ||
#include <QLocalServer> | ||
#include <QLocalSocket> | ||
#include "cerberusapplication.h" | ||
|
||
class CerberusGuard : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit CerberusGuard(QObject *parent = 0); | ||
~CerberusGuard(); | ||
|
||
void listen(QString name); | ||
bool hasPrevious(QString name, QStringList arguments); | ||
signals: | ||
void newInstance(); | ||
public slots: | ||
void newConnection(); | ||
void readyRead(); | ||
private: | ||
QLocalServer m_server; | ||
QLocalSocket *m_socket; | ||
}; | ||
|
||
#endif // CERBERUSGUARD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Paths] | ||
Plugins = plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Paths] | ||
Prefix = ../ |
Oops, something went wrong.