Beispiel #1
0
        private void InitUI(QToolBar toolbar, Dictionary <string, QAction> actions)
        {
            toolbar.AddAction(MediaIconHelper.NewDocumentIcon, "New File");
            toolbar.AddAction(MediaIconHelper.OpenDocumentIcon, "Open File");
            toolbar.AddSeparator();
            toolbar.AddAction(actions["About"]);

            QAction quit = toolbar.AddAction(MediaIconHelper.SystemLogOugIcon, "Quit Application");

            quit.Triggered += Quit_Triggered;
        }
Beispiel #2
0
        public override void InitUI()
        {
            var toolbar = new QToolBar(this);

            toolbar.AddAction(MediaIconHelper.NewDocumentIcon, "New File");
            toolbar.AddAction(MediaIconHelper.OpenDocumentIcon, "Open File");
            toolbar.AddSeparator();
            QAction quit = toolbar.AddAction(MediaIconHelper.SystemLogOugIcon, "Quit Application");

            quit.Triggered += Quit_Triggered;
        }
        public ServiceBrowserWindow(Account account)
        {
            SetupUi();

            m_Account = account;
            m_HomeUri = new Uri(String.Format("xmpp:{0}?disco", account.Jid.Server));

            this.WindowTitle = String.Format("XMPP Browser - {0}", account.Jid);

            m_BackAction    = new QAction(Gui.LoadIcon("go-previous", 16), "Back", this);
            m_ForwardAction = new QAction(Gui.LoadIcon("go-next", 16), "Forward", this);
            m_ReloadAction  = new QAction(Gui.LoadIcon("view-refresh", 16), "Reload", this);
            m_StopAction    = new QAction(Gui.LoadIcon("process-stop", 16), "Stop", this);
            m_HomeAction    = new QAction(Gui.LoadIcon("go-home", 16), "Home", this);
            m_GoAction      = new QAction("Go", this);

            m_BackAction.Enabled    = false;
            m_ForwardAction.Enabled = false;

            m_StopAction.Visible = false;

            m_Toolbar = new QToolBar(this);
            m_Toolbar.AddAction(m_BackAction);
            m_Toolbar.AddAction(m_ForwardAction);
            m_Toolbar.AddAction(m_ReloadAction);
            m_Toolbar.AddAction(m_StopAction);
            m_Toolbar.AddAction(m_HomeAction);

            m_AddresCombo = new QComboBox(m_Toolbar);
            m_AddresCombo.SetSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed);
            m_AddresCombo.Editable = true;
            m_Toolbar.AddWidget(m_AddresCombo);

            m_Toolbar.AddAction(m_GoAction);

            QObject.Connect <QAction>(m_Toolbar, Qt.SIGNAL("actionTriggered(QAction*)"), HandleToolbarActionTriggered);

            ((QBoxLayout)this.Layout()).InsertWidget(0, m_Toolbar);

            webView.Page().linkDelegationPolicy = QWebPage.LinkDelegationPolicy.DelegateAllLinks;

            RequestUrl(m_HomeUri);

            Gui.CenterWidgetOnScreen(this);
        }
Beispiel #4
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
Beispiel #5
0
 /// <summary>
 /// Method for replacing the existing toolbar.
 /// </summary>
 private void SetToolBar(QToolBar toolbar)
 {
     base.AddToolBar(Qt.ToolBarArea.TopToolBarArea, toolbar);
 }
Beispiel #6
0
        internal ChatWindow(IChatHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            m_Handler = handler;

            var settingsService = ServiceManager.Get <SettingsService>();

            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;

                participantsGrid.ListMode = settingsService.Get <bool>("MucListMode");
                if (settingsService.Has("MucIconSize"))
                {
                    participantsGrid.IconSize = settingsService.Get <int>("MucIconSize");
                }

                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;
                listModeAction.Checked   = participantsGrid.ListMode;
                m_ParticipantsMenu.AddAction(listModeAction);

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

                var sliderAction = new AvatarGridZoomAction <jabber.connection.RoomParticipant>(participantsGrid);
                sliderAction.ValueChanged += delegate(int value) {
                    participantsGrid.IconSize = value;
                    settingsService.Set("MucIconSize", value);
                };
                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);

            if (settingsService.Has("MucSplitterState"))
            {
                byte[] state = settingsService.Get <byte[]>("MucSplitterState");
                splitter_2.RestoreState(QByteArrayConverter.FromArray(state));
            }

            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("preferences-desktop-font",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-x-generic",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("user-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"));
        }
Beispiel #7
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, 550);
        MainWindow.WindowIcon = new QIcon(":/main/resources/Images/comex_256.png");
        action_Open = new QAction(MainWindow);
        action_Open.ObjectName = "action_Open";
        action_Open.icon = new QIcon(":/main/resources/Images/document-open.png");
        action_Close = new QAction(MainWindow);
        action_Close.ObjectName = "action_Close";
        action_Close.Enabled = false;
        action_Close.icon = new QIcon(":/main/resources/Images/document-close.png");
        action_Exit = new QAction(MainWindow);
        action_Exit.ObjectName = "action_Exit";
        action_Exit.icon = new QIcon(":/main/resources/Images/application-exit.png");
        action_Info = new QAction(MainWindow);
        action_Info.ObjectName = "action_Info";
        action_Info.icon = new QIcon(":/main/resources/Images/dialog-information.png");
        action_ATR = new QAction(MainWindow);
        action_ATR.ObjectName = "action_ATR";
        action_ATR.icon = new QIcon(":/main/resources/Images/quickopen.png");
        action_Exec_Command = new QAction(MainWindow);
        action_Exec_Command.ObjectName = "action_Exec_Command";
        action_SerialSettings = new QAction(MainWindow);
        action_SerialSettings.ObjectName = "action_SerialSettings";
        action_SerialSettings.icon = new QIcon(":/main/resources/Images/configure.png");
        centralwidget = new QWidget(MainWindow);
        centralwidget.ObjectName = "centralwidget";
        gridLayout = new QGridLayout(centralwidget);
        gridLayout.ObjectName = "gridLayout";
        FrameATR = new QGroupBox(centralwidget);
        FrameATR.ObjectName = "FrameATR";
        QSizePolicy sizePolicy = new QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed);
        sizePolicy.SetHorizontalStretch(0);
        sizePolicy.SetVerticalStretch(0);
        sizePolicy.SetHeightForWidth(FrameATR.SizePolicy.HasHeightForWidth());
        FrameATR.SizePolicy = sizePolicy;
        gridLayout1 = new QGridLayout(FrameATR);
        gridLayout1.ObjectName = "gridLayout1";
        TxtATR = new QLineEdit(FrameATR);
        TxtATR.ObjectName = "TxtATR";
        TxtATR.StyleSheet = "color: rgb(30, 109, 30);";
        TxtATR.ReadOnly = true;

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

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

        FrameFile = new QGroupBox(centralwidget);
        FrameFile.ObjectName = "FrameFile";
        gridLayout2 = new QGridLayout(FrameFile);
        gridLayout2.ObjectName = "gridLayout2";
        LstCommands = new QListWidget(FrameFile);
        LstCommands.ObjectName = "LstCommands";
        LstCommands.EditTriggers = Qyoto.Qyoto.GetCPPEnumValue("QAbstractItemView", "NoEditTriggers");

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

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

        FrameExchange = new QGroupBox(centralwidget);
        FrameExchange.ObjectName = "FrameExchange";
        sizePolicy.SetHeightForWidth(FrameExchange.SizePolicy.HasHeightForWidth());
        FrameExchange.SizePolicy = sizePolicy;
        gridLayout3 = new QGridLayout(FrameExchange);
        gridLayout3.ObjectName = "gridLayout3";
        LblCommand = new QLabel(FrameExchange);
        LblCommand.ObjectName = "LblCommand";

        gridLayout3.AddWidget(LblCommand, 0, 0, 1, 1);

        TxtCmd = new QLineEdit(FrameExchange);
        TxtCmd.ObjectName = "TxtCmd";
        TxtCmd.StyleSheet = "color: rgb(30, 109, 30);";

        gridLayout3.AddWidget(TxtCmd, 0, 1, 1, 1);

        BtnSend = new QPushButton(FrameExchange);
        BtnSend.ObjectName = "BtnSend";
        BtnSend.icon = new QIcon(":/main/resources/Images/arrow-right.png");

        gridLayout3.AddWidget(BtnSend, 0, 2, 1, 1);

        LblResponse = new QLabel(FrameExchange);
        LblResponse.ObjectName = "LblResponse";

        gridLayout3.AddWidget(LblResponse, 1, 0, 1, 1);

        TxtResp = new QLineEdit(FrameExchange);
        TxtResp.ObjectName = "TxtResp";
        TxtResp.StyleSheet = "color: rgb(0, 0, 255);";
        TxtResp.ReadOnly = true;

        gridLayout3.AddWidget(TxtResp, 1, 1, 1, 1);

        gridLayout.AddWidget(FrameExchange, 2, 0, 1, 1);

        MainWindow.SetCentralWidget(centralwidget);
        menubar = new QMenuBar(MainWindow);
        menubar.ObjectName = "menubar";
        menubar.Geometry = new QRect(0, 0, 631, 24);
        menu_File = new QMenu(menubar);
        menu_File.ObjectName = "menu_File";
        menu_Reader = new QMenu(menubar);
        menu_Reader.ObjectName = "menu_Reader";
        menu_About = new QMenu(menubar);
        menu_About.ObjectName = "menu_About";
        MainWindow.SetMenuBar(menubar);
        statusbar = new QStatusBar(MainWindow);
        statusbar.ObjectName = "statusbar";
        MainWindow.SetStatusBar(statusbar);
        toolBar = new QToolBar(MainWindow);
        toolBar.ObjectName = "toolBar";
        toolBar.Movable = false;
        toolBar.ToolButtonStyle = Qt.ToolButtonStyle.ToolButtonTextBesideIcon;
        toolBar.Floatable = false;
        MainWindow.AddToolBar(Qt.ToolBarArea.TopToolBarArea, toolBar);

        menubar.AddAction(menu_File.MenuAction());
        menubar.AddAction(menu_Reader.MenuAction());
        menubar.AddAction(menu_About.MenuAction());
        menu_File.AddAction(action_Open);
        menu_File.AddAction(action_Close);
        menu_File.AddSeparator();
        menu_File.AddAction(action_SerialSettings);
        menu_File.AddSeparator();
        menu_File.AddAction(action_Exit);
        menu_About.AddAction(action_Info);
        toolBar.AddAction(action_Open);
        toolBar.AddAction(action_Close);
        toolBar.AddAction(action_SerialSettings);
        toolBar.AddAction(action_ATR);
        toolBar.AddAction(action_Info);
        toolBar.AddSeparator();
        toolBar.AddAction(action_Exit);

        RetranslateUi(MainWindow);

        QMetaObject.ConnectSlotsByName(MainWindow);
    }
Beispiel #8
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, 550);
        MainWindow.WindowIcon            = new QIcon(":/main/resources/Images/comex_256.png");
        action_Open                      = new QAction(MainWindow);
        action_Open.ObjectName           = "action_Open";
        action_Open.icon                 = new QIcon(":/main/resources/Images/document-open.png");
        action_Close                     = new QAction(MainWindow);
        action_Close.ObjectName          = "action_Close";
        action_Close.Enabled             = false;
        action_Close.icon                = new QIcon(":/main/resources/Images/document-close.png");
        action_Exit                      = new QAction(MainWindow);
        action_Exit.ObjectName           = "action_Exit";
        action_Exit.icon                 = new QIcon(":/main/resources/Images/application-exit.png");
        action_Info                      = new QAction(MainWindow);
        action_Info.ObjectName           = "action_Info";
        action_Info.icon                 = new QIcon(":/main/resources/Images/dialog-information.png");
        action_ATR                       = new QAction(MainWindow);
        action_ATR.ObjectName            = "action_ATR";
        action_ATR.icon                  = new QIcon(":/main/resources/Images/quickopen.png");
        action_Exec_Command              = new QAction(MainWindow);
        action_Exec_Command.ObjectName   = "action_Exec_Command";
        action_SerialSettings            = new QAction(MainWindow);
        action_SerialSettings.ObjectName = "action_SerialSettings";
        action_SerialSettings.icon       = new QIcon(":/main/resources/Images/configure.png");
        centralwidget                    = new QWidget(MainWindow);
        centralwidget.ObjectName         = "centralwidget";
        gridLayout                       = new QGridLayout(centralwidget);
        gridLayout.ObjectName            = "gridLayout";
        FrameATR                         = new QGroupBox(centralwidget);
        FrameATR.ObjectName              = "FrameATR";
        QSizePolicy sizePolicy = new QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed);

        sizePolicy.SetHorizontalStretch(0);
        sizePolicy.SetVerticalStretch(0);
        sizePolicy.SetHeightForWidth(FrameATR.SizePolicy.HasHeightForWidth());
        FrameATR.SizePolicy    = sizePolicy;
        gridLayout1            = new QGridLayout(FrameATR);
        gridLayout1.ObjectName = "gridLayout1";
        TxtATR            = new QLineEdit(FrameATR);
        TxtATR.ObjectName = "TxtATR";
        TxtATR.StyleSheet = "color: rgb(30, 109, 30);";
        TxtATR.ReadOnly   = true;

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


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

        FrameFile                = new QGroupBox(centralwidget);
        FrameFile.ObjectName     = "FrameFile";
        gridLayout2              = new QGridLayout(FrameFile);
        gridLayout2.ObjectName   = "gridLayout2";
        LstCommands              = new QListWidget(FrameFile);
        LstCommands.ObjectName   = "LstCommands";
        LstCommands.EditTriggers = Qyoto.Qyoto.GetCPPEnumValue("QAbstractItemView", "NoEditTriggers");

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


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

        FrameExchange            = new QGroupBox(centralwidget);
        FrameExchange.ObjectName = "FrameExchange";
        sizePolicy.SetHeightForWidth(FrameExchange.SizePolicy.HasHeightForWidth());
        FrameExchange.SizePolicy = sizePolicy;
        gridLayout3            = new QGridLayout(FrameExchange);
        gridLayout3.ObjectName = "gridLayout3";
        LblCommand             = new QLabel(FrameExchange);
        LblCommand.ObjectName  = "LblCommand";

        gridLayout3.AddWidget(LblCommand, 0, 0, 1, 1);

        TxtCmd            = new QLineEdit(FrameExchange);
        TxtCmd.ObjectName = "TxtCmd";
        TxtCmd.StyleSheet = "color: rgb(30, 109, 30);";

        gridLayout3.AddWidget(TxtCmd, 0, 1, 1, 1);

        BtnSend            = new QPushButton(FrameExchange);
        BtnSend.ObjectName = "BtnSend";
        BtnSend.icon       = new QIcon(":/main/resources/Images/arrow-right.png");

        gridLayout3.AddWidget(BtnSend, 0, 2, 1, 1);

        LblResponse            = new QLabel(FrameExchange);
        LblResponse.ObjectName = "LblResponse";

        gridLayout3.AddWidget(LblResponse, 1, 0, 1, 1);

        TxtResp            = new QLineEdit(FrameExchange);
        TxtResp.ObjectName = "TxtResp";
        TxtResp.StyleSheet = "color: rgb(0, 0, 255);";
        TxtResp.ReadOnly   = true;

        gridLayout3.AddWidget(TxtResp, 1, 1, 1, 1);


        gridLayout.AddWidget(FrameExchange, 2, 0, 1, 1);

        MainWindow.SetCentralWidget(centralwidget);
        menubar                = new QMenuBar(MainWindow);
        menubar.ObjectName     = "menubar";
        menubar.Geometry       = new QRect(0, 0, 631, 24);
        menu_File              = new QMenu(menubar);
        menu_File.ObjectName   = "menu_File";
        menu_Reader            = new QMenu(menubar);
        menu_Reader.ObjectName = "menu_Reader";
        menu_About             = new QMenu(menubar);
        menu_About.ObjectName  = "menu_About";
        MainWindow.SetMenuBar(menubar);
        statusbar            = new QStatusBar(MainWindow);
        statusbar.ObjectName = "statusbar";
        MainWindow.SetStatusBar(statusbar);
        toolBar                 = new QToolBar(MainWindow);
        toolBar.ObjectName      = "toolBar";
        toolBar.Movable         = false;
        toolBar.ToolButtonStyle = Qt.ToolButtonStyle.ToolButtonTextBesideIcon;
        toolBar.Floatable       = false;
        MainWindow.AddToolBar(Qt.ToolBarArea.TopToolBarArea, toolBar);

        menubar.AddAction(menu_File.MenuAction());
        menubar.AddAction(menu_Reader.MenuAction());
        menubar.AddAction(menu_About.MenuAction());
        menu_File.AddAction(action_Open);
        menu_File.AddAction(action_Close);
        menu_File.AddSeparator();
        menu_File.AddAction(action_SerialSettings);
        menu_File.AddSeparator();
        menu_File.AddAction(action_Exit);
        menu_About.AddAction(action_Info);
        toolBar.AddAction(action_Open);
        toolBar.AddAction(action_Close);
        toolBar.AddAction(action_SerialSettings);
        toolBar.AddAction(action_ATR);
        toolBar.AddAction(action_Info);
        toolBar.AddSeparator();
        toolBar.AddAction(action_Exit);

        RetranslateUi(MainWindow);

        QMetaObject.ConnectSlotsByName(MainWindow);
    } // SetupUi