int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); //设置日志接口 QFileLogger::InitLog(); SetLogger(new QFileLogger); QFile styleSheet("./../qssfiles/style.qss"); if(!styleSheet.open(QIODevice::ReadOnly)) { qWarning("style sheet load fail!"); QMessageBox::warning(NULL, QObject::tr("警告"), QObject::tr("布局文件打开失败,页面无法正常布局")); } a.setStyleSheet(styleSheet.readAll()); setGlobalValue(Maintain::LaneIp, "192.168.26.219"); setGlobalValue(Maintain::LanePassword, "1q2w3e"); setGlobalValue(Maintain::LaneUser, "root"); AutoUpdate updateSoftware; if(!updateSoftware.softWareUpdate()) { int code=QMessageBox::warning(NULL,QObject::tr("软件更新"),QObject::tr("软件更新失败:%1") .arg(updateSoftware.getErrorMessage()),QMessageBox::Ok); if(code==QMessageBox::Ok) return -1; } FormMain w; LogMsg("RSU",QObject::tr("12skl;ghsirhgpuisrhgiuhipaeru")); w.show(); return a.exec(); }
bool Variable::put(types::InternalType* _pIT, int _iLevel) { if (isGlobal() && isGlobalVisible(_iLevel)) { setGlobalValue(_pIT); return true; } if (empty() || top()->m_iLevel < _iLevel) { //create a new level last = new ScopedVariable(_iLevel, _pIT); stack.push(last); _pIT->IncreaseRef(); } else { //update current level types::InternalType* pIT = top()->m_pIT; if (pIT != _pIT) { //check macro redefinition if (_pIT->isMacro()) { int iFuncProt = ConfigVariable::getFuncprot(); if (iFuncProt != 0) { bool bEquals = true; if (pIT && pIT->isCallable()) { if (pIT->isMacroFile()) { types::MacroFile* pMF = pIT->getAs<types::MacroFile>(); bEquals = *pMF->getMacro() == *_pIT; } else if (pIT->isMacro()) { types::Macro* pM = pIT->getAs<types::Macro>(); bEquals = *pM == *_pIT; } } if (bEquals == false) { if (iFuncProt == 2) { return false; } if (ConfigVariable::getWarningMode()) { wchar_t pwstFuncName[1024]; os_swprintf(pwstFuncName, 1024, L"%-24ls", name.getName().c_str()); char* pstFuncName = wide_string_to_UTF8(pwstFuncName); sciprint(_("Warning : redefining function: %s. Use funcprot(0) to avoid this message"), pstFuncName); sciprint("\n"); FREE(pstFuncName); } } } } // _pIT may contained in pIT // so increases ref of _pIT before kill pIT top()->m_pIT = _pIT; _pIT->IncreaseRef(); pIT->DecreaseRef(); pIT->killMe(); } } return true; }