本文整理汇总了C++中AlertWindow::show方法的典型用法代码示例。如果您正苦于以下问题:C++ AlertWindow::show方法的具体用法?C++ AlertWindow::show怎么用?C++ AlertWindow::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlertWindow
的用法示例。
在下文中一共展示了AlertWindow::show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aboutInit
void About::aboutInit()
{
setModal(true);
resize(400, 400);
setWindowTitle("About");
setWindowIcon(QIcon("icons/backupsoft.png"));
QWidget *icon = new QWidget(this);
icon->setStyleSheet("background-image: url(icons/backupsoft.png)");
icon->setGeometry(250 , 10, 100, 100);
QLabel *title = new QLabel("BackupSoft", this);
title->setFont(QFont("Helvetica", 25, 10, false));
title->setGeometry(10, 10, 200, 30);
QLabel *version = new QLabel("Copyright 2010 by\nMichael Kohler and Fabian Gammenthaler\n\nVersion: 1.0", this);
version->setFont(QFont("Helvetica", 8, 2, false));
version->setGeometry(10, 70, 200, 55);
QTextEdit *licence = new QTextEdit(this);
licence->setGeometry(10, 160, 380, 230);
licence->setReadOnly(true);
QFile *file = new QFile("licence.txt");
if (file->open(QIODevice::ReadOnly)) {
QTextStream *stream = new QTextStream(file);
licence->setText(stream->readAll());
}
else {
QString errorMsg = "Could not open licence.txt.. Please make sure it is existent and readable.";
AlertWindow *alertWin = new AlertWindow("ERROR", "", errorMsg);
alertWin->show();
}
}
示例2: saveProfiles
void ProfileManager::saveProfiles()
{
QString name = nameField->text();
QString src = sourceField->text();
QString dest = destinationField->text();
QString state = tr("Deactivated");
if (stateBox->checkState()) {
state = tr("Activated");
}
// Check wether directory even exists
QDir *srcDir = new QDir(src);
QDir *destDir = new QDir(dest);
if (srcDir->exists() && destDir->exists()) {
QString dataString = "\n" + name + "|" + src + "|" + dest + "|" + state;
if(origin == 1) {
QByteArray dataBA = dataString.toLatin1();
helper->writeFile("profile.bs", true, dataBA);
}
if(origin == 2) {
QString oldProfile;
for(int i = 0; i < 4; i++) {
oldProfile.append(extractedInfo.value(i));
if(i != 3)
oldProfile.append('|');
}
helper->overwriteFile("profile.bs", oldProfile, true, dataString);
}
this->close();
}
else {
QString msg = tr("Either the source or the destination path doesn't exist. Please file it accordingly or create the needed directories.");
AlertWindow *alertDoesntExist = new AlertWindow("ERROR", msg);
alertDoesntExist->show();
}
}
示例3: readFile
QStringList* Helper::readFile(QString aFileName)
{
// read the data line by line
QFile *file = new QFile(aFileName);
QStringList *data = new QStringList();
if (file->open(QIODevice::ReadOnly) ) {
// file opened successfully
QTextStream *tstream = new QTextStream(file);
while (!tstream->atEnd()) {
data->append(tstream->readLine());
}
file->close();
// ignore whitespaces
for (int i = 0; i < data->length(); i++) {
if (data->value(i) == "") {
data->removeAt(i);
}
}
}
else {
QString msg = tr("Could not open %1.. Please make sure it is existent and readable.").arg(aFileName);
AlertWindow *alertWin = new AlertWindow("ERROR", msg);
alertWin->show();
}
return data;
}
示例4: overwriteFile
void Helper::overwriteFile(QString aFileName, QString aProfile, bool aAppend, QString aData)
{
QStringList *fileData;
QString data, temp;
QFile file(aFileName);
int index;
bool success;
fileData = readFile(aFileName);
for(int i = 0; i < fileData->length(); i++) {
temp = fileData->value(i);
if(temp == aProfile) {
index = i;
break;
}
}
file.open(QIODevice::WriteOnly);
success = file.remove();
if(success) {
fileData->replace(index, aData);
for(int i = 0; i < fileData->length(); i++) {
data = fileData->value(i) + "\n";
writeFile(aFileName, aAppend, data.toLatin1());
}
file.close();
}
else {
QString msg = tr("An error occured while overwriting the configuration file. We are sorry for the inconvenience.");
AlertWindow *alertWin = new AlertWindow("ERROR", msg);
alertWin->show();
}
}
示例5: writeFile
void Helper::writeFile(QString aFileName, bool aAppend, QByteArray aData)
{
QFile file(aFileName);
bool success;
if (aAppend)
success = file.open(QIODevice::WriteOnly | QIODevice::Append);
else
success = file.open(QIODevice::WriteOnly);
if (success) {
file.write(aData);
file.close();
}
else {
QString msg = tr("Could not open %1.. Please make sure it is existent and readable.").arg(aFileName);
AlertWindow *alertWin = new AlertWindow("ERROR", msg);
alertWin->show();
}
}
示例6: deleteProfile
void Helper::deleteProfile(QString aFileName, QString aProfile)
{
QStringList *fileData;
QString data, temp;
QFile file(aFileName);
int index;
bool success;
bool aAppend = true;
fileData = readFile(aFileName);
for(int i = 0; i < fileData->length(); i++) {
temp = fileData->value(i);
if(temp == aProfile) {
index = i;
break;
}
}
file.open(QIODevice::WriteOnly);
success = file.remove();
if(success) {
fileData->removeAt(index);
if (fileData->length() == 0) {
writeFile(aFileName, aAppend, data.toLatin1());
}
else {
for(int i = 0; i < fileData->length(); i++) {
data = fileData->value(i);
data.append("\n");
writeFile(aFileName, aAppend, data.toLatin1());
}
}
file.close();
}
else {
QString msg = tr("Error while overwriting the file. Please try again.");
AlertWindow *alertWin = new AlertWindow("ERROR", msg);
alertWin->show();
}
}