Commit 0d4a468c authored by Ingemar Ceicer's avatar Ingemar Ceicer

Effektivisering

parent 3c47aaf4
......@@ -106,7 +106,7 @@ string Config::getConf(const string &name, const string &default_value)
return s;
}
bool Config::setConf(string name, string value)
bool Config::setConf(string name, const string &value)
{
vector<string>::iterator it;
......@@ -132,7 +132,7 @@ bool Config::setConf(string name, string value)
void Config::newConf(const string &name, string value)
void Config::newConf(const string &name, const string &value)
{
string pair = name + "=" + value;
name_values->push_back(pair);
......
......@@ -41,7 +41,7 @@ private:
bool readConf(const string &conf);
bool writeConf();
void newConf(const string &name, string value);
void newConf(const string &name, const string &value);
string *conf_file;
Createuser *cr;
......@@ -56,7 +56,7 @@ public:
string getConf(const string &name);
string getConf(const string &name, const string &default_value);
bool setConf(string name, string value);
bool setConf(string name, const string &value);
};
......
......@@ -1967,9 +1967,9 @@ void Hash::german()
case 0:
k->setConf("language", "de_DE");
const QString EXECUTE = QDir::toNativeSeparators("\"" + QCoreApplication::applicationDirPath() + "/" + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + "\"");
auto *CommProcess = new QProcess(this);
CommProcess->startDetached(EXECUTE);
delete CommProcess;
// auto *CommProcess = new QProcess(this);
QProcess::startDetached(EXECUTE);
// delete CommProcess;
close();
}
}
......@@ -2073,7 +2073,7 @@ void Hash::checkSumList(int typ)
std::string savewherefilesare = k->getConf("saveChecksumListWhereFilesAre");
delete k;
ui->progressLabel->clear();
ui->progressLabel->toolTip().clear();
//ui->progressLabel->toolTip().clear();
ui->lineEdit->clear();
if(typ == 0) {
......@@ -2297,13 +2297,13 @@ bool Hash::rekursivtPrintDeb(QDir path, QStringList &allt)
if(!lyckades)
return false;
else
allt.push_back(tillbaka + " " + stringPath.mid(pos, -1) + "/" + fileNames[i]);
allt.push_back(tillbaka + " " + stringPath.mid(pos, -1) + "/" + fileNames[i]);
}
return true;
}
bool Hash::rekursivtPrint(const QString &defaultfn, const QString &alg, QDir path, std::string writedatetime)
bool Hash::rekursivtPrint(const QString &defaultfn, const QString &alg, QDir path, const std::string &writedatetime)
{
QString conf_file_name = QDir::toNativeSeparators("/" APPLICATION_NAME ".conf");
k = new Config(conf_file_name);
......@@ -3781,23 +3781,22 @@ void Hash::save()
if(fileName.isEmpty())
return;
else {
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::critical(this, APPLICATION_NAME " " VERSION, tr("Could not save a file to store hash sums in. Check your file permissions. ") + file.errorString());
delete k;
return;
} else {
QTextStream out(&file);
out << qsdatetime;
out << textBrowserText << endl;
QDir dir;
dir = dialog->directory();
QString directoryName = dir.path();
k->setConf("save_path", directoryName.toStdString());
}
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::critical(this, APPLICATION_NAME " " VERSION, tr("Could not save a file to store hash sums in. Check your file permissions. ") + file.errorString());
delete k;
return;
}
QTextStream out(&file);
out << qsdatetime;
out << textBrowserText << endl;
QDir dir;
dir = dialog->directory();
QString directoryName = dir.path();
k->setConf("save_path", directoryName.toStdString());
}
delete k;
......@@ -3839,25 +3838,24 @@ void Hash::saveOne()
if(fileName.isEmpty())
return;
else {
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::critical(this, APPLICATION_NAME " " VERSION, tr("Could not save a file to store hash sums in. Check your file permissions. ") + file.errorString());
delete k;
return;
} else {
QTextStream out(&file);
out << qsdatetime;
out << tr("Algorithm: ") + qsalgorithm << endl;
out << path << endl;
out << shecksumman << endl;
QDir dir;
dir = dialog->directory();
QString directoryName = dir.path();
k->setConf("save_path", directoryName.toStdString());
}
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::critical(this, APPLICATION_NAME " " VERSION, tr("Could not save a file to store hash sums in. Check your file permissions. ") + file.errorString());
delete k;
return;
}
QTextStream out(&file);
out << qsdatetime;
out << tr("Algorithm: ") + qsalgorithm << endl;
out << path << endl;
out << shecksumman << endl;
QDir dir;
dir = dialog->directory();
QString directoryName = dir.path();
k->setConf("save_path", directoryName.toStdString());
}
delete k;
......
......@@ -104,7 +104,7 @@ private:
QString datumtid();
bool rekursivt(const QDir &, QString);
bool rekursivtPrint(const QString &, const QString &, QDir, std::string);
bool rekursivtPrint(const QString &, const QString &, QDir, const string &);
int hurmangaFoldrar{};
void checkSumList(int);
int hurmangaFiler{};
......
......@@ -38,7 +38,8 @@ int main(int argc, char *argv[])
#ifdef Q_OS_LINUX // Linux
QFont f = QFont("Ubuntu", 12);
#endif
a.setFont(f);
// a.setFont(f);
QApplication::setFont(f);
// End Font
// const QString INSTALL_DIR = QDir::toNativeSeparators(a.applicationDirPath() + "/");
QTranslator translator;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment