X-Git-Url: https://www.flypig.org.uk/git/?p=openvpnui.git;a=blobdiff_plain;f=src%2Fvpncontrol.cpp;fp=src%2Fvpncontrol.cpp;h=3383dccfeb2215e9f9084e96d1f6d64883b701cb;hp=12ca3f1961922f74b7f26b9287cb4845188c7f31;hb=c45d410d3b300c1e37398e8c6c2bd453ee3da696;hpb=7a870818f95f0dd0ced94643aac1bbae6f68b2fd diff --git a/src/vpncontrol.cpp b/src/vpncontrol.cpp index 12ca3f1..3383dcc 100644 --- a/src/vpncontrol.cpp +++ b/src/vpncontrol.cpp @@ -230,6 +230,16 @@ void VPNControl::collectArguments () { arguments.clear(); addArgumentNonempty("config", configFile); + addOption("client", true); + addOption("persist-key", true); + addOption("persist-tun", true); + addOption("nobind", true); + addArgument("resolv-retry", "infinite"); + addArgument("dev", "tun"); + addArgument("verb", "3"); + addArgument("proto", "udp"); + addArgument("user", "nemo"); + addArgument("group", "nemo"); addArgumentNonempty("remote", server); addArgumentNonempty("port", QString::number(port)); addOption("comp-lzo", compressed); @@ -335,22 +345,27 @@ void VPNControl::updateConfiguration() void VPNControl::logAppend(const QString &text) { if (!text.isEmpty()) { + QString append = text; + // Ensure we end with a newline + if (!append.endsWith('\n')) { + append += '\n'; + } // How many lines to add - int newLines = text.count('\n'); + int newLines = append.count('\n'); int currentLines = logText.count('\n'); - int removeLines = currentLines + newLines - 18; - - // Remove excess lines -// while (removeLines > 0) { -// int nextLine = logText.indexOf('\n'); -// if (nextLine > 0) { -// logText = logText.right(nextLine); -// } -// removeLines--; -// } + int removeLines = currentLines + newLines - 24; + + // Remove excess lines from the top + while (removeLines > 0) { + int nextLine = logText.indexOf('\n'); + if (nextLine > 0) { + logText = logText.mid(nextLine + 1); + } + removeLines--; + } // Add new lines - logText.append(text); + logText.append(append); emit logTextChanged(logText); } }