NetworkProxyDialog::NetworkProxyDialog(QSettings &t_settings, QWidget *t_parent = 0) : QDialog(t_parent), m_settings(t_settings) { QGridLayout *layout = new QGridLayout(this); // NoProxy, DefaultProxy, Socks5Proxy, HttpProxy, HttpCachingProxy, FtpCachingProxy m_proxyType = new QComboBox(); m_proxyType->addItem("No Proxy", QNetworkProxy::NoProxy); // Allow http only for now since that's known to be supported by ruby / aws // m_proxyType->addItem("Socks5 Proxy", QNetworkProxy::Socks5Proxy); m_proxyType->addItem("Http Proxy", QNetworkProxy::HttpProxy); connect(m_proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(proxyTypeChanged(int))); m_hostName = new QLineEdit(this); m_port = new QLineEdit(this); m_port->setValidator(new QIntValidator(0, 65535)); m_user = new QLineEdit(this); layout->addWidget(new QLabel("Proxy Type"), 0, 0); layout->addWidget(m_proxyType, 0, 1); layout->addWidget(new QLabel("Host Name"), 1, 0); layout->addWidget(m_hostName, 1, 1); layout->addWidget(new QLabel("Port"), 2, 0); layout->addWidget(m_port, 2, 1); layout->addWidget(new QLabel("User Name"), 3, 0); layout->addWidget(m_user, 3, 1); QHBoxLayout *buttonBox = new QHBoxLayout(); QPushButton *saveButton = new QPushButton("Save"); QPushButton *cancelButton = new QPushButton("Cancel"); QPushButton *testButton = new QPushButton("Test"); buttonBox->addWidget(saveButton); buttonBox->addWidget(cancelButton); buttonBox->addWidget(testButton); layout->addLayout(buttonBox, 4,0,1,2); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); connect(testButton, SIGNAL(clicked()), this, SLOT(testClicked())); QNetworkProxy proxy(createProxy(t_settings)); int type = m_proxyType->findData(proxy.type()); QString user = proxy.user(); QString hostname = proxy.hostName(); int port = proxy.port(); m_proxyType->setCurrentIndex(type>-1?type:0); m_user->setText(user); m_hostName->setText(hostname); m_port->setText(QString::number(port)); proxyTypeChanged(m_proxyType->currentIndex()); }
SettingDialog::SettingDialog(const QStringList& list,QWidget* parent): QDialog(parent) { setupUi(this); m_count=0; connect(okButton,SIGNAL(clicked()),this,SLOT(accept())); connect(cancelButton,SIGNAL(clicked()),this,SLOT(reject())); connect(testSoundButton,SIGNAL(clicked()),this,SLOT(testClicked())); this->list = list; init(); }
bool CustomEdit::Create() { if (!LoadWindowFromXML("schedule-ui.xml", "customedit", this)) return false; bool err = false; UIUtilE::Assign(this, m_ruleList, "rules", &err); UIUtilE::Assign(this, m_clauseList, "clauses", &err); UIUtilE::Assign(this, m_titleEdit, "title", &err); UIUtilE::Assign(this, m_subtitleEdit, "subtitle", &err); UIUtilE::Assign(this, m_descriptionEdit, "description", &err); UIUtilE::Assign(this, m_clauseText, "clausetext", &err); UIUtilE::Assign(this, m_testButton, "test", &err); UIUtilE::Assign(this, m_recordButton, "record", &err); UIUtilE::Assign(this, m_storeButton, "store", &err); UIUtilE::Assign(this, m_cancelButton, "cancel", &err); if (err) { LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'customedit'"); return false; } connect(m_ruleList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(ruleChanged(MythUIButtonListItem *))); connect(m_titleEdit, SIGNAL(valueChanged(void)), this, SLOT(textChanged(void))); m_titleEdit->SetMaxLength(128); m_subtitleEdit->SetMaxLength(128); connect(m_descriptionEdit, SIGNAL(valueChanged(void)), this, SLOT(textChanged(void))); m_descriptionEdit->SetMaxLength(0); connect(m_clauseList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(clauseChanged(MythUIButtonListItem *))); connect(m_clauseList, SIGNAL(itemClicked(MythUIButtonListItem *)), SLOT(clauseClicked(MythUIButtonListItem *))); connect(m_testButton, SIGNAL(Clicked()), SLOT(testClicked())); connect(m_recordButton, SIGNAL(Clicked()), SLOT(recordClicked())); connect(m_storeButton, SIGNAL(Clicked()), SLOT(storeClicked())); connect(m_cancelButton, SIGNAL(Clicked()), SLOT(Close())); loadData(); BuildFocusList(); return true; }
bool CustomPriority::Create() { if (!LoadWindowFromXML("schedule-ui.xml", "custompriority", this)) return false; m_ruleList = dynamic_cast<MythUIButtonList *>(GetChild("rules")); m_clauseList = dynamic_cast<MythUIButtonList *>(GetChild("clauses")); m_prioritySpin = dynamic_cast<MythUISpinBox *>(GetChild("priority")); m_titleEdit = dynamic_cast<MythUITextEdit *>(GetChild("title")); m_descriptionEdit = dynamic_cast<MythUITextEdit *>(GetChild("description")); m_addButton = dynamic_cast<MythUIButton *>(GetChild("add")); m_installButton = dynamic_cast<MythUIButton *>(GetChild("install")); m_testButton = dynamic_cast<MythUIButton *>(GetChild("test")); m_deleteButton = dynamic_cast<MythUIButton *>(GetChild("delete")); m_cancelButton = dynamic_cast<MythUIButton *>(GetChild("cancel")); if (!m_ruleList || !m_clauseList || !m_prioritySpin || !m_titleEdit || !m_descriptionEdit || !m_addButton || !m_installButton || !m_testButton || !m_deleteButton || !m_cancelButton) { LOG(VB_GENERAL, LOG_ERR, "CustomPriority, theme is missing required elements"); return false; } connect(m_ruleList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(ruleChanged(MythUIButtonListItem *))); connect(m_titleEdit, SIGNAL(valueChanged()), SLOT(textChanged())); m_titleEdit->SetMaxLength(128); connect(m_descriptionEdit, SIGNAL(valueChanged()), SLOT(textChanged())); m_descriptionEdit->SetMaxLength(0); connect(m_addButton, SIGNAL(Clicked()), SLOT(addClicked())); connect(m_testButton, SIGNAL(Clicked()), SLOT(testClicked())); connect(m_installButton, SIGNAL(Clicked()), SLOT(installClicked())); connect(m_deleteButton, SIGNAL(Clicked()), SLOT(deleteClicked())); connect(m_cancelButton, SIGNAL(Clicked()), SLOT(Close())); loadData(); BuildFocusList(); return true; }
KSocksConfig::KSocksConfig(QWidget *parent) : KCModule(parent, "kcmkio") { KAboutData *about = new KAboutData(I18N_NOOP("kcmsocks"), I18N_NOOP("KDE SOCKS Control Module"), 0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 2001 George Staikos")); about->addAuthor("George Staikos", 0, "*****@*****.**"); setAboutData( about ); QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); base = new SocksBase(this); layout->add(base); connect(base->_c_enableSocks, SIGNAL(clicked()), this, SLOT(enableChanged())); connect(base->bg, SIGNAL(clicked(int)), this, SLOT(methodChanged(int))); // The custom library connect(base->_c_customPath, SIGNAL(openFileDialog(KURLRequester *)), this, SLOT(chooseCustomLib(KURLRequester *))); connect(base->_c_customPath, SIGNAL(textChanged(const QString&)), this, SLOT(customPathChanged(const QString&))); // Additional libpaths connect(base->_c_newPath, SIGNAL(openFileDialog(KURLRequester *)), this, SLOT(chooseCustomLib(KURLRequester *))); connect(base->_c_newPath, SIGNAL(returnPressed(const QString&)), this, SLOT(addThisLibrary(const QString&))); connect(base->_c_newPath, SIGNAL(textChanged(const QString&)), this, SLOT(libTextChanged(const QString&))); connect(base->_c_add, SIGNAL(clicked()), this, SLOT(addLibrary())); connect(base->_c_remove, SIGNAL(clicked()), this, SLOT(removeLibrary())); connect(base->_c_libs, SIGNAL(selectionChanged()), this, SLOT(libSelection())); // The "Test" button connect(base->_c_test, SIGNAL(clicked()), this, SLOT(testClicked())); // The config backend load(); }
bool_t CC_CALL UIList::userEvent(const int32_t _eventID, const cc_uint_t _data1, const cc_uint_t _data2) { if (!ISSET_BIT(CGE_GUI_VISIBLE, flags) || !ISSET_BIT(CGE_GUI_ENABLED, flags)) { return FALSE; } switch(_eventID) { case CGE_GUI_LBUTTONDOWN: { int32_t left = CC_LO_WORD(_data2); int32_t top = CC_HI_WORD(_data2); downSelect = -1; fsriction = 0.98f; startTime = cc_get_ticks(); if (list.count <= 0) { return FALSE; } if (hitTest(left, top) == FALSE) return FALSE; isMoved = FALSE; lMouseDown = TRUE; startPosition.set(left, top); lastPosition.set(left, top); deltaPosition.set(0.0f, 0.0f); downSelect = testClicked(left, top); return TRUE; } case CGE_GUI_LBUTTONUP: { isMoved = FALSE; if (lMouseDown == FALSE) { return FALSE; } int32_t left = CC_LO_WORD(_data2); int32_t top = CC_HI_WORD(_data2); lMouseDown = FALSE; if (startPosition.x == left && startPosition.y == top) { deltaPosition.x = 0; deltaPosition.y = 0; if (downSelect == -1) { return TRUE; } cc_double_iterator_t *findSelect = NULL; if (downSelect == testClicked(left, top)) { cc_double_iterator_t *find = first; for (int32_t i = offsetStart; i < offsetEnd; i++) { if (i == downSelect) { findSelect = find; break; } if (find) { find = find->next; } } select = downSelect; } if (findSelect && eventCall && ISSET_BIT(CGE_GUI_EVENT_CLICK, eventFlags) == CGE_GUI_EVENT_CLICK) { eventCall->eventUI(id, CGE_GUI_EVENT_CLICK, (cc_uint_t)findSelect); } } else { float df = UIListSpeed * delta; if(offset >= 0 && offset < maxOffset){ int32_t dealy = (int32_t)(cc_get_ticks() - startTime); if (dealy > 0) { if (dealy > 500) { fsriction = 0.98f; } else { fsriction = 0.90f; df *= (1000/dealy); } if ((startPosition.y - top) < 0) { df *= -1; } deltaPosition.x += df; deltaPosition.y += df; } } } downSelect = -1; return TRUE; } case CGE_GUI_MOUSEMOVE: { int32_t left = CC_LO_WORD(_data2); int32_t top = CC_HI_WORD(_data2); if (lMouseDown == FALSE) { return FALSE; } isMoved = TRUE; offset += (lastPosition.y - top); deltaPosition.set(0.0f, 0.0f); lastPosition.set(left, top); if(offset >= 0 && offset < maxOffset) { first = cc_double_link_first(&list); if (first) { offsetStart = offset / lineHeight; offsetEnd = (offset + (int32_t)viewRect.getHeight() + lineHeight) / lineHeight; for (int32_t i = 0; i < offsetStart; i++) { first = first->next; if (first == NULL) { break; } } } } return TRUE; } } return UIBase::userEvent(_eventID, _data1, _data2); }