deskflow/src/lib/synergy/ClientApp.h

84 lines
2.6 KiB
C
Raw Normal View History

2012-06-10 16:50:54 +00:00
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Bolton Software Ltd.
* Copyright (C) 2002 Chris Schoeneman
2012-06-10 16:50:54 +00:00
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package 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. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "synergy/App.h"
2012-06-10 16:50:54 +00:00
2014-11-11 13:51:47 +00:00
class Screen;
class Event;
class Client;
class NetworkAddress;
class Thread;
class ClientArgs;
class CryptoOptions;
2012-06-10 16:50:54 +00:00
2014-11-11 13:51:47 +00:00
class ClientApp : public App {
2012-06-10 16:50:54 +00:00
public:
2014-11-11 13:51:47 +00:00
ClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver);
virtual ~ClientApp();
2012-06-10 16:50:54 +00:00
// Parse client specific command line arguments.
void parseArgs(int argc, const char* const* argv);
// Prints help specific to client.
void help();
// Returns arguments that are common and for client.
2014-11-11 13:51:47 +00:00
ClientArgs& args() const { return (ClientArgs&)argsBase(); }
2012-06-10 16:50:54 +00:00
const char* daemonName() const;
const char* daemonInfo() const;
// TODO: move to server only (not supported on client)
void loadConfig() { }
2014-11-11 13:51:47 +00:00
bool loadConfig(const String& pathname) { return false; }
2012-06-10 16:50:54 +00:00
int foregroundStartup(int argc, char** argv);
int standardStartup(int argc, char** argv);
int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup);
2014-11-11 13:51:47 +00:00
Screen* createScreen();
2012-06-10 16:50:54 +00:00
void updateStatus();
2014-11-11 13:51:47 +00:00
void updateStatus(const String& msg);
2012-06-10 16:50:54 +00:00
void resetRestartTimeout();
double nextRestartTimeout();
2014-11-11 13:51:47 +00:00
void handleScreenError(const Event&, void*);
Screen* openClientScreen();
void closeClientScreen(Screen* screen);
void handleClientRestart(const Event&, void* vtimer);
2012-06-10 16:50:54 +00:00
void scheduleClientRestart(double retryTime);
2014-11-11 13:51:47 +00:00
void handleClientConnected(const Event&, void*);
void handleClientFailed(const Event& e, void*);
void handleClientDisconnected(const Event&, void*);
Client* openClient(const String& name, const NetworkAddress& address, Screen* screen, const CryptoOptions& crypto);
void closeClient(Client* client);
2012-06-10 16:50:54 +00:00
bool startClient();
void stopClient();
int mainLoop();
void startNode();
2014-11-11 13:51:47 +00:00
static ClientApp& instance() { return (ClientApp&)App::instance(); }
2012-06-10 16:50:54 +00:00
2014-11-11 13:51:47 +00:00
Client* getClientPtr() { return m_client; }
2012-06-10 16:50:54 +00:00
private:
2014-11-11 13:51:47 +00:00
Client* m_client;
Screen* m_clientScreen;
NetworkAddress* m_serverAddress;
2012-06-10 16:50:54 +00:00
};