hash.h 4.15 KB
Newer Older
Ingemar Ceicer's avatar
Ingemar Ceicer committed
1 2
/*
    hashSum
Ingemar Ceicer's avatar
Ingemar Ceicer committed
3
    Copyright (C) 2011-2017 Ingemar Ceicer
Ingemar Ceicer's avatar
Ingemar Ceicer committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
    http://ceicer.org/
    programmering1 (at) ceicer (dot) org

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
*/

#ifndef HASH_H
#define HASH_H

#include <string>
#include <sstream>
#include <fstream>
#include "checkforupdates.h"
#include "config.h"
#include "extqlineedit.h"
#include <QSysInfo>
#include <QtWidgets>
#include <QTextCodec>

Ingemar Ceicer's avatar
Ingemar Ceicer committed
31 32 33 34 35
/* draganddrop */
#include <QDropEvent>
#include <QUrl>
#include <QDebug>

Ingemar Ceicer's avatar
Ingemar Ceicer committed
36 37 38 39 40


#define VERSION_PATH "http://bin.ceicer.com/hash/version.txt"
#define APPLICATION_NAME "hashSum"
#define EXECUTABLE_NAME "hashsum"
Ingemar Ceicer's avatar
Ingemar Ceicer committed
41
#define VERSION "2.2.6"
Ingemar Ceicer's avatar
Ingemar Ceicer committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#define BUILD_DATE_TIME __DATE__ " " __TIME__
#define CURRENT_YEAR "2017"
#define LICENCE_VERSION "3"
#define PROGRAMMER_EMAIL "programmering1@ceicer.org"
#define PROGRAMMER_NAME "Ingemar Ceicer"
#define PROGRAMMER_PHONE "+46706361747"
#define APPLICATION_HOMEPAGE "http://ceicer.org/hash/index.php"
#define APPLICATION_HOMEPAGE_ENG "http://ceicer.org/hash/index_eng.php"
#define elGR_TRANSLATOR "www.geogeo.gr"
#define deDE_TRANSLATOR "Benjamin Weis"

#define QLINEEDIT_MAX 32767
#define SIZE_OF_RECENT_FILES 50




namespace Ui {
60
class Hash;
Ingemar Ceicer's avatar
Ingemar Ceicer committed
61 62
}
namespace Ui {
63
class Lic;
Ingemar Ceicer's avatar
Ingemar Ceicer committed
64 65
}

66
class Hash : public QMainWindow {
Ingemar Ceicer's avatar
Ingemar Ceicer committed
67 68 69 70 71 72 73 74
    Q_OBJECT

public:
    explicit Hash(QWidget *parent = 0);
    ~Hash();


protected:
Ingemar Ceicer's avatar
Ingemar Ceicer committed
75 76 77
    /* draganddrop */
    void dropEvent(QDropEvent *ev);
    void dragEnterEvent(QDragEnterEvent *ev);
Ingemar Ceicer's avatar
Ingemar Ceicer committed
78 79 80 81


private:
    Ui::Hash *ui;
Ingemar Ceicer's avatar
Ingemar Ceicer committed
82
    Ui::Lic *ui2;
Ingemar Ceicer's avatar
Ingemar Ceicer committed
83 84 85 86 87 88
    Config  *k;
    QDialog *d;

    void setStartConfig();
    void setEndConfig();
    bool doChecksum(QString);
89
    bool doChecksum(QString, QStringList *lista);
Ingemar Ceicer's avatar
Ingemar Ceicer committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    bool doChecksumText(const QString);
    bool doChecksumList(QString, QString &, std::string);
    bool doCompare(QString, QString);
    bool askForFileName(QString,std::string,QStringList);
    bool askForFileNameCheck(QString,std::string,QStringList);
    bool dontAskForFileName(std::string,QStringList);
    QString datumtid();
    bool rekursivt(QDir,QString);
    bool rekursivtPrint(QString,QString,QDir,std::string);
    int hurmangaFoldrar;
    void checkSumList(int);
    int hurmangaFiler;
    bool createDeb(QString sokvag2,QStringList fileNames);
    QString getSystem();
    bool rekursivtDeb(QDir path, QString &indent, QStringList &allt);
    bool rekursivtPrintDeb(QDir path,QStringList &allt);

    bool recentFileList(QString);
    QStringList recentFiles;
    int MAX_RECENT_FILES;
110

Ingemar Ceicer's avatar
Ingemar Ceicer committed
111
    QStringList algoritmer;
112
    QStringList *lista;
Ingemar Ceicer's avatar
Ingemar Ceicer committed
113 114 115 116 117 118 119 120 121 122 123


private slots:
    void checkForUpdates();
    void about();
    void checkOnStart();
    void saveChecksumListWhereFilesAre();
    void md4();
    void md5();
    void sha1();

124 125 126 127 128 129 130 131
    void sha224();
    void sha256();
    void sha384();
    void sha512();
    void sha3_224();
    void sha3_256();
    void sha3_384();
    void sha3_512();
Ingemar Ceicer's avatar
Ingemar Ceicer committed
132 133 134 135


    void compare();
    void checksum();
136

Ingemar Ceicer's avatar
Ingemar Ceicer committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
    void swedish();
    void english();
    void german();
    void greek();
    void checkSumListInit();
    void checkSumLists();
    void compareGivenHashSum();
    void defaultFileName();
    void writeTimeDateInHashSumFile();
    void findChangedFiles();
    void useNativeDialogs();
    void allwaysOpenHomeDirectory();
    void copyPath();
    void copyHashSum();
    void hashSumText();
    void compareHashSumText();
    void help();
    void license();
    void versionhistory();
    void createDebianMd5sums();
    void createDebianMd5sumsAuto();
    void showFullPathInHashSumFile();

    void slotRecentFiles();
    void recentFileRequested(const QString path);
    void setRecentFiles();
    void clearRecentFiles();
    void stang();

    void openHashSumList();
    void openComparisonList();
    void openFile();

Ingemar Ceicer's avatar
Ingemar Ceicer committed
170
    void save();
171
    void saveOne();
Ingemar Ceicer's avatar
Ingemar Ceicer committed
172

Ingemar Ceicer's avatar
Ingemar Ceicer committed
173

Ingemar Ceicer's avatar
Ingemar Ceicer committed
174 175 176 177 178 179
public slots:


};

#endif // HASH_H