WebTabPanel::WebTabPanel(BirdBox *t,ImageCache *c,QWidget *parent) : TabPanel(parent),statusUser(0) { type=1; tweets=t; cache=c; layout=new QVBoxLayout(); widget()->setLayout(layout); state=0; web=new QWebView(this); QObject::connect(web,SIGNAL(loadFinished(bool)),this,SLOT(handleLoadFinished(bool))); QObject::connect(web,SIGNAL(loadStarted()),this,SLOT(handleLoadStarted())); QObject::connect(web,SIGNAL(urlChanged(const QUrl&)),this,SLOT(handleUrlChanged(const QUrl&))); QObject::connect(web,SIGNAL(linkClicked(const QUrl&)),this,SLOT(handleLinkClicked(const QUrl&))); QObject::connect(this,SIGNAL(followUserByScreenName(QString)),t,SIGNAL(followUserByScreenName(QString))); QObject::connect(t,SIGNAL(haveUpdatedUser(TweetUser*)),this,SLOT(handleUpdatedUser(TweetUser*))); QObject::connect(c,SIGNAL(update(QString)),this,SLOT(updateImage(QString))); QObject::connect(&timer,SIGNAL(timeout()),this,SLOT(handleTimeout())); statusArea = new QWidget(this); statusArea->setLayout(new QHBoxLayout()); statusIcon = new QLabel(this); statusIcon->setMaximumSize(32,32); statusIcon->setScaledContents(true); message = new QLabel(this); message->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum); statusArea->layout()->setAlignment(Qt::AlignLeft); statusArea->layout()->addWidget(statusIcon); statusArea->layout()->addWidget(message); statusArea->layout()->setMargin(0); statusArea->layout()->setSpacing(1); infoArea = new QWidget(this); loadingText = new QLabel(this); loadingText->setText("Please wait, connecting to twitter..."); progress = new QProgressBar(this); progress->setRange(0,0); progress->setMaximumHeight(15); progress->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum); loadingText->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Maximum); infoArea->setLayout(new QHBoxLayout()); infoArea->layout()->addWidget(loadingText); infoArea->layout()->addWidget(progress); infoArea->layout()->setMargin(0); infoArea->layout()->setSpacing(1); layout->setAlignment(Qt::AlignTop); layout->addWidget(statusArea); layout->addWidget(infoArea); layout->addWidget(web); //web->hide(); web->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled,false); web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); web->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); setWidgetResizable(true); resetPage(); handleTimeout(); }
void ImageView::setImage(const QPixmap &img, const QSize &splits) { m_image = img; m_imgHSplits = splits.width(); m_imgVSplits = splits.height(); m_imgWidth = (m_image.width()+m_imgHSplits-1)/m_imgHSplits; m_imgHeight = (m_image.height()+m_imgVSplits-1)/m_imgVSplits;; printf("ImageView::setImage img=%dx%d splits=%dx%d\n", img.width(), img.height(), splits.width(), splits.height()); resetPage(); }
void WebTabPanel::handleUrlChanged(const QUrl &u) { QString url = u.toString(); // QMessageBox::information (0,"assdf",url); if (!(url=="" ||url=="http://twitter.com/login" ||url=="http://twitter.com/invitations/find_on_twitter" ||url.startsWith(tr("http://twitter.com"))) ) { QTimer::singleShot(0,this,SLOT(resetPage())); //web->page()->mainFrame()->evaluateJavaScript("alert('boo')"); } }
void QInstallPage::initializeConnections() { /* MTest processes: Tests to find system specific functions */ connect( this, SIGNAL( egsCUtilsCreated() ), this, SLOT( test_c_utils() ) ); n_config_steps += 25; connect( this, SIGNAL( egsCUtilsTested() ), this, SLOT( test_load_beamlib() ) ); connect( this, SIGNAL( egsCUtilsEnded() ), this, SLOT( createSystemFiles() ) ); connect( this, SIGNAL( egsCUtilsFailed() ), this, SLOT( createSystemFiles() ) ); connect( this, SIGNAL( LoadBeamLibTested() ), this, SLOT( createSystemFiles() ) ); /* Make processes: Only need to go to folder and execute 'make' */ connect( this, SIGNAL( systemCreated( ushort ) ), this, SLOT( buildEGSnrc( ushort ) ) ); connect( this, SIGNAL( nextBuildStep( ushort )), this, SLOT( buildEGSnrc( ushort )) ); connect( this, SIGNAL( cppSystemCreated( ushort ) ), this, SLOT( buildEGSnrc( ushort ) ) ); /* Environment Configuration */ connect( this, SIGNAL( cppBuildFinalized() ), this, SLOT( copy_user_codes() ) ); connect( this, SIGNAL( userCodesCopied() ), this, SLOT( beamInstall() ) ); connect( this, SIGNAL( beamDone() ), this, SLOT( environmentSetUp() ) ); connect( this, SIGNAL( skipBeam() ), this, SLOT( environmentSetUp() ) ); connect( this, SIGNAL( environmentSet() ), this, SIGNAL( AllDone() ) ); connect( this, SIGNAL( AllDone() ), this, SLOT( resetPage() ) ); }
void verifyAndTreatPageFault(unsigned int pageAddress) { // Page fault? if((presentCount+1)*pageSize > memSize) { DEBUG("Page fault!\n"); pageFaultCount++; tpPage *pageToBeReplaced = nextPageToBeReplaced(); if(pageToBeReplaced->isModified) { DEBUG("Writing page before replacing it"); writingCount++; } if(pageToBeReplaced == NULL) { DEBUG("Error, no page choosed"); exit(1); } else { removePresentPage(pageToBeReplaced); resetPage(pageToBeReplaced); } } else { presentCount++; } }
//=============================================== // XDisplayGeometry virtual slots... //----------------------------------------------- bool XDisplayGeometry::slotRun (int index) { // ... // this page does not need to offer a dialog because // we will call an external program called XFine here // --- if (index == Geometry) { // log(L_INFO,"XDisplayGeometry::call XFine...\n"); // ... // next is calling the external program called xfine // the return code of the program which is written to // stdout will tell us how to proceed // --- // 1: xfine was successful, but the user canceled. // 2: xfine was successful. The user selected "Save settings" // --- bool modelineChanged = false; // ... // get the mFiles pointer wrapper from the Intro // object which has read all the data files // --- QDict<XFile>* mFilePtr = mIntro->getFiles(); XWrapFile < QDict<XFile> > mFiles (mFilePtr); // ... // call xfine now and handle the return value... // --- removeXFineCache(); XRunXFine xfineThread; xfineThread.start(); mFrame -> disableInteraction(); while (xfineThread.running()) { qApp->processEvents(); usleep (50000); } mFrame -> enableInteraction(); int code = xfineThread.getReturnCode(); switch (code) { case 0: log (L_ERROR, "XDisplayGeometry::XFine called failed\n" ); break; case 1: modelineChanged = false; break; case 2: modelineChanged = true; break; } // ... // if the xfine call has build the modeline cache // holding the modeline changes we had to set the // ImportXFineCache variable for all desktops // --- if (modelineChanged) { XData* sys = NULL; XFile* map = mFiles["sys_DESKTOP"]; for (int n=0; n < map->getDeviceCount(); n++) { sys = map -> getDevice (n); if (! sys) { continue; } sys -> setPair ("ImportXFineCache","yes"); } resetPage ( PAGE_RELOAD ); } } #if 0 if (XTemplate::slotRun (index)) { log(L_INFO,"XDisplayGeometry::slotRun() called: %d\n",index); // ... // this function is called if the geometry page is activated. // use this function to init the dialog with the current // setup of the geometry // --- mStatus -> message (mText["RunXGeometry"]); } #endif return (TRUE); }
PropertiesEditor::PropertiesEditor(QWidget* parent, const arrayElement& ae) : QDialog(parent) { // Setup the user interface ui.setupUi(this); // Data members objpath = ae.objpath; objmap = ae.objmap; sl_ipv4_method << "dhcp" << "manual" << "off"; sl_ipv6_method << "auto" << "manual" << "off"; sl_ipv6_privacy << "disabled" << "enabled" << "prefered"; // misspelling prefered is necessary sl_proxy_method << "direct" << "auto" << "manual"; // Setup comboboxes ui.comboBox_ipv4method->addItems(TranslateStrings::cmtr_sl(sl_ipv4_method) ); ui.comboBox_ipv6method->addItems(TranslateStrings::cmtr_sl(sl_ipv6_method) ); ui.comboBox_ipv6privacy->addItems(TranslateStrings::cmtr_sl(sl_ipv6_privacy) ); ui.comboBox_proxymethod->addItems(TranslateStrings::cmtr_sl(sl_proxy_method) ); // Setup the address validator and apply it to any ui QLineEdit. // The lev validator will validate an IP address or up to one white space character (to allow // editing of the line edit). const QString s_ip4 = "(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])"; const QString s_ip6 = "(?:[0-9a-fA-F]{1,4})"; const QString s_dom = "((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,6}"; // QLineEdits that allow single address QRegularExpression rx4("\\s?|^" + s_ip4 + "(?:\\." + s_ip4 + "){3}" + "$"); QRegularExpression rx6("\\s?|^" + s_ip6 + "(?::" + s_ip6 + "){7}" + "$"); QRegularExpressionValidator* lev_4 = new QRegularExpressionValidator(rx4, this); QRegularExpressionValidator* lev_6 = new QRegularExpressionValidator(rx6, this); ui.lineEdit_ipv4address->setValidator(lev_4); ui.lineEdit_ipv4netmask->setValidator(lev_4); ui.lineEdit_ipv4gateway->setValidator(lev_4); ui.lineEdit_ipv6address->setValidator(lev_6); ui.lineEdit_ipv6gateway->setValidator(lev_6); // now QLineEdits that allow multiple addresses QRegularExpression rx46d("\\s?|((" + s_ip4 + "(?:\\." + s_ip4 + "){3}|"+ s_ip6 + "(?::" + s_ip6 + "){7}|" + s_dom + ")(\\s*[,|;|\\s]\\s*))+"); QRegularExpressionValidator* lev_m = new QRegularExpressionValidator(rx46d, this); ui.lineEdit_nameservers->setValidator(lev_m); ui.lineEdit_timeservers->setValidator(lev_m); // initialize and populate submaps ipv4map.clear(); ipv6map.clear(); proxmap.clear(); shared::extractMapData(ipv4map, objmap.value("IPv4.Configuration") ); shared::extractMapData(ipv6map, objmap.value("IPv6.Configuration") ); shared::extractMapData(proxmap, objmap.value("Proxy.Configuration") ); // Seed initial values in the dialog. ui.checkBox_autoconnect->setChecked(objmap.value("AutoConnect").toBool() ); ui.lineEdit_nameservers->setText(objmap.value("Nameservers.Configuration").toStringList().join("\n") ); ui.lineEdit_timeservers->setText(objmap.value("Timeservers.Configuration").toStringList().join("\n")); ui.lineEdit_domains->setText(objmap.value("Domains.Configuration").toStringList().join("\n")); // ipv4 page if (! ipv4map.value("Method").toString().isEmpty() ) { ui.comboBox_ipv4method->setCurrentIndex(sl_ipv4_method.indexOf(QRegExp(ipv4map.value("Method").toString())) ); } ui.lineEdit_ipv4address->setText(ipv4map.value("Address").toString() ); ui.lineEdit_ipv4netmask->setText(ipv4map.value("Netmask").toString() ); ui.lineEdit_ipv4gateway->setText(ipv4map.value("Gateway").toString() ); // ipv6 page if (! ipv6map.value("Method").toString().isEmpty() ) { ui.comboBox_ipv6method->setCurrentIndex(sl_ipv6_method.indexOf(QRegularExpression(ipv6map.value("Method").toString())) ); } ui.spinBox_ipv6prefixlength->setValue(ipv6map.value("PrefixLength").toUInt() ); ui.lineEdit_ipv6address->setText(ipv6map.value("Address").toString() ); ui.lineEdit_ipv6gateway->setText(ipv6map.value("Gateway").toString() ); if (! ipv6map.value("Privacy").toString().isEmpty() ) { ui.comboBox_ipv6privacy->setCurrentIndex(sl_ipv6_privacy.indexOf(QRegularExpression(ipv6map.value("Privacy").toString())) ); } // proxy page if (! proxmap.value("Method").toString().isEmpty() ) { ui.comboBox_proxymethod->setCurrentIndex(sl_proxy_method.indexOf(QRegularExpression(proxmap.value("Method").toString())) ); } ui.lineEdit_proxyservers->setText(proxmap.value("Servers").toStringList().join("\n") ); ui.lineEdit_proxyexcludes->setText(proxmap.value("Excludes").toStringList().join("\n") ); ui.lineEdit_proxyurl->setText(proxmap.value("URL").toString() ); // connect signals to slots connect(ui.toolButton_whatsthis, SIGNAL(clicked()), this, SLOT(showWhatsThis())); connect(ui.pushButton_resetpage, SIGNAL(clicked()), this, SLOT(resetPage())); connect(ui.pushButton_resetall, SIGNAL(clicked()), this, SLOT(resetAll())); connect(ui.pushButton_ok, SIGNAL(clicked()), this, SLOT(updateConfiguration())); }
boolean queryAlerts(char *params,char *actName,char *result){ struct Alert alert ; //告警 char value[1000]; //中间变量 char temp[300]; //临时变量 struct Alerts *alerts; //告警信息链表 struct Alerts *p; //告警信息变量 struct Alert *rAlert; //返回链表中的告警信息 struct Page page; //分页 //重围告警空间 resetAlert(&alert); //根据字符串参数设置User setAlertByString(&alert,params); //重置分页空间 resetPage(&page); //根据字符串参数设置Page setPageByString(&page,params); //计算分页数据 calculatePage(&page); struct TimeRange tr; //查询条件时间段范围 //根据字符串参数设置TimeRange setTimeRangByString(&tr,params); //告警状态 //调用DAO层进行查询 if(!strcmp(actName,"queryAllAlerts")){ if(!queryAllAlertsDao(&alert,&page,&tr,&alerts)){ return false ; } }else if(!strcmp(actName,"queryCurrentAlerts")){ if(!queryCurrentAlertsDao(&alert,&page,&tr,&alerts)){ return false ; } } char list[4096] = ""; //查询列表 //初始化 strcpy(result,""); //设置返回信息 sprintf(value,"actName=%s;result=true;",actName); strcat(result,value); //设置分页信息 sprintf(value,"current=%d;pageSize=%d;total=%d;",page.current,page.pageSize,page.total); strcat(result,value); //设置告警记录 strcat(result,"list="); p = alerts; //无符合条件的记录 if(alerts->next == NULL){ strcat(list,"none;"); strcat(result,list); //释放链表内存 releaseUsersMemory(alerts); return true; } //有符合条件的记录 while(alerts->next){ //取出链表下一结点 alerts = alerts->next; if(alerts == NULL){ break; } //取出当前结点的内容记录 rAlert = alerts->alert; /* *设置返回数据 */ //创建时间 if(getValueByName(params,"begintime",value)){ if(rAlert->begintime == 0){ strcpy(value,"begintime_0,"); //表示该项无值 }else{ //转换成标准时间数据 long2TimeStr(rAlert->begintime,temp); sprintf(value,"begintime_%s,",temp); } strcat(list,value); } //恢复时间 if(getValueByName(params,"endtime",value)){ if(rAlert->endtime == 0){ strcpy(value,"endtime_0,"); //表示该项无值 }else{ //转换成标准时间数据 long2TimeStr(rAlert->endtime,temp); sprintf(value,"endtime_%s,",temp); } strcat(list,value); } //告警级别 if(getValueByName(params,"value",value)){ if(rAlert->value == 0){ sprintf(value,"value_一般告警,",temp); }else{ sprintf(value,"value_严重告警,",temp); } strcat(list,value); } //告警信息 if(getValueByName(params,"alertInfo",value)){ getAlertDesc(rAlert,temp); sprintf(value,"alertInfo_%s,",temp); strcat(list,value); } //使用#来分隔每一条记录 strcat(list,"#"); } //使用;分隔每一项内容 strcat(list,";"); strcat(result,list); //释放链表内存 releaseAlertsMemory(p); return true; }
PropertiesEditor::PropertiesEditor(QWidget* parent, const arrayElement& ae, bool (*extractMapData) (QMap<QString,QVariant>&,const QVariant&)) : QDialog(parent) { // Setup the user interface ui.setupUi(this); // Data members objpath = ae.objpath; objmap = ae.objmap; // Setup the address validator and apply it to any ui QLineEdit. // The lev validator will validate an IP address or up to one white space character (to allow // editing of the line edit). QString s_ip4 = "(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])"; QString s_ip6 = "(?:[0-9a-fA-F]{1,4})"; // QLineEdits that allow single address QRegularExpression rx4("\\s?|^" + s_ip4 + "(?:\\." + s_ip4 + "){3}" + "$"); QRegularExpression rx6("\\s?|^" + s_ip6 + "(?::" + s_ip6 + "){7}" + "$"); QRegularExpressionValidator* lev_4 = new QRegularExpressionValidator(rx4, this); QRegularExpressionValidator* lev_6 = new QRegularExpressionValidator(rx6, this); ui.lineEdit_ipv4address->setValidator(lev_4); ui.lineEdit_ipv4netmask->setValidator(lev_4); ui.lineEdit_ipv4gateway->setValidator(lev_4); ui.lineEdit_ipv6address->setValidator(lev_6); ui.lineEdit_ipv6gateway->setValidator(lev_6); // now QLineEdits that allow multiple addresses QRegularExpression rx46("\\s?|((" + s_ip4 + "(?:\\." + s_ip4 + "){3}|" + s_ip6 + "(?::" + s_ip6 + "){7})(\\s*[,|;|\\s]\\s*))+"); QRegularExpressionValidator* lev_m = new QRegularExpressionValidator(rx46, this); ui.lineEdit_nameservers->setValidator(lev_m); ui.lineEdit_timeservers->setValidator(lev_m); // initialize and populate submaps ipv4map.clear(); ipv6map.clear(); proxmap.clear(); extractMapData(ipv4map, objmap.value("IPv4.Configuration") ); extractMapData(ipv6map, objmap.value("IPv6.Configuration") ); extractMapData(proxmap, objmap.value("Proxy.Configuration") ); // Seed initial values in the dialog. ui.checkBox_autoconnect->setChecked(objmap.value("AutoConnect").toBool() ); ui.lineEdit_nameservers->setText(objmap.value("Nameservers.Configuration").toStringList().join("\n") ); ui.lineEdit_timeservers->setText(objmap.value("Timeservers.Configuration").toStringList().join("\n")); ui.lineEdit_domains->setText(objmap.value("Domains.Configuration").toStringList().join("\n")); // ipv4 page if (! ipv4map.value("Method").toString().isEmpty() ) { ui.comboBox_ipv4method->setCurrentIndex(ui.comboBox_ipv4method->findText(ipv4map.value("Method").toString(), Qt::MatchFixedString) ); } ui.lineEdit_ipv4address->setText(ipv4map.value("Address").toString() ); ui.lineEdit_ipv4netmask->setText(ipv4map.value("Netmask").toString() ); ui.lineEdit_ipv4gateway->setText(ipv4map.value("Gateway").toString() ); // ipv6 page if (! ipv6map.value("Method").toString().isEmpty() ) { ui.comboBox_ipv6method->setCurrentIndex(ui.comboBox_ipv6method->findText(ipv6map.value("Method").toString(), Qt::MatchFixedString) ); } ui.spinBox_ipv6prefixlength->setValue(ipv6map.value("PrefixLength").toUInt() ); ui.lineEdit_ipv6address->setText(ipv6map.value("Address").toString() ); ui.lineEdit_ipv6gateway->setText(ipv6map.value("Gateway").toString() ); if (! ipv6map.value("Privacy").toString().isEmpty() ) { ui.comboBox_ipv6privacy->setCurrentIndex(ui.comboBox_ipv6privacy->findText(ipv6map.value("Privacy").toString(), Qt::MatchFixedString) ); } // proxy page if (! proxmap.value("Method").toString().isEmpty() ) { ui.comboBox_proxymethod->setCurrentIndex(ui.comboBox_proxymethod->findText(proxmap.value("Method").toString(), Qt::MatchFixedString) ); } ui.lineEdit_proxyservers->setText(proxmap.value("Servers").toStringList().join("\n") ); ui.lineEdit_proxyexcludes->setText(proxmap.value("Excludes").toStringList().join("\n") ); ui.lineEdit_proxyurl->setText(proxmap.value("URL").toString() ); // connect signals to slots connect(ui.toolButton_whatsthis, SIGNAL(clicked()), this, SLOT(showWhatsThis())); connect(ui.pushButton_resetpage, SIGNAL(clicked()), this, SLOT(resetPage())); connect(ui.pushButton_resetall, SIGNAL(clicked()), this, SLOT(resetAll())); connect(ui.pushButton_ok, SIGNAL(clicked()), this, SLOT(updateConfiguration())); }