本文整理汇总了C++中showWarning函数的典型用法代码示例。如果您正苦于以下问题:C++ showWarning函数的具体用法?C++ showWarning怎么用?C++ showWarning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showWarning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
bool PumpSpreadsheet::saveDataInPump2000Format(const QString &fileName)
{
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
showWarning(tr("Cannot write file %1:\n%2.")
.arg(file.fileName())
.arg(file.errorString()));
return false;
}
QTextStream out(&file);
for (int row = 0; row < rowCount(); ++row) {
for (int column = 0; column < ColumnCount; ++column) {
out << text(row, column);
if (column < ColumnCount - 1) {
out << "\t";
} else {
out << endl;
}
}
}
file.close();
if (file.error() != QFile::NoError) {
showWarning(tr("Error when writing to %1:\n%2.")
.arg(file.fileName())
.arg(file.errorString()));
return false;
}
return true;
}
示例2: new_account
void AccountSettingsDialog::onSubmitBtnClicked()
{
if (!validateInputs()) {
return;
}
QString url = mServerAddr->text().trimmed();
if (url != account_.serverUrl.toString()) {
Account new_account(account_);
new_account.serverUrl = url;
if (seafApplet->accountManager()->replaceAccount(account_,
new_account) < 0) {
showWarning(tr("Failed to save account information"));
return;
}
QString error;
QUrl new_server_url = new_account.serverUrl;
new_server_url.setPath("/");
if (seafApplet->rpcClient()->updateReposServerHost(account_.serverUrl.host(),
new_account.serverUrl.host(), new_server_url.toString(), &error) < 0) {
showWarning(tr("Failed to save the changes: %1").arg(error));
return;
}
}
seafApplet->messageBox(tr("Successfully updated current account information"), this);
accept();
}
示例3: showWarning
QByteArray ToxDNS::fetchLastTextRecord(const QString& record, bool silent)
{
QByteArray result;
QDnsLookup dns;
dns.setType(QDnsLookup::TXT);
dns.setName(record);
dns.lookup();
int timeout;
for (timeout = 0; timeout<30 && !dns.isFinished(); ++timeout)
{
qApp->processEvents();
QThread::msleep(100);
}
if (timeout >= 30)
{
dns.abort();
if (!silent)
showWarning(tr("The connection timed out","The DNS gives the Tox ID associated to toxme.se addresses"));
return result;
}
if (dns.error() == QDnsLookup::NotFoundError)
{
if (!silent)
showWarning(tr("This address does not exist","The DNS gives the Tox ID associated to toxme.se addresses"));
return result;
}
else if (dns.error() != QDnsLookup::NoError)
{
if (!silent)
showWarning(tr("Error while looking up DNS","The DNS gives the Tox ID associated to toxme.se addresses"));
return result;
}
const QList<QDnsTextRecord> textRecords = dns.textRecords();
if (textRecords.isEmpty())
{
if (!silent)
showWarning(tr("No text record found", "Error with the DNS"));
return result;
}
const QList<QByteArray> textRecordValues = textRecords.last().values();
if (textRecordValues.length() != 1)
{
if (!silent)
showWarning(tr("Unexpected number of values in text record", "Error with the DNS"));
return result;
}
result = textRecordValues.first();
return result;
}
示例4: fetchLastTextRecord
QString ToxDNS::queryTox1(const QString& record, bool silent)
{
QString realRecord = record, toxId;
realRecord.replace("@", "._tox.");
const QString entry = fetchLastTextRecord(realRecord, silent);
if (entry.isEmpty())
return toxId;
// Check toxdns protocol version
int verx = entry.indexOf("v=");
if (verx)
{
verx += 2;
int verend = entry.indexOf(';', verx);
if (verend)
{
QString ver = entry.mid(verx, verend-verx);
if (ver != "tox1")
{
if (!silent)
showWarning(tr("The version of Tox DNS used by this server is not supported", "Error with the DNS"));
return toxId;
}
}
}
// Get the tox id
int idx = entry.indexOf("id=");
if (idx < 0)
{
if (!silent)
showWarning(tr("The DNS lookup does not contain any Tox ID", "Error with the DNS"));
return toxId;
}
idx += 3;
if (entry.length() < idx + static_cast<int>(TOX_HEX_ID_LENGTH))
{
if (!silent)
showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS"));
return toxId;
}
toxId = entry.mid(idx, TOX_HEX_ID_LENGTH);
if (!ToxId::isToxId(toxId))
{
if (!silent)
showWarning(tr("The DNS lookup does not contain a valid Tox ID", "Error with the DNS"));
return toxId;
}
return toxId;
}
示例5: showWarning
TERMINAL_ACT_INFO* GetNextNameClass::GetName(const FN_STATE_ACT_LIST* period_info,
TERMINAL_ACT_LIST* act_list,int ¤t_pos,int time_pos)
{
FNDWORD k = 0;//
if (period_info == NULL)
{
showWarning("时间表为空,请检查时间表\n");
return NULL;
}
if (act_list == NULL)
{
showWarning("节目表为空,请检查节目表\n");
return NULL;
}
if(period_info->dwSectionCnt == 0)
{
showWarning("节目表时段数量为0\n");
return NULL;
}
if(time_pos >= (int)period_info->dwSectionCnt && time_pos < 0)
{
showWarning("当前时间在时间表时段内越界\n");
return NULL;
}
current_pos = current_pos + 1;
if(current_pos >= (int)period_info->SectionList[time_pos].dwActCnt)//循环播放
{
current_pos=0;
}
showDebug("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-40\n");
//获取到一个播放的节目号,还要通过这个号码在节目表中找到具体的节目
k = period_info->SectionList[time_pos].dwActList[current_pos];
for(FNDWORD i=0;i<act_list->dwActNum;i++)
{
if(act_list->ActList[i].sActInfo.dwActID == k)
{
act_endtime = period_info->SectionList[time_pos].dwEndTime;
return &act_list->ActList[i];
}
}
showWarning("获取节目%u失败,当前时段为%u\n",k,time_pos );
act_endtime = 0;
return NULL;
}
示例6: showWarning
void InsertLinkOrPictureDialog::checkAndAccept()
{
QString text = ui->textLineEdit->text();
if(text.isEmpty() && text.trimmed().isEmpty()){
showWarning(tr("Alt Text can't be empty!"), tr("Link Text cann't be empty!"));
return;
}
QString url = ui->urlLineEdit->text();
if(url.isEmpty() && url.trimmed().isEmpty()){
showWarning(tr("Picture Url can't be empty!"), tr("Link Url cann't be empty!"));
return;
}
accept();
}
示例7: newDb
bool QgsOfflineEditing::createSpatialiteDB( const QString& offlineDbPath )
{
int ret;
sqlite3 *sqlite_handle;
char *errMsg = NULL;
QFile newDb( offlineDbPath );
if ( newDb.exists() )
{
QFile::remove( offlineDbPath );
}
// see also QgsNewSpatialiteLayerDialog::createDb()
QFileInfo fullPath = QFileInfo( offlineDbPath );
QDir path = fullPath.dir();
// Must be sure there is destination directory ~/.qgis
QDir().mkpath( path.absolutePath( ) );
// creating/opening the new database
QString dbPath = newDb.fileName();
spatialite_init( 0 );
ret = sqlite3_open_v2( dbPath.toUtf8().constData(), &sqlite_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );
if ( ret )
{
// an error occurred
QString errCause = tr( "Could not create a new database\n" );
errCause += QString::fromUtf8( sqlite3_errmsg( sqlite_handle ) );
sqlite3_close( sqlite_handle );
showWarning( errCause );
return false;
}
// activating Foreign Key constraints
ret = sqlite3_exec( sqlite_handle, "PRAGMA foreign_keys = 1", NULL, 0, &errMsg );
if ( ret != SQLITE_OK )
{
showWarning( tr( "Unable to activate FOREIGN_KEY constraints" ) );
sqlite3_free( errMsg );
sqlite3_close( sqlite_handle );
return false;
}
initializeSpatialMetadata( sqlite_handle );
// all done: closing the DB connection
sqlite3_close( sqlite_handle );
return true;
}
示例8: showWarning
void LoginDialog::onNetworkError(const QNetworkReply::NetworkError& error, const QString& error_string)
{
showWarning(tr("Network Error:\n %1").arg(error_string));
enableInputs();
mStatusText->setText("");
}
示例9: showWarning
QgsOfflineEditing::AttributeValueChanges QgsOfflineEditing::sqlQueryAttributeValueChanges( sqlite3* db, const QString& sql )
{
AttributeValueChanges values;
sqlite3_stmt* stmt = NULL;
if ( sqlite3_prepare_v2( db, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK )
{
showWarning( sqlite3_errmsg( db ) );
return values;
}
int ret = sqlite3_step( stmt );
while ( ret == SQLITE_ROW )
{
AttributeValueChange change;
change.fid = sqlite3_column_int( stmt, 0 );
change.attr = sqlite3_column_int( stmt, 1 );
change.value = QString(( const char* )sqlite3_column_text( stmt, 2 ) );
values << change;
ret = sqlite3_step( stmt );
}
sqlite3_finalize( stmt );
return values;
}
示例10: getActiveTextView
void CMainFrame::OnFileOpen(int id) {
TextView *view = getActiveTextView();
if(view == NULL) {
showWarning(_T("No active view"));
return;
}
CFileDialog dlg(TRUE);
dlg.m_ofn.lpstrFilter = getFileDialogExtension().cstr();
dlg.m_ofn.lpstrTitle = _T("Open files");
dlg.m_ofn.nFilterIndex = getOptions().m_defaultExtensionIndex;
dlg.m_ofn.Flags |= OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST;
TCHAR fileNames[1024];
fileNames[0] = 0;
dlg.m_ofn.lpstrFile = fileNames;
dlg.m_ofn.nMaxFile = ARRAYSIZE(fileNames);
if((dlg.DoModal() != IDOK) || (_tcsclen(fileNames) == 0)) {
return;
}
getOptions().m_defaultExtensionIndex = dlg.m_ofn.nFilterIndex;
TCHAR *files[3];
getFileNames(files,fileNames);
CWinDiffDoc *doc = view->getDocument();
if(_tcsclen(files[1]) == 0) { // only one selected
doc->setDoc(id, DIFFDOC_FILE, files[0]);
} else {
const String f1 = FileNameSplitter::getChildName(files[0],files[1]);
const String f2 = FileNameSplitter::getChildName(files[0],files[2]);
doc->setDocs(f1, f2);
}
Invalidate(FALSE);
}
示例11: QDialog
ccShiftAndScaleCloudDlg::ccShiftAndScaleCloudDlg( const CCVector3d& Pl,
double Dl,
const CCVector3d& Pg,
double Dg,
QWidget* parent/*=0*/)
: QDialog(parent)
, m_ui(0)
, m_applyAll(false)
, m_cancel(false)
, m_activeInfoIndex(-1)
, m_originalPoint(Pg)
, m_originalDiagonal(Dg)
, m_localPoint(Pl)
, m_localDiagonal(Dl)
, m_reversedMode(true)
{
init();
showWarning(false);
showTitle(false);
showKeepGlobalPosCheckbox(true);
showScaleItems(m_originalDiagonal > 0.0 && m_localDiagonal > 0.0);
showCancelButton(true);
//to update the GUI accordingly
onGlobalPosCheckBoxToggled(m_ui->keepGlobalPosCheckBox->isChecked());
}
示例12: UpdateData
void CEnterOptionsNameDlg::OnOK() {
UpdateData();
m_name.TrimLeft();
m_name.TrimRight();
if(m_name.GetLength() == 0) {
getNameCombo()->SetFocus();
showWarning(_T("Please enter a name"));
return;
}
const StringArray names = Options::getExistingNames();
if(names.size() >= 9 && !names.contains((LPCTSTR)m_name)) {
getNameCombo()->SetFocus();
showWarning(_T("Max 9 different settings can be saved"));
return;
}
__super::OnOK();
}
示例13: getWindowText
String getWindowText(const CWnd *wnd, int id) {
CWnd *ctrl = wnd->GetDlgItem(id);
if(ctrl == NULL) {
showWarning(_T("No dlgItem %d in window"), id);
return EMPTYSTRING;
}
return getWindowText(ctrl);
}
示例14: setWindowText
void setWindowText(CWnd *wnd, int id, const String &str) {
CWnd *ctrl = wnd->GetDlgItem(id);
if(ctrl == NULL) {
showWarning(_T("No dlgItem %d in window"), id);
return;
}
setWindowText(ctrl, str);
}
示例15: UpdateData
void CPasswordDlg::OnOK() {
UpdateData();
if(m_password != m_expectedPassword) {
showWarning(_T("Forkert kodeord"));
OnCancel();
} else {
__super::OnOK();
}
}