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()); }
ChatMainWindow() : base() { m_messages = new List <string>(); m_ui = new Ui.ChatMainWindow(); m_ui.SetupUi(this); m_ui.sendButton.Enabled = false; Connect(m_ui.messageLineEdit, SIGNAL("textChanged(QString)"), this, SLOT("TextChangedSlot(QString)")); Connect(m_ui.sendButton,SIGNAL("clicked(bool)"),this,SLOT("SendClickedSlot()")); Connect(m_ui.actionChangeNickname,SIGNAL("triggered(bool)"),this,SLOT("ChangeNickname()")); Connect(m_ui.actionAboutQt,SIGNAL("triggered(bool)"),this,SLOT("AboutQt()")); Connect(qApp,SIGNAL("lastWindowClosed()"),this,SLOT("Exiting()")); // add our D-Bus interface and connect to D-Bus new ChatAdaptor(this); QDBusConnection.SessionBus().RegisterObject("/",this); com.trolltech.chat iface; iface = new com.trolltech.chat("","",QDBusConnection.SessionBus(),this); //Connect(iface, SIGNAL("message(QString,QString)"), this, SLOT("messageSlot(QString,QString)")); QDBusConnection.SessionBus().Connect("","","com.trolltech.chat","message",this,SLOT("MessageSlot(QString,QString)")); Connect(iface,SIGNAL("Action(QString,QString)"),this,SLOT("ActionSlot(QString,QString)")); NicknameDialog dialog = new NicknameDialog(); dialog.m_ui.cancelButton.SetVisible(false); dialog.Exec(); m_nickname = dialog.m_ui.nickname.Text.Trim(); Emit.Action(m_nickname,"joins the chat"); }
public static int Main(string[] args) { new QCoreApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.WriteLine("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return(1); } QDBusInterface iface = new QDBusInterface(SERVICE_NAME, "/", "", QDBusConnection.SessionBus()); if (iface.IsValid()) { QDBusMessage message = iface.Call("ping", args.Length > 0 ? args[0] : ""); QDBusReply <string> reply = new QDBusReply <string>(message); if (reply.IsValid()) { Console.WriteLine("Reply was: {0}", reply.Value()); return(0); } Console.WriteLine("Call failed: {0}\n", reply.Error().Message()); return(1); } Console.WriteLine(QDBusConnection.SessionBus().LastError().Message()); return(1); }
public static int Main(string[] args) { new QApplication(args); QGraphicsScene scene = new QGraphicsScene(); scene.SetSceneRect(-500, -500, 1000, 1000); scene.itemIndexMethod = QGraphicsScene.ItemIndexMethod.NoIndex; Car car = new Car(); scene.AddItem(car); QGraphicsView view = new QGraphicsView(scene); view.SetRenderHint(QPainter.RenderHint.Antialiasing); view.BackgroundBrush = Qt.GlobalColor.darkGray; view.WindowTitle = QT_TRANSLATE_NOOP("QGraphicsView", "Qt DBus Controlled Car"); view.Resize(400, 300); view.Show(); CarAdaptor adaptor = new CarAdaptor(car); QDBusConnection connection = QDBusConnection.SessionBus(); connection.RegisterObject("/Car", adaptor, (int)QDBusConnection.RegisterOption.ExportAllSlots); connection.RegisterService("com.trolltech.CarExample"); return(QApplication.Exec()); }
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 static void Method3() { Console.WriteLine("Method 3:"); foreach (string name in QDBusConnection.SessionBus().Interface().RegisteredServiceNames().Value()) { Console.WriteLine(name); } }
void SendClickedSlot() { //Emit.message(m_nickname, messageLineEdit.text()); QDBusMessage msg = QDBusMessage.CreateSignal("/","com.trolltech.chat","message"); msg.Write(m_nickname).Write(m_ui.messageLineEdit.Text); QDBusConnection.SessionBus().Send(msg); m_ui.messageLineEdit.Text = ""; }
public Controller(QWidget parent) : base(parent) { ui = new Ui.Controller(); ui.SetupUi(this); car = new QDBusInterface("com.trolltech.CarExample", "/Car", "com.trolltech.Examples.CarInterface", QDBusConnection.SessionBus(), this); StartTimer(1000); }
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 static void Method2() { Console.WriteLine("Method 2:"); QDBusConnection bus = QDBusConnection.SessionBus(); QDBusInterface dbus_iface = new QDBusInterface("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", bus); foreach (string name in dbus_iface.Call("ListNames").Arguments()[0].Value <List <string> >()) { Console.WriteLine(name); } }
public static void Method1() { Console.WriteLine("Method 1:"); QDBusReply <List <string> > reply = QDBusConnection.SessionBus().Interface().RegisteredServiceNames(); if (!reply.IsValid()) { Console.WriteLine("Error:{0}", reply.Error().Message()); return; } foreach (string name in reply.Value()) { Console.WriteLine(name); } }
public static int Main(string[] args) { new QApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.Write("Cannot connect to the D-BUS session bus.\n" + "Please check your system settings and try again.\n"); return(1); } ChatMainWindow chat = new ChatMainWindow(); chat.Show(); return(QApplication.Exec()); }
public static int Main(string[] args) { new QCoreApplication(args); if (!QDBusConnection.SessionBus().IsConnected()) { Console.WriteLine("Cannot connect to the D-BUS session bus.\n" + "To start it, run:\n" + "\teval `dbus-launch --auto-syntax`\n"); return(1); } Method1(); Method2(); Method3(); return(0); }
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 chat(string service, string path, QDBusConnection connection, QObject parent) : base(service, path, chat.StaticInterfaceName(), connection, parent) { }
public chat(string service, string path, QDBusConnection connection) : this(service, path, connection, (QObject)null) { }
public chat(string service, string path, QDBusConnection connection) : this(service, path, connection, (QObject) null) { }