void OptionsWidget_identityProfile::delProfileEntry() { QTreeWidgetItem * pItem = (QTreeWidgetItem *)m_pTreeWidget->currentItem(); if(!pItem) return; delete pItem; toggleControls(); }
void GraphicsClientItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { if (isMacroItem()) { if (((JackContextGraphicsScene*)scene())->editMacro(this)) { event->accept(); return; } } else if (isModuleItem()) { toggleControls(); event->accept(); return; } QGraphicsPathItem::mouseDoubleClickEvent(event); }
// // Constructor // MsgDialog::MsgDialog(QWidget *parent, const char *name, const QString& prefName, QStringList &list) : SEQWindow(prefName, name, parent, name) { #ifdef DEBUGMSG qDebug("MsgDialog() '%s' List passed by ref with %d elements", name, list.count()); #endif m_bScrollLock = FALSE; m_nButtons = 0; m_nIndent = 5; // num of spaces to indent wrapped lines m_nLockIndex = 0; m_nIndex = 0; m_bUseIndexing = FALSE; m_bShowType = TRUE; m_nShown = 0; m_nEditItem = -1; m_nDeleteItem = -1; m_bAdditiveFilter = FALSE; m_pButtonOver = NULL; m_buttonList.setAutoDelete(false); // use the shared list given to us m_pStringList = &list; // install event filter to catch right clicks to add buttons installEventFilter(this); // top-level layout; a vertical box to contain all widgets and sublayouts QBoxLayout *topLayout = new QVBoxLayout(this); // Make an hbox that will hold the textbox and the row of filterbuttons QBoxLayout *middleLayout = new QHBoxLayout(topLayout); // add the edit m_pEdit = new MyEdit(this, "edit"); m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_pEdit->setReadOnly(TRUE); m_pEdit->setWordWrap(QMultiLineEdit::WidgetWidth); m_pEdit->setWrapPolicy(QMultiLineEdit::AtWhiteSpace); middleLayout->addWidget(m_pEdit); // add a vertical box to hold the button layout and the stretch QBoxLayout *rightLayout = new QVBoxLayout(middleLayout); // add a vertical box to hold the filter buttons m_pButtonsPanel = new QWidget(this, "buttonPanel"); rightLayout->addWidget(m_pButtonsPanel); m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel); // Make an hbox that will hold the tools QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout); // Make an bbox that will hold the right tools QBoxLayout *righttools = new QVBoxLayout(tools); // Add an 'additive' vs 'subtractive checkbox m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel); m_pAdditiveCheckBox->setChecked(isAdditive()); connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), this, SLOT (setAdditive(bool))); righttools->addWidget(m_pAdditiveCheckBox); // Add a 'scroll-lock' checkbox QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel); pScrollLockCheckBox->setChecked(FALSE); connect(pScrollLockCheckBox, SIGNAL (toggled(bool)), this, SLOT (scrollLock(bool))); righttools->addWidget(pScrollLockCheckBox); // Add a 'msg type' checkbox m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel); m_pMsgTypeCheckBox->setChecked(m_bShowType); connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)), this, SLOT (showMsgType(bool))); righttools->addWidget(m_pMsgTypeCheckBox); // Add a decrorative frame seperator QFrame *frame = new QFrame(m_pButtonsPanel, "seperator"); frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); frame->setFixedHeight(2); m_pButtonsLayout->addWidget(frame); // // Status Bar // // create a label to look like a status bar QBoxLayout *statusLayout = new QHBoxLayout(topLayout); m_pStatusBarFilter = new QLabel(this); m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarFilter, 4); m_pStatusBarMsgcount = new QLabel(this); m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarMsgcount, 1); m_pStatusBarTotMsgcount = new QLabel(this); m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarTotMsgcount, 1); m_pStatusBarLock = new QLabel(this); m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarLock, 1); // Add an empty widget to fill the space and stretch when resized rightLayout->addStretch(10); // Add popup menu m_pMenu = new QPopupMenu(this, "popup"); m_pMenu->insertItem("&Add Button", this, SLOT(addButton())); m_pMenu->insertSeparator(); m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls())); connect(m_pMenu, SIGNAL (aboutToShow(void)), this, SLOT (menuAboutToShow(void))); // load the preferences load(); // refresh the messages refresh(); } // end constructor
OptionsWidget_identityProfile::OptionsWidget_identityProfile(QWidget * pParent) : KviOptionsWidget(pParent) { setObjectName("identity_profiles_option_widget"); m_pEditor = 0; m_iCurrentEditedProfile = -1; createLayout(); QGridLayout * pLayout = layout(); KviIdentityProfileSet * pSet = KviIdentityProfileSet::instance(); bool bEnabled = pSet ? (pSet->isEnabled() && !pSet->isEmpty()) : false; m_pProfilesCheck = new QCheckBox(__tr2qs_ctx("Enable Network Profiles","options"),this); KviTalToolTip::add(m_pProfilesCheck,__tr2qs_ctx("This check enables the use of network profiles","options")); m_pProfilesCheck->setChecked(bEnabled); pLayout->addWidget(m_pProfilesCheck,0,0,1,3); connect(m_pProfilesCheck,SIGNAL(toggled(bool)),this,SLOT(toggleControls())); // Profiles list m_pTreeWidget = new QTreeWidget(this); m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); m_pTreeWidget->setAllColumnsShowFocus(true); QStringList labels; labels.append(__tr2qs_ctx("Name","options")); labels.append(__tr2qs_ctx("Network","options")); labels.append(__tr2qs_ctx("Nickname","options")); labels.append(__tr2qs_ctx("Alt. Nick","options")); labels.append(__tr2qs_ctx("Username","options")); labels.append(__tr2qs_ctx("Realname","options")); m_pTreeWidget->setHeaderLabels(labels); KviTalToolTip::add(m_pTreeWidget, \ __tr2qs_ctx("<center>This is a set of rules to use profiles." \ "KVIrc will use them to handle the user connection " \ "data before the data is sent to the IRC server.<br>" \ "This is useful if a user wants to use different data " \ "on different networks without changing them at every " \ "connection attempt.","options")); pLayout->addWidget(m_pTreeWidget,1,0,1,3); connect(m_pTreeWidget,SIGNAL(itemSelectionChanged()),this,SLOT(toggleControls())); // Buttons box KviTalHBox * pBtnBox = new KviTalHBox(this); pLayout->addWidget(pBtnBox,2,0); m_pBtnAddProfile = new QPushButton(__tr2qs_ctx("Add Profile","options"),pBtnBox); connect(m_pBtnAddProfile,SIGNAL(clicked()),this,SLOT(addProfileEntry())); m_pBtnEditProfile = new QPushButton(__tr2qs_ctx("Edit Profile","options"),pBtnBox); connect(m_pBtnEditProfile,SIGNAL(clicked()),this,SLOT(editProfileEntry())); m_pBtnDelProfile = new QPushButton(__tr2qs_ctx("Delete Profile","options"),pBtnBox); connect(m_pBtnDelProfile,SIGNAL(clicked()),this,SLOT(delProfileEntry())); // Fill in the treewidget if(pSet && pSet->profiles()) { QTreeWidgetItem * pItem; KviPointerList<KviIdentityProfile> * pList = pSet->profiles(); for(KviIdentityProfile * pProfile = pList->first(); pProfile; pProfile = pList->next()) { pItem = new QTreeWidgetItem(m_pTreeWidget); pItem->setText(0,pProfile->name()); pItem->setText(1,pProfile->network()); pItem->setText(2,pProfile->nick()); pItem->setText(3,pProfile->altNick()); pItem->setText(4,pProfile->userName()); pItem->setText(5,pProfile->realName()); } } toggleControls(); }
// // Constructor // MsgDialog::MsgDialog(QWidget *parent, const char *name, QStringList &list) // : QDialog(parent, name) : QWidget(parent, name) { #ifdef DEBUGMSG qDebug("MsgDialog() '%s' List passed by ref with %d elements", name, list.count()); #endif m_bScrollLock = FALSE; m_nButtons = 0; m_nIndent = 5; // num of spaces to indent wrapped lines m_nLockIndex = 0; m_nIndex = 0; m_bUseIndexing = FALSE; m_bShowType = TRUE; m_nShown = 0; m_nEditItem = -1; m_bAdditiveFilter = FALSE; #if 0 m_pMsgTypeCheckBox = 0; m_pButtonsPanel = 0; m_pEdit = 0; m_pStatusBar = 0; m_pStatusBarLock = 0; m_pStatusBarMsgcount = 0; m_pStatusBarTotMsgcount = 0; m_pStatusBarFilter = 0; m_pButtonsLayout = 0; m_pMenu = 0; m_pStringList = 0; #endif // Anyone want to explain to me why ShowEQ segfaults upon exit when I // uncomment out the following line. This baffles me.... it acts like // it causes something to get destroyed when it's not supposed to be // - Maerlyn // m_pButtonOver = 0; // use the shared list given to us m_pStringList = &list; // set Title setCaption(QString(name)); // install event filter to catch right clicks to add buttons installEventFilter(this); // top-level layout; a vertical box to contain all widgets and sublayouts QBoxLayout *topLayout = new QVBoxLayout(this); // Make an hbox that will hold the textbox and the row of filterbuttons QBoxLayout *middleLayout = new QHBoxLayout(topLayout); // add the edit // m_pEdit = new QMultiLineEdit(this, "edit"); m_pEdit = new MyEdit(this, "edit"); m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_pEdit->setReadOnly(TRUE); m_pEdit->setFont(QFont("Helvetica", 10)); middleLayout->addWidget(m_pEdit); // add a vertical box to hold the button layout and the stretch QBoxLayout *rightLayout = new QVBoxLayout(middleLayout); // add a vertical box to hold the filter buttons m_pButtonsPanel = new QWidget(this, "buttonPanel"); rightLayout->addWidget(m_pButtonsPanel); m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel); // Make an hbox that will hold the tools QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout); // Make an bbox that will hold the right tools QBoxLayout *righttools = new QVBoxLayout(tools); // Add an 'additive' vs 'subtractive checkbox m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel); m_pAdditiveCheckBox->setChecked(isAdditive()); connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), this, SLOT (setAdditive(bool))); righttools->addWidget(m_pAdditiveCheckBox); // Add a 'scroll-lock' checkbox QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel); pScrollLockCheckBox->setChecked(FALSE); connect(pScrollLockCheckBox, SIGNAL (toggled(bool)), this, SLOT (scrollLock(bool))); righttools->addWidget(pScrollLockCheckBox); // Add a 'msg type' checkbox m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel); m_pMsgTypeCheckBox->setChecked(m_bShowType); connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)), this, SLOT (showMsgType(bool))); righttools->addWidget(m_pMsgTypeCheckBox); // Add a decrorative frame seperator QFrame *frame = new QFrame(m_pButtonsPanel, "seperator"); frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); frame->setFixedHeight(2); m_pButtonsLayout->addWidget(frame); // // Status Bar // // create a label to look like a status bar QBoxLayout *statusLayout = new QHBoxLayout(topLayout); m_pStatusBarFilter = new QLabel(this); m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarFilter, 4); m_pStatusBarMsgcount = new QLabel(this); m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarMsgcount, 1); m_pStatusBarTotMsgcount = new QLabel(this); m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarTotMsgcount, 1); m_pStatusBarLock = new QLabel(this); m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarLock, 1); #if 0 // Add some default filter buttons MyButton *but; for (int i = 0; i < 5; i++) { char temp[15]; sprintf(temp, "Empty%d", i); QString name(temp); QString filter(temp); QString color("Black"); newButton(name, filter, color, FALSE); } #endif // Add an empty widget to fill the space and stretch when resized rightLayout->addStretch(10); // Add popup menu m_pMenu = new QPopupMenu(this, "popup"); m_pMenu->insertItem("&Add Button", this, SLOT(addButton())); m_pMenu->insertSeparator(); m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls())); connect(m_pMenu, SIGNAL (aboutToShow(void)), this, SLOT (menuAboutToShow(void))); // refresh the messages refresh(); } // end constructor