| 62 | } |
| 63 | |
| 64 | Application::Application() |
| 65 | : m_expectedResponse(0) |
| 66 | , m_preventDisconnect(false) |
| 67 | , m_callbacksInvoked(false) |
| 68 | , m_requiresMainEventLoop(true) |
| 69 | , m_settingsApplied(false) |
| 70 | , m_generalTimeout(10000) |
| 71 | , m_idleDuration(0) |
| 72 | , m_idleTimeout(0) |
| 73 | , m_argsRead(false) |
| 74 | { |
| 75 | // take ownership over the global QNetworkAccessManager |
| 76 | networkAccessManager().setParent(this); |
| 77 | |
| 78 | // setup callbacks |
| 79 | m_args.parser.setExitFunction(&exitApplication); |
| 80 | m_args.status.setCallback(bind(&Application::printStatus, this, _1)); |
| 81 | m_args.log.setCallback(bind(&Application::requestLog, this, _1)); |
| 82 | m_args.stop.setCallback(bind(&Application::requestShutdown, this, _1)); |
| 83 | m_args.restart.setCallback(bind(&Application::requestRestart, this, _1)); |
| 84 | m_args.rescan.setCallback(bind(&Application::requestRescan, this, _1)); |
| 85 | m_args.rescanAll.setCallback(bind(&Application::requestRescanAll, this, _1)); |
| 86 | m_args.pause.setCallback(bind(&Application::requestPauseResume, this, true)); |
| 87 | m_args.resume.setCallback(bind(&Application::requestPauseResume, this, false)); |
| 88 | m_args.waitForIdle.setCallback(bind(&Application::waitForIdle, this, _1)); |
| 89 | m_args.pwd.setCallback(bind(&Application::checkPwdOperationPresent, this, _1)); |
| 90 | m_args.cat.setCallback(bind(&Application::printConfig, this, _1)); |
| 91 | m_args.edit.setCallback(bind(&Application::editConfig, this, _1)); |
| 92 | m_args.statusPwd.setCallback(bind(&Application::printPwdStatus, this, _1)); |
| 93 | m_args.rescanPwd.setCallback(bind(&Application::requestRescanPwd, this, _1)); |
| 94 | m_args.pausePwd.setCallback(bind(&Application::requestPausePwd, this, _1)); |
| 95 | m_args.resumePwd.setCallback(bind(&Application::requestResumePwd, this, _1)); |
| 96 | m_args.dir.setCallback(bind(&Application::initDirCompletion, this, ref(m_args.dir), _1)); |
| 97 | m_args.dev.setCallback(bind(&Application::initDevCompletion, this, ref(m_args.dev), _1)); |
| 98 | |
| 99 | // connect signals and slots |
| 100 | connect(&m_connection, &SyncthingConnection::newConfig, this, &Application::invalidateDirsAndDevs); |
| 101 | connect(&m_connection, &SyncthingConnection::statusChanged, this, &Application::handleStatusChanged); |
| 102 | connect(&m_connection, &SyncthingConnection::error, this, &Application::handleError); |
| 103 | } |
| 104 | |
| 105 | Application::~Application() |
| 106 | { |
nothing calls this directly
no outgoing calls
no test coverage detected