Exemplo n.º 1
1
        public TrayIcon(QObject parent)
            : base(parent)
        {
            m_ShowMainWindowAction = new QAction("Show Synapse", this);
            m_ShowMainWindowAction.Checkable = true;
            QObject.Connect(m_ShowMainWindowAction, Qt.SIGNAL("triggered()"), HandleShowMainWindowActionTriggered);

            m_ShowDebugWindowAction = new QAction("Debug Window", this);
            m_ShowDebugWindowAction.Checkable = true;
            QObject.Connect(m_ShowDebugWindowAction, Qt.SIGNAL("triggered()"), HandleShowDebugWindowActionTriggered);

            m_Menu = new QMenu();
            m_Menu.AddAction(m_ShowMainWindowAction);
            m_Menu.AddAction(m_ShowDebugWindowAction);
            m_Menu.AddSeparator();
            m_Menu.AddAction(Gui.GlobalActions.NewMessageAction);
            m_Menu.AddAction(Gui.GlobalActions.JoinConferenceAction);
            m_Menu.AddAction(Gui.GlobalActions.ShowBrowserAction);
            m_Menu.AddAction(Gui.GlobalActions.EditProfileAction);
            m_Menu.AddAction(Gui.GlobalActions.ChangeStatusAction);
            m_Menu.AddSeparator();
            m_Menu.AddAction(Gui.GlobalActions.ShowPreferencesAction);
            m_Menu.AddSeparator();
            m_Menu.AddAction(Gui.GlobalActions.AboutAction);
            m_Menu.AddAction(Gui.GlobalActions.SendFeedbackAction);
            m_Menu.AddSeparator();
            m_Menu.AddAction(Gui.GlobalActions.QuitAction);
            QObject.Connect(m_Menu, Qt.SIGNAL("aboutToShow()"), HandleMenuAboutToShow);

            QPixmap pixmap = new QPixmap("resource:/octy-22.png");
            QIcon icon = new QIcon(pixmap);
            m_Icon = new QSystemTrayIcon(icon);
            m_Icon.SetContextMenu(m_Menu);

            QObject.Connect<QSystemTrayIcon.ActivationReason>(m_Icon, Qt.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), HandleTrayActivated);
        }
Exemplo n.º 2
0
Arquivo: p3.cs Projeto: KDE/kimono
    public MainWindow(string name)
        : base((QWidget) null)
    {
        ObjectName = name;
        SetCaption("KDE Tutorial - p3");

        QMenu filemenu = new QMenu(KDE.I18n("&File"), this);
        filemenu.AddAction(KDE.I18n("&Open"), this, SLOT("FileOpen()"));
        filemenu.AddAction(KDE.I18n("&Save"), this, SLOT("FileSave()"));
        filemenu.AddAction(KDE.I18n("&Quit"), KApplication.kApplication(), SLOT("quit()"));

        string about = KDE.I18n("p3 1.0\n\n" +
                 "(C) 1999-2002 Antonio Larrosa Jimenez\n" +
                 "[email protected]\t\[email protected]\n" +
                 "Malaga (Spain)\n\n" +
                 "Simple KDE Tutorial\n" +
                 "This tutorial comes with ABSOLUTELY NO WARRANTY\n" +
                 "This is free software, and you are welcome to redistribute it\n" +
                 "under certain conditions\n");
        QMenu helpmenu = HelpMenu(about);

        KMenuBar menu = MenuBar();
        menu.AddMenu(filemenu);
        menu.AddSeparator();
        menu.AddMenu(helpmenu);

        QTextEdit hello = new QTextEdit(
        KDE.I18n("<H2>Hello World !</H2><BR>This is a simple" +
            " window with <I><font size=5><B>R<font color=red" +
            " size=5>ich </font><font color=blue size=5>Text" +
            "</font></B></I> capabilities<BR>Try to resize" +
            " this window, all this is automatic !"), this);
        SetCentralWidget(hello);
    }
Exemplo n.º 3
0
        public MainWindow()
        {
            SetupUi();
            base.WindowFlags = (uint)Qt.WindowType.FramelessWindowHint;

            closeButton.icon = new QIcon(new QPixmap("resource:/stock-close_12.png"));
            menuButton.icon = new QIcon(new QPixmap("resource:/menu-icon.png"));

            // FIXME: Add a global "Application Icon" somewhere that contains multiple sizes.
            QPixmap pixmap = new QPixmap("resource:/octy-22.png");
            base.WindowIcon = new QIcon(pixmap);

            m_NoAccountsStyleSheet = Util.ReadResource("mainwindow-noaccounts.qss");
            m_StyleSheet = Util.ReadResource("mainwindow.qss");

            containerWidget.SetStyleSheet(m_StyleSheet);

            QVBoxLayout layout = new QVBoxLayout();
            layout.SetContentsMargins(0, 0, 0, 0);
            contentWidget.SetLayout(layout);

            m_RosterWidget = new RosterWidget(contentWidget);
            contentWidget.Layout().AddWidget(m_RosterWidget);

            m_NoAccountsWidget = new NoAccountsWidget(contentWidget);
            contentWidget.Layout().AddWidget(m_NoAccountsWidget);

            // This makes the shortcut work.
            base.AddAction(Gui.GlobalActions.QuitAction);

            m_MainMenu = new QMenu(this);
            m_MainMenu.AddAction(Gui.GlobalActions.NewMessageAction);
            m_MainMenu.AddAction(Gui.GlobalActions.JoinConferenceAction);
            m_MainMenu.AddAction(Gui.GlobalActions.ShowBrowserAction);
            m_MainMenu.AddAction(Gui.GlobalActions.EditProfileAction);
            m_MainMenu.AddAction(Gui.GlobalActions.ChangeStatusAction);
            m_MainMenu.AddSeparator();
            m_MainMenu.AddAction(Gui.GlobalActions.ShowPreferencesAction);
            m_MainMenu.AddSeparator();
            m_MainMenu.AddAction(Gui.GlobalActions.AboutAction);
            m_MainMenu.AddAction(Gui.GlobalActions.SendFeedbackAction);
            m_MainMenu.AddSeparator();
            m_MainMenu.AddAction(Gui.GlobalActions.QuitAction);

            Gui.CenterWidgetOnScreen(this);

            headerLabel.InstallEventFilter(new WindowMover(this));

            AccountService accountService = ServiceManager.Get<AccountService>();
            accountService.AccountAdded   += AddAccount;
            accountService.AccountRemoved += RemoveAccount;

            foreach (Account account in accountService.Accounts) {
                AddAccount(account);
            }
        }
Exemplo n.º 4
0
Arquivo: p5.cs Projeto: KDE/kimono
    public MainWindow(string name)
        : base((QWidget) null)
    {
        ObjectName = name;
        SetCaption("KDE Tutorial - p5");

        QMenu filemenu = new QMenu(KDE.I18n("&File"), this);
        filemenu.AddAction(KDE.I18n("&Quit"), KApplication.kApplication(), SLOT("quit()"));

        string about = KDE.I18n("p5 1.0\n\n" +
                 "(C) 1999-2002 Antonio Larrosa Jimenez\n" +
                 "[email protected]\t\[email protected]\n" +
                 "Malaga (Spain)\n\n" +
                 "Simple KDE Tutorial\n" +
                 "This tutorial comes with ABSOLUTELY NO WARRANTY\n" +
                 "This is free software, and you are welcome to redistribute it\n" +
                 "under certain conditions\n");
        QMenu helpmenu = HelpMenu(about);

        KMenuBar menu = MenuBar();
        menu.AddMenu(filemenu);
        menu.AddSeparator();
        menu.AddMenu(helpmenu);

        location = new QLineEdit();
        location.Text = "http://localhost";

        Connect( location , SIGNAL("returnPressed()"),
                    this, SLOT("changeLocation()") );

        QSplitter split = new QSplitter();
        split.OpaqueResize = true;

        QWidget widget = new QWidget(this);

        QVBoxLayout vbox = new QVBoxLayout(widget);
        vbox.AddWidget(location);
        vbox.AddWidget(split);

        QPushButton bookmark = new QPushButton(KDE.I18n("Add to Bookmarks"), split);

        Connect(bookmark, SIGNAL("clicked()"), this, SLOT("BookLocation()"));

        browser = new KHTMLPart(split);
        browser.OpenUrl(new KUrl(location.Text));

        Connect( browser.BrowserExtension(),
                 SIGNAL("openUrlRequest(KUrl, KParts::OpenUrlArguments)"),
                 this, SLOT("OpenUrlRequest(KUrl, KParts::OpenUrlArguments)") );

        SetCentralWidget(widget);
    }
Exemplo n.º 5
0
 public void SetButtonMenu(KDialog.ButtonCode id, QMenu menu)
 {
     interceptor.Invoke("setButtonMenu$#", "setButtonMenu(KDialog::ButtonCode, QMenu*)", typeof(void), typeof(KDialog.ButtonCode), id, typeof(QMenu), menu);
 }
Exemplo n.º 6
0
 /// <remarks>
 ///  Sets the menu of any button.
 /// <param> name="id" The button identifier.
 /// </param><param> name="menu" The menu.
 /// </param><param> name="popupmode" Choose if KPushButton setMenu or setDelayedMenu is used
 ///      </param></remarks>        <short>    Sets the menu of any button.</short>
 public void SetButtonMenu(KDialog.ButtonCode id, QMenu menu, KDialog.ButtonPopupMode popupmode)
 {
     interceptor.Invoke("setButtonMenu$#$", "setButtonMenu(KDialog::ButtonCode, QMenu*, KDialog::ButtonPopupMode)", typeof(void), typeof(KDialog.ButtonCode), id, typeof(QMenu), menu, typeof(KDialog.ButtonPopupMode), popupmode);
 }
Exemplo n.º 7
0
        internal ChatWindow(IChatHandler handler)
        {
            if (handler == null)
                throw new ArgumentNullException("handler");
            m_Handler = handler;

            SetupUi();

            if (handler is MucHandler) {
                m_ParticipantsMenu = new QMenu(this);
                QObject.Connect(m_ParticipantsMenu, Qt.SIGNAL("aboutToShow()"), HandleMenuAboutToShow);
                QObject.Connect(m_ParticipantsMenu, Qt.SIGNAL("aboutToHide()"), HandleMenuAboutToHide);

                var mucHandler = (MucHandler)handler;
                participantsGrid.Model = mucHandler.GridModel;
                participantsGrid.ContextMenuPolicy = Qt.ContextMenuPolicy.CustomContextMenu;
                participantsGrid.ItemActivated += HandleItemActivated;

                var group = new QActionGroup(this);

                var gridModeAction = new QAction("View as Grid", this);
                QObject.Connect(gridModeAction, Qt.SIGNAL("triggered()"), HandleGridModeActionTriggered);
                gridModeAction.SetActionGroup(group);
                gridModeAction.Checkable = true;
                gridModeAction.Checked = true;
                m_ParticipantsMenu.AddAction(gridModeAction);

                var listModeAction = new QAction("View as List", this);
                QObject.Connect(listModeAction, Qt.SIGNAL("triggered()"), HandleListModeActionTriggered);
                listModeAction.SetActionGroup(group);
                listModeAction.Checkable = true;
                m_ParticipantsMenu.AddAction(listModeAction);

                var separatorAction = new QAction(participantsGrid);
                separatorAction.SetSeparator(true);
                m_ParticipantsMenu.AddAction(separatorAction);

                var sliderAction = new AvatarGridZoomAction<jabber.connection.RoomParticipant>(participantsGrid);
                m_ParticipantsMenu.AddAction(sliderAction);

                m_ParticipantItemMenu = new QMenu(this);
                QObject.Connect(m_ParticipantItemMenu, Qt.SIGNAL("aboutToShow()"), HandleMenuAboutToShow);
                QObject.Connect(m_ParticipantItemMenu, Qt.SIGNAL("aboutToHide()"), HandleMenuAboutToHide);

                var mucViewProfileAction = new QAction("View Profile", this);
                QObject.Connect(mucViewProfileAction, Qt.SIGNAL("triggered()"), HandleMucViewProfileActionTriggered);
                m_ParticipantItemMenu.AddAction(mucViewProfileAction);

                var mucPrivateMessageAction = new QAction("IM", this);
                QObject.Connect(mucPrivateMessageAction, Qt.SIGNAL("triggered()"), HandleMucPrivateMessageTriggered);
                m_ParticipantItemMenu.AddAction(mucPrivateMessageAction);

                var mucSendFileAction = new QAction("Send File...", this);
                QObject.Connect(mucSendFileAction, Qt.SIGNAL("triggered()"), HandleMucSendFileActionTriggered);
                m_ParticipantItemMenu.AddAction(mucSendFileAction);

                var mucViewHistoryAction = new QAction("View History", this);
                QObject.Connect(mucViewHistoryAction, Qt.SIGNAL("triggered()"), HandleMucViewHistoryActionTriggered);
                m_ParticipantItemMenu.AddAction(mucViewHistoryAction);

                m_ModeratorActionsMenu = new QMenu("Moderator Actions", this);

                var roomRoleActionGroup = new QActionGroup(this);
                QObject.Connect(roomRoleActionGroup, Qt.SIGNAL("triggered(QAction*)"), this, Qt.SLOT("HandleRoomRoleActionGroupTriggered(QAction*)"));

                m_ModeratorAction = new QAction("Moderator", this);
                roomRoleActionGroup.AddAction(m_ModeratorAction);
                m_ModeratorAction.Checkable = true;
                m_ModeratorActionsMenu.AddAction(m_ModeratorAction);

                m_ParticipantAction = new QAction("Participant", this);
                roomRoleActionGroup.AddAction(m_ParticipantAction);
                m_ParticipantAction.Checkable = true;
                m_ModeratorActionsMenu.AddAction(m_ParticipantAction);

                m_VisitorAction = new QAction("Visitor", this);
                roomRoleActionGroup.AddAction(m_VisitorAction);
                m_VisitorAction.Checkable = true;
                m_ModeratorActionsMenu.AddAction(m_VisitorAction);

                m_ModeratorActionsMenu.AddSeparator();

                var mucKickAction = new QAction("Kick...", this);
                QObject.Connect(mucKickAction, Qt.SIGNAL("triggered()"), HandleMucKickActionTriggered);
                m_ModeratorActionsMenu.AddAction(mucKickAction);

                var mucBanAction = new QAction("Ban...", this);
                QObject.Connect(mucBanAction, Qt.SIGNAL("triggered()"), HandleMucBanActionTriggered);
                m_ModeratorActionsMenu.AddAction(mucBanAction);

                m_ModeratorActionsMenu.AddSeparator();

                m_ChangeAffiliationAction = new QAction("Change Affiliation...", this);
                QObject.Connect(m_ChangeAffiliationAction, Qt.SIGNAL("triggered()"), HandleChangeAffiliationTriggered);
                m_ModeratorActionsMenu.AddAction(m_ChangeAffiliationAction);

                m_ParticipantItemMenu.AddSeparator();
                m_ParticipantItemMenu.AddMenu(m_ModeratorActionsMenu);

                m_ParticipantItemMenu.AddSeparator();

                m_AddAsFriendAction = new QAction("Add as Friend", this);
                m_ParticipantItemMenu.AddAction(m_AddAsFriendAction);

                this.WindowTitle = mucHandler.Room.JID.User; // FIXME: Show only "user" in tab, show full room jid in title?
                this.WindowIcon = Gui.LoadIcon("internet-group-chat");
            } else {
                var chatHandler = (ChatHandler)handler;
                rightContainer.Hide();

                if (((ChatHandler)handler).IsMucMessage) {
                    this.WindowTitle = chatHandler.Jid.Resource;
                } else {
                    this.WindowTitle = chatHandler.Account.GetDisplayName(chatHandler.Jid);
                }
                this.WindowIcon = new QIcon((QPixmap)Synapse.Xmpp.AvatarManager.GetAvatar(chatHandler.Jid));
            }

            m_ConversationWidget.ChatHandler = handler;

            handler.ReadyChanged += HandleReadyChanged;

            splitter.SetStretchFactor(1, 0);
            splitter_2.SetStretchFactor(1, 0);

            KeyPressEater eater = new KeyPressEater(this);
            eater.KeyEvent += HandleKeyEvent;
            textEdit.InstallEventFilter(eater);

            QToolBar toolbar = new QToolBar(this);
            toolbar.IconSize = new QSize(16, 16);

            var formatMenuButton = new QToolButton(this);

            var formatMenu = new QMenu(this);
            QObject.Connect<QAction>(formatMenu, Qt.SIGNAL("triggered(QAction*)"), HandleFormatMenuActionTriggered);
            formatMenuButton.ToolButtonStyle = ToolButtonStyle.ToolButtonTextBesideIcon;
            formatMenuButton.Text = "Format";
            formatMenuButton.icon = Gui.LoadIcon("fonts", 16);
            formatMenuButton.PopupMode = QToolButton.ToolButtonPopupMode.InstantPopup;
            formatMenuButton.SetMenu(formatMenu);
            toolbar.AddWidget(formatMenuButton);

            m_BoldAction = new QAction(Gui.LoadIcon("format-text-bold", 16), "Bold", this);
            m_BoldAction.Shortcut = "Ctrl+B";
            m_BoldAction.Checkable = true;
            formatMenu.AddAction(m_BoldAction);

            m_ItalicAction = new QAction(Gui.LoadIcon("format-text-italic", 16), "Italic", this);
            m_ItalicAction.Shortcut = "Ctrl+I";
            m_ItalicAction.Checkable = true;
            formatMenu.AddAction(m_ItalicAction);

            m_UnderlineAction = new QAction(Gui.LoadIcon("format-text-underline", 16), "Underline", this);
            m_UnderlineAction.Shortcut = "Ctrl+U";
            m_UnderlineAction.Checkable = true;
            formatMenu.AddAction(m_UnderlineAction);

            m_StrikethroughAction = new QAction(Gui.LoadIcon("format-text-strikethrough", 16), "Strikethrough", this);
            m_StrikethroughAction.Shortcut = "Ctrl+S";
            m_StrikethroughAction.Checkable = true;
            formatMenu.AddAction(m_StrikethroughAction);

            formatMenu.AddSeparator();

            m_ClearFormattingAction = new QAction(Gui.LoadIcon("edit-clear", 16), "Clear Formatting", this);
            formatMenu.AddAction(m_ClearFormattingAction);

            var insertMenu = new QMenu(this);
            var insertMenuButton = new QToolButton(this);
            insertMenuButton.ToolButtonStyle = ToolButtonStyle.ToolButtonTextBesideIcon;
            insertMenuButton.Text = "Insert";
            insertMenuButton.icon = Gui.LoadIcon("image", 16);
            insertMenuButton.PopupMode = QToolButton.ToolButtonPopupMode.InstantPopup;
            insertMenuButton.SetMenu(insertMenu);
            toolbar.AddWidget(insertMenuButton);

            m_InsertPhotoAction = new QAction(Gui.LoadIcon("insert-image", 16), "Photo...", this);
            QObject.Connect(m_InsertPhotoAction, Qt.SIGNAL("triggered()"), HandleInsertImageActionTriggered);
            insertMenu.AddAction(m_InsertPhotoAction);

            m_InsertLinkAction = new QAction(Gui.LoadIcon("insert-link", 16), "Link...", this);
            QObject.Connect(m_InsertLinkAction, Qt.SIGNAL("triggered()"), HandleInsertLinkActionTriggered);
            insertMenu.AddAction(m_InsertLinkAction);

            foreach (IActionCodon node in AddinManager.GetExtensionNodes("/Synapse/QtClient/ChatWindow/InsertActions")) {
                insertMenu.AddAction((QAction)node.CreateInstance(this));
            }

            toolbar.AddSeparator();

            var activitiesMenu = new QMenu(this);
            var activitiesMenuButton = new QToolButton(this);
            activitiesMenuButton.ToolButtonStyle = ToolButtonStyle.ToolButtonTextBesideIcon;
            activitiesMenuButton.Text = "Activities";
            activitiesMenuButton.icon = Gui.LoadIcon("applications-games", 16); // FIXME: Not a good icon.
            activitiesMenuButton.PopupMode = QToolButton.ToolButtonPopupMode.InstantPopup;
            activitiesMenuButton.SetMenu(activitiesMenu);
            toolbar.AddWidget(activitiesMenuButton);

            m_InviteToMucAction = new QAction(Gui.LoadIcon("internet-group-chat", 16), "Invite to Conference...", this);
            QObject.Connect(m_InviteToMucAction, Qt.SIGNAL("triggered()"), HandleInviteToMucActionTriggered);
            activitiesMenu.AddAction(m_InviteToMucAction);
            activitiesMenu.AddSeparator();

            activitiesMenu.AddAction(Gui.LoadIcon("applications-graphics", 16), "Launch Whiteboard...");
            activitiesMenu.AddAction(Gui.LoadIcon("desktop", 16), "Share Desktop...");

            var spacerWidget = new QWidget(toolbar);
            spacerWidget.SetSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed);
            toolbar.AddWidget(spacerWidget);

            var toContainer = new QWidget(toolbar);
            var layout = new QHBoxLayout(toContainer);
            layout.SetContentsMargins(0, 0, 4, 0);

            m_ToComboBox = new QComboBox(toContainer);

            layout.AddWidget(new QLabel("To:", toContainer));
            layout.AddWidget(m_ToComboBox);

            QAction toWidgetAction = (QWidgetAction)toolbar.AddWidget(toContainer);

            m_ToComboBox.AddItem("Automatic", "auto");
            m_ToComboBox.InsertSeparator(1);

            ((QVBoxLayout)bottomContainer.Layout()).InsertWidget(0, toolbar);

            if (handler is ChatHandler) {
                var chatHandler = (ChatHandler)handler;
                handler.Account.Client.OnPresence += delegate(object sender, Presence pres) {
                    if (pres.From.Bare != chatHandler.Jid.Bare || pres.Priority == "-1") {
                        return;
                    }
                    QApplication.Invoke(delegate {
                        if (!String.IsNullOrEmpty(pres.From.Resource)) {
                            if (pres.Type == PresenceType.available) {
                                string text = String.Format("{0} ({1})", Helper.GetResourceDisplay(pres), Helper.GetPresenceDisplay(pres));
                                int i = m_ToComboBox.FindData(pres.From.Resource);
                                if (i == -1) {
                                    m_ToComboBox.AddItem(text, pres.From.Resource);
                                } else {
                                    m_ToComboBox.SetItemText(i, text);
                                }
                            } else if (pres.Type == PresenceType.unavailable) {
                                int i = m_ToComboBox.FindData(pres.From.Resource);
                                if (i > -1) {
                                    m_ToComboBox.RemoveItem(i);
                                    m_ToComboBox.CurrentIndex = 0;
                                }
                            }
                        }

                        if (chatHandler.IsMucMessage) {
                            toWidgetAction.Visible = false;
                        } else {
                            string title = null;
                            if (handler.Account.PresenceManager[pres.From.BareJID] == null) {
                                title = String.Format("{0} (Offline)", chatHandler.Account.GetDisplayName(chatHandler.Jid));
                            } else {
                                title = chatHandler.Account.GetDisplayName(chatHandler.Jid);
                            }
                            Gui.TabbedChatsWindow.SetTabTitle(this, title);
                        }
                    });
                };

                foreach (var presence in chatHandler.Account.PresenceManager.GetAll(chatHandler.Jid)) {
                    if (presence.Priority != "-1" && !String.IsNullOrEmpty(presence.From.Resource)) {
                        string text = String.Format("{0} ({1})", Helper.GetResourceDisplay(presence), Helper.GetPresenceDisplay(presence));
                        m_ToComboBox.AddItem(text, presence.From.Resource);
                    }
                }

                // FIXME: Make this a menu with "View Profile" and "View History".
                var viewProfileAction = new QAction(Gui.LoadIcon("info", 16), "View Profile", this);
                QObject.Connect(viewProfileAction, Qt.SIGNAL("triggered()"), HandleViewProfileActionTriggered);
                toolbar.AddAction(viewProfileAction);
            } else {
                toWidgetAction.Visible = false;
            }

            QObject.Connect<bool>(m_ConversationWidget.Page(), Qt.SIGNAL("loadFinished(bool)"), delegate (bool ok) {
                if (!ok) {
                    throw new Exception("Failed to load chat html.");
                }
                handler.NewContent += HandleNewContent;
                m_Handler.FireQueued();
            });

            var settings = ServiceManager.Get<SettingsService>();
            m_ConversationWidget.ShowHeader = settings.Get<bool>("MessageShowHeader");
            m_ConversationWidget.ShowUserIcons = settings.Get<bool>("MessageShowAvatars");
            m_ConversationWidget.LoadTheme(settings.Get<string>("MessageTheme"), settings.Get<string>("MessageThemeVariant"));
        }
Exemplo n.º 8
0
        public RosterWidget(QWidget parent)
            : base(parent)
        {
            SetupUi();

            m_RosterModel = new RosterAvatarGridModel();
            rosterGrid.Model = m_RosterModel;
            rosterGrid.ItemActivated += HandleItemActivated;
            rosterGrid.ShowGroupCounts = true;
            rosterGrid.InstallEventFilter(new KeyPressEater(delegate (QKeyEvent evnt) {
                if (!String.IsNullOrEmpty(evnt.Text())) {
                    rosterSearchButton.Checked = true;
                    friendSearchLineEdit.Text += evnt.Text();
                    friendSearchLineEdit.SetFocus();
                    return true;
                }
                return false;
            }, this));

            var accountService = ServiceManager.Get<AccountService>();
            accountService.AccountAdded += HandleAccountAdded;
            accountService.AccountRemoved += HandleAccountRemoved;
            foreach (Account account in accountService.Accounts) {
                HandleAccountAdded(account);
            }

            m_ActivityFeedItems = new Dictionary<string, IActivityFeedItem>();

            rosterGrid.ContextMenuPolicy = Qt.ContextMenuPolicy.CustomContextMenu;

            m_RosterMenu = new QMenu(this);
            QObject.Connect<QAction>(m_RosterMenu, Qt.SIGNAL("triggered(QAction*)"), HandleRosterMenuTriggered);

            var rosterViewActionGroup = new QActionGroup(this);
            QObject.Connect<QAction>(rosterViewActionGroup, Qt.SIGNAL("triggered(QAction *)"), RosterViewActionGroupTriggered);

            m_GridModeAction = new QAction("View as Grid", this);
            m_GridModeAction.SetActionGroup(rosterViewActionGroup);
            m_GridModeAction.Checkable = true;
            m_GridModeAction.Checked = true;
            m_RosterMenu.AddAction(m_GridModeAction);

            m_ListModeAction = new QAction("View as List", this);
            m_ListModeAction.SetActionGroup(rosterViewActionGroup);
            m_ListModeAction.Checkable = true;
            m_RosterMenu.AddAction(m_ListModeAction);

            m_RosterMenu.AddSeparator();

            m_ShowOfflineAction = new QAction("Show Offline Friends", this);
            m_ShowOfflineAction.Checkable = true;
            m_RosterMenu.AddAction(m_ShowOfflineAction);

            m_ShowTransportsAction = new QAction("Show Transports", this);
            m_ShowTransportsAction.Checkable = true;
            m_RosterMenu.AddAction(m_ShowTransportsAction);

            m_RosterMenu.AddSeparator();

            var sliderAction = new AvatarGridZoomAction<Synapse.UI.RosterItem>(rosterGrid);
            m_RosterMenu.AddAction(sliderAction);

            m_InviteActions = new List<QAction>();

            m_InviteMenu = new QMenu(this);
            m_InviteMenu.MenuAction().Text = "Invite To";
            m_InviteMenu.AddAction("New Conference...");

            m_RosterItemMenu = new QMenu(this);
            QObject.Connect<QAction>(m_RosterItemMenu, Qt.SIGNAL("triggered(QAction*)"), HandleRosterItemMenuTriggered);
            QObject.Connect(m_RosterItemMenu, Qt.SIGNAL("aboutToShow()"), RosterItemMenuAboutToShow);
            QObject.Connect(m_RosterItemMenu, Qt.SIGNAL("aboutToHide()"), RosterItemMenuAboutToHide);

            m_ViewProfileAction = new QAction("View Profile", m_RosterItemMenu);
            m_RosterItemMenu.AddAction(m_ViewProfileAction);

            m_IMAction = new QAction("IM", m_RosterItemMenu);
            m_RosterItemMenu.AddAction(m_IMAction);

            m_RosterItemMenu.AddAction("Send File...");
            m_RosterItemMenu.AddMenu(m_InviteMenu);
            m_RosterItemMenu.AddAction("View History");

            foreach (IActionCodon node in AddinManager.GetExtensionNodes("/Synapse/QtClient/Roster/FriendActions")) {
                m_RosterItemMenu.AddAction((QAction)node.CreateInstance(this));
            }

            m_RosterItemMenu.AddSeparator();

            m_EditGroupsAction = new QAction("Edit Groups", m_RosterItemMenu);
            m_RosterItemMenu.AddAction(m_EditGroupsAction);

            m_RemoveAction = new QAction("Remove", m_RosterItemMenu);
            m_RosterItemMenu.AddAction(m_RemoveAction);

            friendSearchLineEdit.InstallEventFilter(new KeyPressEater(delegate (QKeyEvent evnt) {
                if (evnt.Key() == (int)Key.Key_Escape) {
                    friendSearchLineEdit.Clear();
                    rosterSearchButton.Checked = false;
                    rosterGrid.SetFocus();
                    return true;
                }
                return false;
            }, this));

            //QSizeGrip grip = new QSizeGrip(tabWidget);
            //tabWidget.SetCornerWidget(grip, Qt.Corner.BottomRightCorner);

            0.UpTo(9).ForEach(num => {
                QAction action = new QAction(this);
                action.Shortcut = new QKeySequence("Alt+" + num.ToString());
                QObject.Connect(action, Qt.SIGNAL("triggered(bool)"), delegate {
                    tabWidget.CurrentIndex = num - 1;
                });
                this.AddAction(action);
            });

            var jsWindowObject = new SynapseJSObject(this);
            m_ActivityWebView.Page().linkDelegationPolicy = QWebPage.LinkDelegationPolicy.DelegateAllLinks;
            QObject.Connect<QUrl>(m_ActivityWebView, Qt.SIGNAL("linkClicked(QUrl)"), HandleActivityLinkClicked);
            QObject.Connect<bool>(m_ActivityWebView.Page(), Qt.SIGNAL("loadFinished(bool)"), HandleActivityPageLoadFinished);
            QObject.Connect(m_ActivityWebView.Page().MainFrame(), Qt.SIGNAL("javaScriptWindowObjectCleared()"), delegate {
                m_ActivityWebView.Page().MainFrame().AddToJavaScriptWindowObject("Synapse", jsWindowObject);
            });
            m_ActivityWebView.Page().MainFrame().Load("resource:/feed.html");

            //friendMucListWebView.Page().MainFrame().Load("resource:/friend-muclist.html");

            //quickJoinMucContainer.Hide();
            shoutContainer.Hide();

            QObject.Connect(shoutLineEdit, Qt.SIGNAL("textChanged(const QString &)"), delegate {
                shoutCharsLabel.Text = (140 - shoutLineEdit.Text.Length).ToString();
            });

            QObject.Connect(shoutLineEdit, Qt.SIGNAL("returnPressed()"), delegate {
                SendShout();
            });

            QVBoxLayout layout = new QVBoxLayout(m_AccountsContainer);
            layout.Margin = 0;
            m_AccountsContainer.SetLayout(layout);

            m_MucModel = new BookmarkedMUCsModel();
            mucTree.SetModel(m_MucModel);

            friendSearchContainer.Hide();

            rosterViewButton.icon  = new QIcon(new QPixmap("resource:/view-grid.png"));
            rosterSearchButton.icon = new QIcon(new QPixmap("resource:/simple-search.png"));
            addFriendButton.icon = new QIcon(new QPixmap("resource:/simple-add.png"));
            addMucBookmarkButton.icon = new QIcon(new QPixmap("resource:/simple-add.png"));
            feedFilterButton.icon = new QIcon(new QPixmap("resource:/simple-search.png"));

            m_CollapseIcon = new QIcon(new QPixmap("resource:/collapse.png"));
            m_ExpandIcon = new QIcon(new QPixmap("resource:/expand.png"));
            toggleJoinMucButton.icon = m_CollapseIcon;

            UpdateOnlineCount();

            var shoutService = ServiceManager.Get<ShoutService>();
            shoutService.HandlerAdded += HandleShoutHandlerAdded;
            shoutService.HandlerRemoved += HandleShoutHandlerRemoved;
            if (shoutService.Handlers.Count() > 0) {
                foreach (IShoutHandler handler in shoutService.Handlers) {
                    HandleShoutHandlerAdded(handler);
                }
            } else {
                shoutHandlersBox.Hide();
            }

            m_FeedFilterMenu = new QMenu(this);

            QObject.Connect(m_FeedFilterMenu, Qt.SIGNAL("triggered(QAction*)"), delegate (QAction action) {
                string js = Util.CreateJavascriptCall("ActivityFeed.setCategoryVisibility", action.Text.ToLower().Replace(" ", "-"), action.Checked);
                m_ActivityWebView.Page().MainFrame().EvaluateJavaScript(js);
            });

            var feedService = ServiceManager.Get<ActivityFeedService>();
            feedService.NewItem += delegate (IActivityFeedItem item) {
                lock (m_FeedItemQueue) {
                    if (!m_FeedIsLoaded) {
                        m_FeedItemQueue.Enqueue(item);
                    } else {
                        AddActivityFeedItem(item);
                    }
                }
            };
            feedService.CategoryAdded += delegate (string category) {
                QApplication.Invoke(delegate {
                    HandleCategoryAdded(category);
                });
            };
            foreach (string category in feedService.Categories) {
                HandleCategoryAdded(category);
            }
        }
Exemplo n.º 9
0
Arquivo: QAction.cs Projeto: KDE/qyoto
 public void SetMenu(QMenu menu)
 {
     interceptor.Invoke("setMenu#", "setMenu(QMenu*)", typeof(void), typeof(QMenu), menu);
 }
Exemplo n.º 10
0
Arquivo: p9.cs Projeto: KDE/kimono
    public Browser(string name)
        : base((QWidget) null)
    {
        ObjectName = name;
        SetCaption("KDE Tutorial - p9");

        QMenu filemenu = new QMenu(KDE.I18n("&File"), this);

        KAction setDefaultPageAction = new KAction(this);
        setDefaultPageAction.Text = KDE.I18n("&Set default page");
        ActionCollection().AddAction("set_default_page", setDefaultPageAction);
        Connect(	setDefaultPageAction, SIGNAL("triggered(bool)"),
                    this, SLOT("FileSetDefaultPage()") );

        addBookmarkAction = KStandardAction.AddBookmark(this, SLOT("BookLocation()"), ActionCollection());
        backAction = KStandardAction.Back(this, SLOT("GotoPreviousPage()"), ActionCollection());
        backAction.Enabled = false;
        quitAction = KStandardAction.Quit(KApplication.kApplication(), SLOT("quit()"), ActionCollection());

        string about = KDE.I18n("p9 1.0\n\n" +
                 "(C) 1999-2002 Antonio Larrosa Jimenez\n" +
                 "[email protected]\t\[email protected]\n" +
                 "Malaga (Spain)\n\n" +
                 "Simple KDE Tutorial\n" +
                 "This tutorial comes with ABSOLUTELY NO WARRANTY\n" +
                 "This is free software, and you are welcome to redistribute it\n" +
                 "under certain conditions\n");
        QMenu helpmenu = HelpMenu(about);

        KMenuBar menu = MenuBar();
        menu.AddMenu(filemenu);
        menu.AddSeparator();
        menu.AddMenu(helpmenu);

        ToolBar().AddAction(quitAction);
        ToolBar().AddAction(addBookmarkAction);
        ToolBar().AddAction(backAction);
        StandardToolBarMenuEnabled = true;

        location = new QLineEdit();
        config = new KConfigGroup(KGlobal.Config(), "Settings");
        location.Text = config.ReadEntry("defaultPage", "http://localhost");

        Connect(location, SIGNAL("returnPressed()"), this, SLOT("ChangeLocation()"));

        QSplitter split = new QSplitter();
        split.OpaqueResize = true;

        QWidget widget = new QWidget(this);

        QVBoxLayout vbox = new QVBoxLayout(widget);
        vbox.AddWidget(location);
        vbox.AddWidget(split);

        browser = new KHTMLPart(split);
        browser.OpenUrl(new KUrl(location.Text));

        Connect( browser.BrowserExtension(),
                 SIGNAL("openUrlRequest(KUrl, KParts::OpenUrlArguments)"),
                 this, SLOT("OpenUrlRequest(KUrl, KParts::OpenUrlArguments)") );

        SetCentralWidget(widget);
        SetupGUI();
    }
Exemplo n.º 11
0
 public QAction InsertMenu(QAction before, QMenu menu)
 {
     return (QAction) interceptor.Invoke("insertMenu##", "insertMenu(QAction*, QMenu*)", typeof(QAction), typeof(QAction), before, typeof(QMenu), menu);
 }
Exemplo n.º 12
0
 public void SetSystemMenu(QMenu systemMenu)
 {
     interceptor.Invoke("setSystemMenu#", "setSystemMenu(QMenu*)", typeof(void), typeof(QMenu), systemMenu);
 }
Exemplo n.º 13
0
 public static List<QAction> ActionsFromMenu(QMenu menu)
 {
     return (List<QAction>) staticInterceptor.Invoke("actionsFromMenu#", "actionsFromMenu(QMenu*)", typeof(List<QAction>), typeof(QMenu), menu);
 }
Exemplo n.º 14
0
 public QAction AddMenu(QMenu menu)
 {
     return (QAction) interceptor.Invoke("addMenu#", "addMenu(QMenu*)", typeof(QAction), typeof(QMenu), menu);
 }
Exemplo n.º 15
0
 public static List<QAction> ActionsFromMenu(QMenu menu, string prefix)
 {
     return (List<QAction>) staticInterceptor.Invoke("actionsFromMenu#$", "actionsFromMenu(QMenu*, const QString&)", typeof(List<QAction>), typeof(QMenu), menu, typeof(string), prefix);
 }
Exemplo n.º 16
0
 /// <remarks>
 ///  Returns a list of all actions in the given QMenu
 ///  This method flattens the hierarchy of the menu by prefixing the
 ///  text of all actions in a submenu with the submenu title.
 /// <param> name="menu" the QMenu storing the actions
 /// </param><param> name="prefix" text to display before the text of all actions in the menu
 /// </param><param> name="parent" QObject to be passed as parent of all the actions in the list
 /// </param></remarks>        <short>    Returns a list of all actions in the given QMenu  This method flattens the hierarchy of the menu by prefixing the  text of all actions in a submenu with the submenu title.</short>
 public static List<QAction> ActionsFromMenu(QMenu menu, string prefix, QObject parent)
 {
     return (List<QAction>) staticInterceptor.Invoke("actionsFromMenu#$#", "actionsFromMenu(QMenu*, const QString&, QObject*)", typeof(List<QAction>), typeof(QMenu), menu, typeof(string), prefix, typeof(QObject), parent);
 }
Exemplo n.º 17
0
        public TabbedChatsWindow()
        {
            // FIXME: This doesn't work very well in most themes...
            //this.SetStyleSheet("QTabWidget::pane { border: 0px; }");

            // The tab widget messes up this background color.
            this.SetStyleSheet("QTabWidget > QWidget { background: palette(window); }");

            m_Tabs = new QTabWidget();
            m_Tabs.tabPosition = QTabWidget.TabPosition.South;

            QToolButton newTabButton = new QToolButton(m_Tabs);
            newTabButton.AutoRaise = true;
            newTabButton.SetDefaultAction(new QAction(Gui.LoadIcon("tab-new", 16), "New Tab", newTabButton));
            newTabButton.SetToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly);
            QObject.Connect<QAction>(newTabButton, Qt.SIGNAL("triggered(QAction*)"), HandleNewTab);
            m_Tabs.SetCornerWidget(newTabButton, Qt.Corner.BottomLeftCorner);

            QHBoxLayout rightButtonsLayout = new QHBoxLayout();
            rightButtonsLayout.SetContentsMargins(0, 0, 0, 0);
            rightButtonsLayout.Spacing = 0;

            QToolButton closeTabButton = new QToolButton(m_Tabs);
            closeTabButton.SetToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly);
            closeTabButton.AutoRaise = true;
            closeTabButton.SetDefaultAction(new QAction(Gui.LoadIcon("window-close", 16), "Close Tab", closeTabButton));
            QObject.Connect<QAction>(closeTabButton, Qt.SIGNAL("triggered(QAction*)"), HandleCloseTab);
            rightButtonsLayout.AddWidget(closeTabButton);

            QMenu menu = new QMenu(this);
            menu.AddAction(new QIcon(), "No Recently Closed Tabs");

            QToolButton trashButton = new QToolButton(m_Tabs);
            trashButton.SetToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly);
            trashButton.AutoRaise = true;
            trashButton.PopupMode = QToolButton.ToolButtonPopupMode.InstantPopup;
            trashButton.SetMenu(menu);
            trashButton.SetDefaultAction(new QAction(Gui.LoadIcon("user-trash", 16), "Recently Closed Tabs", trashButton));
            rightButtonsLayout.AddWidget(trashButton);

            // FIXME: This looks bad.
            //rightButtonsLayout.AddWidget(new QSizeGrip(this));

            QWidget rightButtonsContainer = new QWidget(m_Tabs);
            rightButtonsContainer.SetLayout(rightButtonsLayout);
            m_Tabs.SetCornerWidget(rightButtonsContainer, Qt.Corner.BottomRightCorner);

            QVBoxLayout layout = new QVBoxLayout(this);
            layout.SetContentsMargins(0, 0, 0, 0);
            layout.AddWidget(m_Tabs, 1, 0);
            this.SetLayout(layout);

            QObject.Connect<int>(m_Tabs, Qt.SIGNAL("currentChanged(int)"), HandleCurrentChanged);

            this.SetGeometry(0, 0, 445, 370);
            Gui.CenterWidgetOnScreen(this);

            QAction closeAction = new QAction(this);
            QObject.Connect<bool>(closeAction, Qt.SIGNAL("triggered(bool)"), HandleCloseActionTriggered);
            closeAction.Shortcut = new QKeySequence("Ctrl+w");
            this.AddAction(closeAction);

            0.UpTo(9).ForEach(num => {
                QAction action = new QAction(this);
                action.Shortcut = new QKeySequence("Alt+" + num.ToString());
                QObject.Connect(action, Qt.SIGNAL("triggered(bool)"), delegate {
                    m_Tabs.CurrentIndex = num - 1;
                });
                this.AddAction(action);
            });

            QAction nextTabAction = new QAction(this);
            nextTabAction.Shortcut = new QKeySequence(QKeySequence.StandardKey.NextChild);
            QObject.Connect(nextTabAction, Qt.SIGNAL("triggered(bool)"), delegate {
                if (m_Tabs.CurrentIndex == m_Tabs.Count - 1)
                    m_Tabs.CurrentIndex = 0;
                else
                    m_Tabs.CurrentIndex += 1;
            });
            this.AddAction(nextTabAction);

            QAction prevTabAction = new QAction(this);
            prevTabAction.Shortcut = new QKeySequence(QKeySequence.StandardKey.PreviousChild);
            QObject.Connect(prevTabAction, Qt.SIGNAL("triggered(bool)"), delegate {
                if (m_Tabs.CurrentIndex == 0)
                    m_Tabs.CurrentIndex = m_Tabs.Count - 1;
                else
                    m_Tabs.CurrentIndex -= 1;
            });

            var accountService = ServiceManager.Get<AccountService>();
            accountService.AccountAdded += HandleAccountAdded;
            accountService.AccountRemoved += HandleAccountRemoved;
            foreach (Account account in accountService.Accounts)
                HandleAccountAdded(account);

            var settingsService = ServiceManager.Get<SettingsService>();
            if (settingsService.Has("ChatsWindowGeometry")) {
                var geometry = settingsService.Get<byte[]>("ChatsWindowGeometry");
                base.RestoreGeometry(QByteArrayConverter.FromArray(geometry));
            }
        }
Exemplo n.º 18
0
 public int AppendButton(QPixmap pic, int id, QMenu popup)
 {
     return (int) interceptor.Invoke("appendButton#$#", "appendButton(const QPixmap&, int, QMenu*)", typeof(int), typeof(QPixmap), pic, typeof(int), id, typeof(QMenu), popup);
 }
Exemplo n.º 19
0
 public QAction AddMenu(QMenu menu)
 {
     return((QAction)interceptor.Invoke("addMenu#", "addMenu(QMenu*)", typeof(QAction), typeof(QMenu), menu));
 }
Exemplo n.º 20
0
 /// <remarks>
 ///  append  a new button to the button area. The button can later on be accessed with button(ID)
 ///  eg for connecting signals to it
 /// <param> name="pic" a pixmap for the button
 /// </param><param> name="id" an arbitraty ID value. It will be emitted in the clicked signal for identifying the button
 /// 	if more than one button is connected to a signals.
 /// </param><param> name="popup" A popup menu which should be displayed if the button is clicked
 /// </param><param> name="not_used_yet" will be used for a popup text in the future
 ///      </param></remarks>        <short>    append  a new button to the button area.</short>
 public int AppendButton(QPixmap pic, int id, QMenu popup, string not_used_yet)
 {
     return (int) interceptor.Invoke("appendButton#$#$", "appendButton(const QPixmap&, int, QMenu*, const QString&)", typeof(int), typeof(QPixmap), pic, typeof(int), id, typeof(QMenu), popup, typeof(string), not_used_yet);
 }
Exemplo n.º 21
0
 public void SetMenu(QMenu menu)
 {
     interceptor.Invoke("setMenu#", "setMenu(QMenu*)", typeof(void), typeof(QMenu), menu);
 }
Exemplo n.º 22
0
 public virtual QMenu DefaultContextMenu(QMenu menu)
 {
     return (QMenu) interceptor.Invoke("defaultContextMenu#", "defaultContextMenu(QMenu*) const", typeof(QMenu), typeof(QMenu), menu);
 }
Exemplo n.º 23
0
		private void CreateSimMenu()
		{
			menuSimItem = new QMenu(mainwindow_Ui.LstSimContacts);
			
			menuSimActions = new List<QAction>();
			menuSimActions.Add(new QAction(new QIcon(":/toolbar/resources/qt/list-add.png"),
				GlobalObjUI.LMan.GetString("addcontacts"),
				menuSimItem));
			
			menuSimActions.Add(new QAction(new QIcon(":/toolbar/resources/qt/edit-delete.png"),
				GlobalObjUI.LMan.GetString("delcontacts"),
				menuSimItem));
			
			menuSimActions.Add(new QAction(new QIcon(":/toolbar/resources/qt/go-up.png"),
				GlobalObjUI.LMan.GetString("copycontactstofile"),
				menuSimItem));
			
			menuSimItem.AddActions(menuSimActions);
			
			menuSimActions[0].ObjectName = "simadd";
			menuSimActions[1].ObjectName = "simdel";
			menuSimActions[2].ObjectName = "simcopy";
			
			foreach(QAction qa in menuSimActions)
			{
				qa.SetVisible(true);
				qa.IconVisibleInMenu=true;
			}

		}
Exemplo n.º 24
0
        public GlobalActions()
        {
            m_AccountsMenu = new QMenu();

            m_QuitAction = new QAction(Gui.LoadIcon("application-exit"), "Quit", this);
            m_QuitAction.Shortcut = new QKeySequence("Ctrl+Q");
            QObject.Connect(m_QuitAction, Qt.SIGNAL("triggered()"), HandleQuitActionTriggered);

            m_ShowPreferencesAction = new QAction(Gui.LoadIcon("preferences-desktop"), "Preferences", this);
            QObject.Connect(m_ShowPreferencesAction, Qt.SIGNAL("triggered()"), HandleShowPreferencesActionTriggered);

            m_SendFeedbackAction = new QAction("Send Feedback...", this);
            QObject.Connect(m_SendFeedbackAction, Qt.SIGNAL("triggered()"), HandleSendFeedbackActionTriggered);

            m_ShowBrowserAction = new QAction(Gui.LoadIcon("system-search"), "Discover Services...", this);
            QObject.Connect(m_ShowBrowserAction, Qt.SIGNAL("triggered()"), HandleShowBrowserActionTriggered);

            m_NewMessageAction = new QAction(Gui.LoadIcon("document-new"), "New Message...", this);

            m_JoinMucAction = new QAction(Gui.LoadIcon("internet-group-chat"), "Create/Join Conference...", this);

            m_EditProfileAction = new QAction(Gui.LoadIcon("user-info"), "Edit Profile...", this);
            QObject.Connect(m_EditProfileAction, Qt.SIGNAL("triggered()"), HandleEditProfileActionTriggered);

            m_AboutAction = new QAction(Gui.LoadIcon("help-about"), "About", this);
            QObject.Connect(m_AboutAction, Qt.SIGNAL("triggered()"), HandleAboutActionTriggered);

            m_PresenceMenu = new QMenu();

            QActionGroup group = new QActionGroup(this);
            group.Exclusive = true;

            m_AvailableAction = m_PresenceMenu.AddAction("Available");
            group.AddAction(m_AvailableAction);
            m_AvailableAction.Checkable = true;

            m_FreeToChatAction = m_PresenceMenu.AddAction("Free To Chat");
            group.AddAction(m_FreeToChatAction);
            m_FreeToChatAction.Checkable = true;

            m_AwayAction = m_PresenceMenu.AddAction("Away");
            group.AddAction(m_AwayAction);
            m_AwayAction.Checkable = true;

            m_ExtendedAwayAction = m_PresenceMenu.AddAction("Extended Away");
            group.AddAction(m_ExtendedAwayAction);
            m_ExtendedAwayAction.Checkable = true;

            m_DoNotDisturbAction = m_PresenceMenu.AddAction("Do Not Disturb");
            group.AddAction(m_DoNotDisturbAction);
            m_DoNotDisturbAction.Checkable = true;

            m_PresenceMenu.AddSeparator();

            m_OfflineAction = m_PresenceMenu.AddAction("Offline");
            group.AddAction(m_OfflineAction);
            m_OfflineAction.Checkable = true;

            m_ChangeStatusAction = new QAction("Change Status", this);
            m_ChangeStatusAction.SetMenu(m_PresenceMenu);
        }
Exemplo n.º 25
0
        public static Account ShowAccountSelectMenu(QWidget attachWidget)
        {
            AccountService accountService = ServiceManager.Get<AccountService>();

            if (accountService.ConnectedAccounts.Count == 0) {
                var widget = (attachWidget != null) ? attachWidget.TopLevelWidget() : Gui.MainWindow;
                QMessageBox.Critical(widget, "Synapse", "You are not connected.");
                return null;
            }

            Account selectedAccount = null;
            if (accountService.ConnectedAccounts.Count > 1) {
                QMenu menu = new QMenu();
                menu.AddAction("Select Account:").SetDisabled(true);

                foreach (Account account in accountService.ConnectedAccounts) {
                    QAction action = menu.AddAction(account.Jid.ToString());
                    if (menu.ActiveAction() == null)
                        menu.SetActiveAction(action);
                }

                var pos = (attachWidget != null) ? attachWidget.MapToGlobal(new QPoint(0, attachWidget.Height())) : QCursor.Pos();
                QAction selectedAction = menu.Exec(pos);
                if (selectedAction != null) {
                    selectedAccount = accountService.GetAccount(new jabber.JID(selectedAction.Text));
                }
            } else {
                selectedAccount = accountService.ConnectedAccounts[0];
            }
            return selectedAccount;
        }
Exemplo n.º 26
0
 public QAction InsertMenu(QAction before, QMenu menu)
 {
     return((QAction)interceptor.Invoke("insertMenu##", "insertMenu(QAction*, QMenu*)", typeof(QAction), typeof(QAction), before, typeof(QMenu), menu));
 }
 public virtual void AnnotationContextMenuAboutToShow(KTextEditor.View view, QMenu menu, int line)
 {
     interceptor.Invoke("annotationContextMenuAboutToShow##$", "annotationContextMenuAboutToShow(KTextEditor::View*, QMenu*, int)", typeof(void), typeof(KTextEditor.View), view, typeof(QMenu), menu, typeof(int), line);
 }
Exemplo n.º 28
0
        public AccountStatusWidget(Account account, RosterWidget parent, MainWindow parentWindow)
            : base(parent)
        {
            SetupUi();

            m_ParentWindow = parentWindow;

            m_EditProfileDialog = new EditProfileDialog(account, this.TopLevelWidget());

            m_AvatarLabel.Cursor = new QCursor(CursorShape.PointingHandCursor);
            m_AvatarLabel.Clicked += delegate {
                if (m_Account.ConnectionState == AccountConnectionState.Connected) {
                    m_EditProfileDialog.Show(2);
                    m_EditProfileDialog.ActivateWindow();
                } else {
                    // FIXME: It really wouldn't be so hard to make this work.
                    // On connect, check to see if it was changed and update server.
                    QMessageBox.Warning(this.TopLevelWidget(), "Synapse", "Cannot edit avatar when you're not connected.");
                }
            };

            m_Account = account;
            m_Account.ConnectionStateChanged += OnAccountStateChanged;
            m_Account.StatusChanged += OnAccountStateChanged;
            m_Account.MyVCardUpdated += HandleMyVCardUpdated;
            m_Account.AvatarManager.AvatarUpdated += HandleAvatarUpdated;
            OnAccountStateChanged(account);

            HandleAvatarUpdated(m_Account.Jid.Bare, null);

            HandleMyVCardUpdated(null, EventArgs.Empty);
            m_NameLabel.TextFormat = TextFormat.RichText;

            HandleAvatarUpdated(m_Account.Jid.Bare, m_Account.GetProperty("AvatarHash"));

            m_PresenceMenu = new QMenu(this);
            QObject.Connect(m_PresenceMenu, Qt.SIGNAL("aboutToShow()"), HandlePresenceMenuAboutToShow);
            QObject.Connect<QAction>(m_PresenceMenu, Qt.SIGNAL("triggered(QAction*)"), HandlePresenceMenuTriggered);

            QActionGroup group = new QActionGroup(this);
            group.Exclusive = true;

            m_AvailableAction = m_PresenceMenu.AddAction("Available");
            group.AddAction(m_AvailableAction);
            m_AvailableAction.Checkable = true;

            m_FreeToChatAction = m_PresenceMenu.AddAction("Free To Chat");
            group.AddAction(m_FreeToChatAction);
            m_FreeToChatAction.Checkable = true;

            m_AwayAction = m_PresenceMenu.AddAction("Away");
            group.AddAction(m_AwayAction);
            m_AwayAction.Checkable = true;

            m_ExtendedAwayAction = m_PresenceMenu.AddAction("Extended Away");
            group.AddAction(m_ExtendedAwayAction);
            m_ExtendedAwayAction.Checkable = true;

            m_DoNotDisturbAction = m_PresenceMenu.AddAction("Do Not Disturb");
            group.AddAction(m_DoNotDisturbAction);
            m_DoNotDisturbAction.Checkable = true;

            m_PresenceMenu.AddSeparator();

            m_OfflineAction = m_PresenceMenu.AddAction("Offline");
            group.AddAction(m_OfflineAction);
            m_OfflineAction.Checkable = true;
        }
Exemplo n.º 29
0
    public void SetupUi(QMainWindow MainWindow)
    {
    if (MainWindow.ObjectName == "")
        MainWindow.ObjectName = "MainWindow";
    QSize Size = new QSize(631, 570);
    Size = Size.ExpandedTo(MainWindow.MinimumSizeHint());
    MainWindow.Size = Size;
    MainWindow.MinimumSize = new QSize(600, 450);
    MainWindow.WindowIcon = new QIcon(":/main/resources/monosim_128.png");
    MenuFileNew = new QAction(MainWindow);
    MenuFileNew.ObjectName = "MenuFileNew";
    MenuFileNew.icon = new QIcon(":/toolbar/resources/qt/document-new.png");
    MenuFileOpen = new QAction(MainWindow);
    MenuFileOpen.ObjectName = "MenuFileOpen";
    MenuFileOpen.icon = new QIcon(":/toolbar/resources/qt/document-open.png");
    MenuFileSaveFile = new QAction(MainWindow);
    MenuFileSaveFile.ObjectName = "MenuFileSaveFile";
    MenuFileSaveFile.Enabled = false;
    MenuFileSaveFile.icon = new QIcon(":/toolbar/resources/qt/document-save.png");
    MenuFileSaveSim = new QAction(MainWindow);
    MenuFileSaveSim.ObjectName = "MenuFileSaveSim";
    MenuFileSaveSim.Enabled = false;
    MenuFileSaveSim.icon = new QIcon(":/main/resources/chip_32.png");
    MenuFileClose = new QAction(MainWindow);
    MenuFileClose.ObjectName = "MenuFileClose";
    MenuFileClose.Enabled = false;
    MenuFileClose.icon = new QIcon(":/toolbar/resources/qt/document-close.png");
    MenuFileSettings = new QAction(MainWindow);
    MenuFileSettings.ObjectName = "MenuFileSettings";
    MenuFileSettings.icon = new QIcon(":/toolbar/resources/qt/configure.png");
    MenuFileExit = new QAction(MainWindow);
    MenuFileExit.ObjectName = "MenuFileExit";
    MenuFileExit.icon = new QIcon(":/toolbar/resources/qt/application-exit.png");
    MenuSimConnect = new QAction(MainWindow);
    MenuSimConnect.ObjectName = "MenuSimConnect";
    MenuSimConnect.icon = new QIcon(":/toolbar/resources/qt/network-connect.png");
    MenuSimPin = new QAction(MainWindow);
    MenuSimPin.ObjectName = "MenuSimPin";
    MenuSimPin.Enabled = false;
    MenuSimPin.icon = new QIcon(":/toolbar/resources/qt/document-encrypt.png");
    MenuSimSaveFile = new QAction(MainWindow);
    MenuSimSaveFile.ObjectName = "MenuSimSaveFile";
    MenuSimSaveFile.Enabled = false;
    MenuSimSaveFile.icon = new QIcon(":/toolbar/resources/qt/document-save.png");
    MenuSimSaveSim = new QAction(MainWindow);
    MenuSimSaveSim.ObjectName = "MenuSimSaveSim";
    MenuSimSaveSim.Enabled = false;
    MenuSimSaveSim.icon = new QIcon(":/main/resources/chip_32.png");
    MenuSimDeleteAll = new QAction(MainWindow);
    MenuSimDeleteAll.ObjectName = "MenuSimDeleteAll";
    MenuSimDeleteAll.Enabled = false;
    MenuSimDeleteAll.icon = new QIcon(":/toolbar/resources/qt/edit-delete.png");
    MenuSimDisconnect = new QAction(MainWindow);
    MenuSimDisconnect.ObjectName = "MenuSimDisconnect";
    MenuSimDisconnect.Enabled = false;
    MenuSimDisconnect.icon = new QIcon(":/toolbar/resources/qt/network-disconnect.png");
    MenuAboutInfo = new QAction(MainWindow);
    MenuAboutInfo.ObjectName = "MenuAboutInfo";
    MenuAboutInfo.icon = new QIcon(":/toolbar/resources/qt/dialog-information.png");
    centralwidget = new QWidget(MainWindow);
    centralwidget.ObjectName = "centralwidget";
    gridLayout = new QGridLayout(centralwidget);
    gridLayout.ObjectName = "gridLayout";
    splitter = new QSplitter(centralwidget);
    splitter.ObjectName = "splitter";
    splitter.Orientation = Qt.Orientation.Vertical;
    splitter.ChildrenCollapsible = false;
    FrameFile = new QGroupBox(splitter);
    FrameFile.ObjectName = "FrameFile";
    FrameFile.MinimumSize = new QSize(0, 100);
    gridLayout1 = new QGridLayout(FrameFile);
    gridLayout1.ObjectName = "gridLayout1";
    LstFileContacts = new QTreeWidget(FrameFile);
    LstFileContacts.ObjectName = "LstFileContacts";
    LstFileContacts.Enabled = false;
    LstFileContacts.EditTriggers = Qyoto.Qyoto.GetCPPEnumValue("QAbstractItemView", "NoEditTriggers");
    LstFileContacts.selectionMode = QAbstractItemView.SelectionMode.ExtendedSelection;
    LstFileContacts.ItemsExpandable = false;
    LstFileContacts.ExpandsOnDoubleClick = false;

    gridLayout1.AddWidget(LstFileContacts, 0, 0, 1, 1);

    splitter.AddWidget(FrameFile);
    FrameSim = new QGroupBox(splitter);
    FrameSim.ObjectName = "FrameSim";
    FrameSim.MinimumSize = new QSize(0, 100);
    gridLayout2 = new QGridLayout(FrameSim);
    gridLayout2.ObjectName = "gridLayout2";
    LstSimContacts = new QTreeWidget(FrameSim);
    LstSimContacts.ObjectName = "LstSimContacts";
    LstSimContacts.Enabled = false;
    LstSimContacts.EditTriggers = Qyoto.Qyoto.GetCPPEnumValue("QAbstractItemView", "NoEditTriggers");
    LstSimContacts.selectionMode = QAbstractItemView.SelectionMode.ExtendedSelection;
    LstSimContacts.ItemsExpandable = false;
    LstSimContacts.ExpandsOnDoubleClick = false;

    gridLayout2.AddWidget(LstSimContacts, 0, 0, 1, 1);

    splitter.AddWidget(FrameSim);

    gridLayout.AddWidget(splitter, 0, 0, 1, 1);

    MainWindow.SetCentralWidget(centralwidget);
    MainMenu = new QMenuBar(MainWindow);
    MainMenu.ObjectName = "MainMenu";
    MainMenu.Geometry = new QRect(0, 0, 631, 24);
    MenuFileItem = new QMenu(MainMenu);
    MenuFileItem.ObjectName = "MenuFileItem";
    MenuReaderItem = new QMenu(MainMenu);
    MenuReaderItem.ObjectName = "MenuReaderItem";
    MenuAboutItem = new QMenu(MainMenu);
    MenuAboutItem.ObjectName = "MenuAboutItem";
    MenuSimItem = new QMenu(MainMenu);
    MenuSimItem.ObjectName = "MenuSimItem";
    MainWindow.SetMenuBar(MainMenu);
    StatusBar = new QStatusBar(MainWindow);
    StatusBar.ObjectName = "StatusBar";
    MainWindow.SetStatusBar(StatusBar);
    TopToolBar = new QToolBar(MainWindow);
    TopToolBar.ObjectName = "TopToolBar";
    TopToolBar.Movable = false;
    TopToolBar.Floatable = false;
    MainWindow.AddToolBar(Qt.ToolBarArea.TopToolBarArea, TopToolBar);

    MainMenu.AddAction(MenuFileItem.MenuAction());
    MainMenu.AddAction(MenuReaderItem.MenuAction());
    MainMenu.AddAction(MenuSimItem.MenuAction());
    MainMenu.AddAction(MenuAboutItem.MenuAction());
    MenuFileItem.AddAction(MenuFileNew);
    MenuFileItem.AddAction(MenuFileOpen);
    MenuFileItem.AddAction(MenuFileSaveFile);
    MenuFileItem.AddAction(MenuFileSaveSim);
    MenuFileItem.AddAction(MenuFileClose);
    MenuFileItem.AddSeparator();
    MenuFileItem.AddAction(MenuFileSettings);
    MenuFileItem.AddSeparator();
    MenuFileItem.AddAction(MenuFileExit);
    MenuAboutItem.AddAction(MenuAboutInfo);
    MenuSimItem.AddAction(MenuSimConnect);
    MenuSimItem.AddAction(MenuSimPin);
    MenuSimItem.AddSeparator();
    MenuSimItem.AddAction(MenuSimSaveFile);
    MenuSimItem.AddAction(MenuSimSaveSim);
    MenuSimItem.AddAction(MenuSimDeleteAll);
    MenuSimItem.AddSeparator();
    MenuSimItem.AddAction(MenuSimDisconnect);
    TopToolBar.AddAction(MenuFileNew);
    TopToolBar.AddAction(MenuFileOpen);
    TopToolBar.AddAction(MenuFileSaveFile);
    TopToolBar.AddAction(MenuFileSaveSim);
    TopToolBar.AddAction(MenuFileClose);
    TopToolBar.AddSeparator();
    TopToolBar.AddAction(MenuFileSettings);
    TopToolBar.AddAction(MenuSimConnect);
    TopToolBar.AddAction(MenuSimPin);
    TopToolBar.AddAction(MenuSimSaveFile);
    TopToolBar.AddAction(MenuSimSaveSim);
    TopToolBar.AddAction(MenuSimDisconnect);
    TopToolBar.AddSeparator();
    TopToolBar.AddAction(MenuAboutInfo);
    TopToolBar.AddAction(MenuFileExit);

    RetranslateUi(MainWindow);

    QMetaObject.ConnectSlotsByName(MainWindow);
    } // SetupUi