public void GlobalCleanup() { _qObject.Dispose(); QCoreApplication.ProcessEvents(QEventLoop.ProcessEventsFlag.AllEvents); _qmlApplicationEngine.Dispose(); _guiApplication.Dispose(); }
public static int Main(string[] args) { QCoreApplication app = new QCoreApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.Write("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return(1); } if (!QDBusConnection.SessionBus().RegisterService(SERVICE_NAME)) { Console.WriteLine(QDBusConnection.SessionBus().LastError().Message()); return(1); } Pong pong = new Pong(); Connect(app, SIGNAL("aboutToQuit()"), pong, SLOT("Terminator()")); QDBusConnection.SessionBus().RegisterObject("/",pong,(int)QDBusConnection.RegisterOption.ExportAllSlots); return(QCoreApplication.Exec()); }
public void TestAvoidJumpAtStartWithRunning() { using (var anim = new TestableQAbstractAnimation()) { anim.SetDuration(2000); using (var anim2 = new TestableQAbstractAnimation()) { anim2.SetDuration(1000); using (var anim3 = new TestableQAbstractAnimation()) { anim3.SetDuration(1000); anim.Start(); System.Threading.Thread.Sleep(300); anim2.Start(); System.Threading.Thread.Sleep(300); anim3.Start(); QCoreApplication.ProcessEvents(); Assert.Less(anim2.CurrentTime, 50); Assert.Less(anim3.CurrentTime, 50); } } } }
public override void Dispose() { // FIXME: This isn't enough... so we have to resort to more drastic measures below. // Likely Qyoto bug. QCoreApplication.Quit(); System.Diagnostics.Process.GetCurrentProcess().Kill(); }
public static int Main(string[] args) { QCoreApplication app = new QCoreApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.Error.WriteLine("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return(1); } Ping ping = new Ping(); ping.Connect(QDBusConnection.SessionBus().Interface(), SIGNAL("serviceOwnerChanged(QString,QString,QString)"), SLOT("Start(QString,QString,QString)")); // start the process manually - doesn't work this way.. // QProcess pong = new QProcess(qApp); // pong.Start("mono ./complexpong.exe"); // pong.WaitForStarted(); return(QCoreApplication.Exec()); }
public void Start(string name, string oldValue, string newValue) { if (name != SERVICE_NAME || newValue == "") { return; } // find our remote iface = new QDBusInterface(SERVICE_NAME, "/", "com.trolltech.QtDBus.ComplexPong.Pong", QDBusConnection.SessionBus(), this); if (!iface.IsValid()) { Console.Error.WriteLine(QDBusConnection.SessionBus().LastError().Message()); QCoreApplication.Quit(); } Connect(iface, SIGNAL("aboutToQuit()"), QCoreApplication.Instance(), SLOT("quit()")); while (true) { Console.Write("Ask your question: "); string line = Console.ReadLine().Trim(); if (line == "") { iface.Call("quit"); return; } else if (line == "value") { QVariant reply = iface.Property("value"); if (!reply.IsNull()) { Console.WriteLine("value = {0}",reply.ToString()); } } else if (line.StartsWith("value=")) { iface.SetProperty("value",new QVariant(line.Substring(6))); } else { QDBusReply <string> reply = new QDBusReply <string>(iface.Call("query",new QVariant(line))); if (reply.IsValid()) { Console.WriteLine("Reply was: {0}",reply.Value()); } } if (iface.LastError().IsValid()) { Console.Error.WriteLine("Call failed: {0}",iface.LastError().Message()); } } }
public void TestAboutToQuit() { var wasFired = false; _qCoreApp.AboutToQuit += () => wasFired = true; QCoreApplication.Quit(); Assert.IsTrue(wasFired); }
private static int Main(string[] qmlNetArgs) { return(Host.Run(qmlNetArgs, (_, application, _, runCallback) => { Application = application; Qml.Net.Qml.RegisterType <Room>("Room"); return runCallback(); })); }
public void TestAvoidJumpAtStart() { var anim = new TestableQAbstractAnimation(); anim.SetDuration(1000); anim.Start(); System.Threading.Thread.Sleep(300); QCoreApplication.ProcessEvents(); Assert.Less(anim.CurrentTime, 50); }
void HandleUnhandledException(object sender, UnhandledExceptionEventArgs args) { Exception ex = (Exception)args.ExceptionObject; Console.Error.WriteLine("UNHANDLED EXCEPTION: " + ex); string desktopPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); string crashFileName = Path.Combine(desktopPath, String.Format("synapse-crash-{0}.log", DateTime.Now.ToFileTime())); string crashLog = args.ExceptionObject.ToString(); Util.WriteToFile(crashFileName, crashLog); // FIXME: Figure out how to show a damn error dialog. QCoreApplication.Quit(); }
public unsafe static QCoreApplication CreateQCoreApplicationInstance(string[] args) { var argv = GenerateQtArgv(args); var argc = argv.Count(); var arguments = argv.Aggregate("", (current, arg) => current + (arg + "\0")); var stringPointer = (char *)Marshal.StringToHGlobalAuto(arguments).ToPointer(); var app = new QCoreApplication(&argc, null); //var app = new QCoreApplication(&argc, &stringPointer); Marshal.FreeHGlobal(new IntPtr(stringPointer)); return(app); }
public static int Main(string[] args) { QCoreApplication app = new QCoreApplication(args); QObject obj = new QObject(); Pong pong = new Pong(obj); pong.Connect(app,SIGNAL("aboutToQuit()"),SIGNAL("aboutToQuit()")); pong.value = "initial value"; QDBusConnection.SessionBus().RegisterObject("/",obj); if (!QDBusConnection.SessionBus().RegisterService(SERVICE_NAME)) { Console.Error.WriteLine(QDBusConnection.SessionBus().LastError().Message()); return(1); } return(QCoreApplication.Exec()); }
public static int Run() { RuntimeManager.DiscoverOrDownloadSuitableQtRuntime(); QQuickStyle.SetStyle("Material"); QCoreApplication.SetAttribute(ApplicationAttribute.EnableHighDpiScaling, true); using var app = new QGuiApplication(); using var engine = new QQmlApplicationEngine(); Qml.Net.Qml.RegisterType <SettingsModel>("Aris.Moe.OverlayTranslate.Gui.Qt5", 1, 1); Qml.Net.Qml.RegisterType <ControlsModel>("Aris.Moe.OverlayTranslate.Gui.Qt5", 1, 1); engine.Load("Main.qml"); return(app.Exec()); }
public unsafe void TestDeleteLater() { var argc = 0; string[] argv = new string[argc + 1]; var a = Assembly.GetEntryAssembly(); if (a == null) { a = Assembly.GetExecutingAssembly(); } var attrs = a.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attrs.Length > 0) { argv[0] = ((AssemblyTitleAttribute)attrs[0]).Title; } else { QFileInfo info = new QFileInfo(a.Location); argv[0] = info.BaseName; } var p = Marshal.StringToHGlobalAuto(argv[0]); var k = (char *)p; var core = new QCoreApplication(ref argc, &k); _qObject.DeleteLater(); Assert.IsNotNull(_qObject); QCoreApplication.Exec(); Assert.IsNull(_qObject); }
public static BootstrapperBuilder SetAttribute(this BootstrapperBuilder builder, ApplicationAttribute attribute) { QCoreApplication.SetAttribute(attribute, true); return(builder); }
public void TestFinished() { QCoreApplication.Exit(); }
public void Dispose() { // TODO: Add tear down code. QCoreApplication.Quit(); }
public void quit() { QTimer.singleShot(0, QCoreApplication.Instance(), SLOT("quit()")); }
public static void Setup() { QCoreApplication.SetAttribute(ApplicationAttribute.EnableHighDpiScaling, true); QQuickStyle.SetStyle("Material"); }
public string ping(string arg) { QMetaObject.InvokeMethod(QCoreApplication.Instance(), "quit"); return("ping(\"" + arg + "\") got called"); }
public void Init() { // TODO: Add Init code. _qCoreApp = Helper.CreateQCoreApplicationInstance(new[] { "" }); }