├── .gitignore ├── LICENSE ├── License_EN.txt ├── License_JP.txt ├── README.md ├── RapidCopy_ja_JP.qm ├── RapidCopy_ja_JP.ts ├── SS ├── RapidCopy_Linux.png └── RapidCopy_Linux_working.png ├── aboutdialog.cpp ├── aboutdialog.h ├── aboutdialog.ui ├── cfg.cpp ├── cfg.h ├── confirmdialog.cpp ├── confirmdialog.h ├── confirmdialog.ui ├── fastcopy.cpp ├── fastcopy.h ├── finactdialog.cpp ├── finactdialog.h ├── finactdialog.ui ├── help ├── RapidCopyEmailSettingExample.png ├── index.html └── index_en.html ├── icon ├── RapidCopy0.png ├── RapidCopy1.png ├── RapidCopy2.png ├── RapidCopy3.png ├── RapidCopy4.png ├── checkmark.png ├── delete_sign_filled.png └── past.png ├── jobdialog.cpp ├── jobdialog.h ├── jobdialog.ui ├── joblistrenamedialog.cpp ├── joblistrenamedialog.h ├── joblistrenamedialog.ui ├── license ├── License_EN.txt └── License_JP.txt ├── main.cpp ├── mainsettingdialog.cpp ├── mainsettingdialog.h ├── mainsettingdialog.ui ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── osl.cpp ├── osl.h ├── qblowfish.cpp ├── qblowfish.h ├── qblowfish_p.h ├── rapidcopy_main.pro ├── regexp.cpp ├── regexp.h ├── res.qrc ├── resource.h ├── smtp.cpp ├── smtp.h ├── sound ├── RapidCopy_SE_01.wav ├── RapidCopy_SE_02.wav ├── RapidCopy_SE_03.wav ├── RapidCopy_SE_04.wav ├── RapidCopy_SE_05.wav ├── RapidCopy_SE_06.wav ├── RapidCopy_SE_07.wav ├── RapidCopy_SE_08.wav ├── RapidCopy_SE_09.wav ├── RapidCopy_SE_10.wav ├── RapidCopy_SE_11.wav ├── RapidCopy_SE_12.wav ├── RapidCopy_SE_13.wav ├── RapidCopy_SE_14.wav ├── RapidCopy_SE_15.wav ├── RapidCopy_SE_16.wav ├── RapidCopy_SE_17.wav ├── RapidCopy_SE_18.wav ├── RapidCopy_SE_19.wav ├── RapidCopy_SE_20.wav ├── RapidCopy_SE_21.wav ├── RapidCopy_SE_22.wav ├── RapidCopy_SE_23.wav ├── RapidCopy_SE_24.wav ├── RapidCopy_SE_25.wav ├── RapidCopy_SE_26.wav ├── RapidCopy_SE_27.wav └── RapidCopy_SE_28.wav ├── static_bin ├── CentOS72 │ └── RapidCopy.gz ├── ubuntu1604 │ └── RapidCopy.gz └── ubuntu1804 │ └── RapidCopy.gz ├── tapi32ex.cpp ├── tapi32ex.h ├── tapi32v.cpp ├── tapi32v.h ├── tlib.h ├── tlist.cpp ├── tmisc.cpp ├── tmisc.h ├── utility.cpp ├── utility.h ├── version.cpp ├── version.h ├── xxhash.c └── xxhash.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2004-2012, SHIROUZU Hiroaki All rights reserved. 2 | Copyright 2014-2016, Kengo Sawatsu All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /License_EN.txt: -------------------------------------------------------------------------------- 1 | Copyright 2004-2012, SHIROUZU Hiroaki All rights reserved. 2 | Copyright 2014-2016, Kengo Sawatsu All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | xxHash Library 25 | Copyright (c) 2012-2014, Yann Collet 26 | All rights reserved. 27 | 28 | Redistribution and use in source and binary forms, with or without modification, 29 | are permitted provided that the following conditions are met: 30 | 31 | * Redistributions of source code must retain the above copyright notice, this 32 | list of conditions and the following disclaimer. 33 | 34 | * Redistributions in binary form must reproduce the above copyright notice, this 35 | list of conditions and the following disclaimer in the documentation and/or 36 | other materials provided with the distribution. 37 | 38 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 42 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 45 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | 49 | 50 | 51 | Copyright (c) 2013 Raivis Strogonovs 52 | Simple Smtp for Qt5 source repository : https://github.com/xcoder123/SimpleSmtp_SSL_QT5 53 | 54 | http://morf.lv 55 | 56 | Permission is hereby granted, free of charge, 57 | to any person obtaining a copy of this software and associated documentation files (the "Software"), 58 | to deal in the Software without restriction, including without limitation the rights to use, 59 | copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, 60 | and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in all copies 63 | or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 67 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 68 | DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 69 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | 71 | -------------------------------------------------------------------------------- /License_JP.txt: -------------------------------------------------------------------------------- 1 | Copyright 2004-2012, SHIROUZU Hiroaki All rights reserved. 2 | Copyright 2014-2017, Kengo Sawatsu All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | xxHash Library 25 | Copyright (c) 2012-2014, Yann Collet 26 | All rights reserved. 27 | 28 | Redistribution and use in source and binary forms, with or without modification, 29 | are permitted provided that the following conditions are met: 30 | 31 | * Redistributions of source code must retain the above copyright notice, this 32 | list of conditions and the following disclaimer. 33 | 34 | * Redistributions in binary form must reproduce the above copyright notice, this 35 | list of conditions and the following disclaimer in the documentation and/or 36 | other materials provided with the distribution. 37 | 38 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 42 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 45 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | 49 | 50 | 51 | Copyright (c) 2013 Raivis Strogonovs 52 | Simple Smtp for Qt5 source repository : https://github.com/xcoder123/SimpleSmtp_SSL_QT5 53 | 54 | http://morf.lv 55 | 56 | Permission is hereby granted, free of charge, 57 | to any person obtaining a copy of this software and associated documentation files (the "Software"), 58 | to deal in the Software without restriction, including without limitation the rights to use, 59 | copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, 60 | and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in all copies 63 | or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 67 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 68 | DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 69 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RapidCopy for GNU/Linux 2 | 3 | ![RapidCopy for Linux](https://github.com/KengoSawa2/RapidCopy/blob/master/SS/RapidCopy_Linux.png "RapidCopy for Linux") 4 | 5 | #### 概要(About) 6 | 7 | Windows系最速(?) のファイルコピー&削除ツールFastCopy v2.11のGNU/Linux移植 独自発展版です。 8 | RapidCopy is portable version of FastCopy(v2.11) that runs GNU/Linux. 9 | 10 | Linux版はFastCopy v2.11のMac移植版である[RapidCopyPro for Mac]をベースとして作成されています。 11 | Linux ver was ported from RapidCopyPro for Mac 12 | 13 | #### ライセンス(License) 14 | 全ソースを二条項BSDライセンスで公開しています。 15 | Source Code license is [BSD 2-Clause License] 16 | 17 | #### 仕様/使用方法(Specification/Usage) 18 | 19 | Japanese: 20 | https://app.lespace.co.jp/file_bl/rapidcopy/manual/linux/index.html 21 | 22 | English: 23 | https://app.lespace.co.jp/file_bl/rapidcopy/manual/linux/index_en.html 24 | 25 | 基本的な仕様は[Mac ver]と共通です。 26 | Basically, usage and specification is same as the Mac version. 27 | 28 | #### インストール(install) 29 | CentOS7.2以降およびUbuntu16.04,18.04向けには以下のバイナリがあります。 30 | (ライブラリはすべて同梱されているので、単体で動作します) 31 | 32 | The following binaries are available for CentOS 7.2(or later) and Ubuntu 16.04 and 18.04. 33 | (All libraries are included,so Work with standalone) 34 | 35 | https://github.com/KengoSawa2/RapidCopy/tree/master/static_bin 36 | 37 | #### ビルドについて(to Build) 38 | 以下のディストリビューションでコンパイル、起動確認をしています。 39 | We checked next Linux distribution. 40 | 41 | OS:CentOS7.2(x64)   42 | 必須ライブラリ(Required Library):libacl,libbsd,libattr 43 | 44 | OS:Ubuntu16.04 LTS(x64) and Ubuntu18.04 LTS(x64) 45 | 必須ライブラリ(Required Library):libattr1-dev,libbsd-dev,libacl1-dev,libgl1-mesa-dev 46 | 47 | いずれの環境でもコンパイルにはQt5.6以降とQtCreatorが必要です。 48 | 環境によってはg++などのインストールが必要かもしれません。 49 | QtCreatorを起動して、rapidcopy_main.proを読み込んでください。 50 | Qtのダウンロードは以下のURLから行えます。 51 | 52 | Qt Library(5.6 or later) and QtCreator are necessary to make. 53 | You might need to be installed other library, such as g++,depending on your environment. 54 | Start up QtCreator and read project file "rapidcopy_main.pro" 55 | Qt Framework can download here. 56 | 57 | https://www.qt.io/ 58 | 59 | デフォルトではubuntuをターゲットとしています。 60 | CentOS7でコンパイルする場合はrapidcopy_main.proのLIBS行を変更してください。 61 | Default target is Ubuntu. 62 | If you want to compile in CentOS7. Change the "LIBS" line of rapidcopy_main.pro. 63 | 64 | #### TODO 65 | - 未使用変数及びインタフェースのリファクタリング,コンパイラ警告潰し,未使用コード整理(code refactoring) 66 | - ご本家FastCopy3.xxの各種新機能の取り込み(The great original FastCopyv3.xx function import) 67 | - GNOME,KDEなどの各種デスクトップ環境へのインストール対応(support GNOME,KDE install/uninstall) 68 | - Ubuntu Software Center対応(support Ubuntu Software Center) 69 | - etc.... 70 | 71 | [help]: 72 | [RapidCopy]: 73 | [Mac ver]: 74 | -------------------------------------------------------------------------------- /RapidCopy_ja_JP.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/RapidCopy_ja_JP.qm -------------------------------------------------------------------------------- /SS/RapidCopy_Linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/SS/RapidCopy_Linux.png -------------------------------------------------------------------------------- /SS/RapidCopy_Linux_working.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/SS/RapidCopy_Linux_working.png -------------------------------------------------------------------------------- /aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : 「RapidCopyについて」 のダイアログ 6 | Reference : 7 | ======================================================================== */ 8 | 9 | #include "aboutdialog.h" 10 | #include "ui_aboutdialog.h" 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | aboutDialog::aboutDialog(QWidget *parent,Cfg *cfg_pt) : 17 | QDialog(parent), 18 | ui(new Ui::aboutDialog) 19 | { 20 | char buf[MAX_PATH + STR_NULL_GUARD]; 21 | 22 | ui->setupUi(this); 23 | sprintf(buf,ABOUT_STATIC,(char*)GetLoadStrV(IDS_FASTCOPY), GetVersionStr(), GetCopyrightStr()); 24 | ui->textEdit_vandc->append(buf); 25 | 26 | sprintf(buf,(char*)GetLoadStrV(IDS_ABOUT_WINDOWTITLE),(char*)GetLoadStrV(IDS_FASTCOPY)); 27 | this->setWindowTitle(buf); 28 | 29 | //CopyRightその2の部分表示 30 | sprintf(buf,"%s",(char*)GetVersionStr2()); 31 | ui->textEdit_vandc->append((char*)buf); 32 | ui->textEdit_vandc->append(""); 33 | 34 | //debugでbuild日付と時刻いれとこ 35 | sprintf(buf,"Build at %s %s\n",__DATE__,__TIME__); 36 | ui->textEdit_vandc->append((char*)buf); 37 | 38 | QFile license_file; 39 | if(QLocale::system().country() == QLocale::Japan){ 40 | //日本語のライセンスよみこみ 41 | license_file.setFileName(LICENSE_FILE_JP); 42 | } 43 | else{ 44 | //英語のライセンスよみこみ 45 | license_file.setFileName(LICENSE_FILE_EN); 46 | } 47 | license_file.open(QIODevice::ReadOnly); 48 | QTextStream text(&license_file); 49 | ui->textEdit_vandc->append(text.readAll()); 50 | license_file.close(); 51 | 52 | ui->textEdit_vandc->moveCursor(QTextCursor::Start); 53 | ui->textEdit_vandc->ensureCursorVisible(); 54 | ui->pushButton_tohp->setText((char*)GetLoadStrV(IDS_FASTCOPYURL)); 55 | } 56 | 57 | aboutDialog::~aboutDialog() 58 | { 59 | delete ui; 60 | } 61 | 62 | void aboutDialog::on_pushButton_tohp_clicked() 63 | { 64 | QDesktopServices::openUrl(QUrl((char*)GetLoadStrV(IDS_FASTCOPYURL),QUrl::TolerantMode)); 65 | } 66 | -------------------------------------------------------------------------------- /aboutdialog.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef ABOUTDIALOG_H 9 | #define ABOUTDIALOG_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #define ABOUT_STATIC "%s %s\n\n%s" 17 | 18 | namespace Ui { 19 | class aboutDialog; 20 | } 21 | 22 | class aboutDialog : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | explicit aboutDialog(QWidget *parent = 0,Cfg *cfg_pt=NULL); 28 | ~aboutDialog(); 29 | 30 | private slots: 31 | void on_pushButton_tohp_clicked(); 32 | 33 | private: 34 | Ui::aboutDialog *ui; 35 | }; 36 | 37 | #endif // ABOUTDIALOG_H 38 | -------------------------------------------------------------------------------- /aboutdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | aboutDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 550 10 | 250 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 550 22 | 200 23 | 24 | 25 | 26 | 27 | 16777215 28 | 16777215 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 5 37 | 38 | 39 | 10 40 | 41 | 42 | 5 43 | 44 | 45 | 10 46 | 47 | 48 | 0 49 | 50 | 51 | 10 52 | 53 | 54 | 55 | 56 | 57 | 0 58 | 0 59 | 60 | 61 | 62 | 63 | 10 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Qt::LeftToRight 75 | 76 | 77 | Qt::Horizontal 78 | 79 | 80 | QDialogButtonBox::Ok 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 12 89 | 90 | 91 | 92 | Qt::ScrollBarAlwaysOff 93 | 94 | 95 | Qt::ScrollBarAlwaysOff 96 | 97 | 98 | Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse 99 | 100 | 101 | 102 | 103 | 104 | 105 | textEdit_vandc 106 | pushButton_tohp 107 | 108 | 109 | 110 | 111 | buttonBox 112 | accepted() 113 | aboutDialog 114 | accept() 115 | 116 | 117 | 248 118 | 254 119 | 120 | 121 | 157 122 | 274 123 | 124 | 125 | 126 | 127 | buttonBox 128 | rejected() 129 | aboutDialog 130 | reject() 131 | 132 | 133 | 316 134 | 260 135 | 136 | 137 | 286 138 | 274 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /cfg.h: -------------------------------------------------------------------------------- 1 | /* static char *cfg_id = 2 | "@(#)Copyright (C) 2005-2012 H.Shirouzu cfg.h Ver2.10"; */ 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Create : 2005-01-23(Sun) 6 | Update : 2012-06-17(Sun) 7 | port update : 2016-02-25 8 | Copyright : H.Shirouzu,Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef CFG_H 13 | #define CFG_H 14 | #include "resource.h" 15 | #include "osl.h" 16 | #include "qblowfish.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | //メール送信機能でメールアカウントのパスワードを扱うため、簡易暗号化。 23 | //悪意のある第三者にとりあえず平文で読まれない程度でしかないけど。 24 | #define SHARE_KEY_A_BASE64 "U3Bmbm1qaW1fdEh1NXVlUnJDdC0=" //decode = Spfnmjim_tHu5ueRrCt- 25 | #define SHARE_KEY_B "WHXYCaGFXEUTHHhhzScrbF" //no decode 26 | #define SHARE_KEY_C_BASE64 "RDlnTUtzYzZtV2d6UzQ=" //decode = D9gMKsc6mWgzS4 27 | //complete blowfish key string = "Spfnmjim_tHu5ueRrCt-WHXYCaGFXEUTHHhhzScrbFD9gMKsc6mWgzS4" 28 | #define LICENSE_FILE_JP ":/license/license/License_JP.txt" 29 | #define LICENSE_FILE_EN ":/license/license/License_EN.txt" 30 | 31 | #define JOBLIST_JOBMAX 256 //一つのジョブリストにぶら下げることのできるジョブ数MAX 32 | 33 | //ジョブリスト構造体 34 | struct JobList{ 35 | void* joblist_title; //ジョブリスト名 36 | void* jobname_pt[JOBLIST_JOBMAX]; //ジョブリスト中のジョブ名称配列 37 | unsigned short joblistentry; //ジョブリスト中のジョブエントリ数 38 | bool forcelaunch; //致命的エラーでジョブリストストップしないフラグ 39 | //true = 止めない(次のジョブを起動する) 40 | //false = 止める(ジョブリスト実行を止める) 41 | void Init() { 42 | memset(this, 0, sizeof(JobList)); 43 | forcelaunch = true; //デフォルトでは止めない 44 | } 45 | void SetString(void *_title){ 46 | joblist_title = strdupV(_title); 47 | } 48 | void AddJobtoJobList(void *job_title){ 49 | jobname_pt[joblistentry] = strdupV(job_title); 50 | joblistentry++; 51 | } 52 | void Set(const JobList *joblist){ 53 | memcpy(this, joblist, sizeof(JobList)); 54 | SetString(joblist->joblist_title); 55 | for(int i=0; isrc) != 0 || 138 | strcmp((char*)dst,(char*)compare_wkjob->dst) != 0 || 139 | strcmp((char*)cmd,(char*)compare_wkjob->cmd) != 0 || 140 | bufSize != compare_wkjob->bufSize || 141 | estimateMode != compare_wkjob->estimateMode || 142 | diskMode != compare_wkjob->diskMode || 143 | ignoreErr != compare_wkjob->ignoreErr || 144 | usingMD5 != compare_wkjob->usingMD5 || 145 | enableOwdel != compare_wkjob->enableOwdel || 146 | enableAcl != compare_wkjob->enableAcl || 147 | enableXattr != compare_wkjob->enableXattr || 148 | enableVerify != compare_wkjob->enableVerify || 149 | Dotignore_mode != compare_wkjob->Dotignore_mode || 150 | LTFS_mode != compare_wkjob->LTFS_mode || 151 | isListing != compare_wkjob->isListing){ 152 | //フィルター内容以外のなにがしかが違う! 153 | return false; 154 | } 155 | //フィルタ内容チェック 156 | //比較対象両方ともフィルタ使用 157 | if(isFilter && compare_wkjob->isFilter){ 158 | //内容をそれぞれ比較 159 | if(strcmp((char*)includeFilter,(char*)compare_wkjob->includeFilter) != 0 || 160 | strcmp((char*)excludeFilter,(char*)compare_wkjob->excludeFilter) != 0 || 161 | strcmp((char*)fromDateFilter,(char*)compare_wkjob->fromDateFilter) != 0 || 162 | strcmp((char*)toDateFilter,(char*)compare_wkjob->toDateFilter) != 0 || 163 | strcmp((char*)minSizeFilter,(char*)compare_wkjob->minSizeFilter) != 0 || 164 | strcmp((char*)maxSizeFilter,(char*)compare_wkjob->maxSizeFilter) != 0){ 165 | //各種フィルタ指定の内容のなんらかしらが違うだべよ。 166 | return false; 167 | } 168 | } 169 | //なんにも引っかからなかったので同一だよ 170 | return true; 171 | } 172 | 173 | void Set(const Job *job) { 174 | memcpy(this, job, sizeof(Job)); 175 | SetString(job->title, job->src, job->dst, job->cmd, 176 | job->includeFilter, job->excludeFilter, 177 | job->fromDateFilter, job->toDateFilter, 178 | job->minSizeFilter, job->maxSizeFilter); 179 | } 180 | void UnSet() { 181 | //free(jobGroup); 182 | free(excludeFilter); 183 | free(includeFilter); 184 | free(fromDateFilter); 185 | free(toDateFilter); 186 | free(minSizeFilter); 187 | free(maxSizeFilter); 188 | free(cmd); 189 | free(dst); 190 | free(src); 191 | free(title); 192 | Init(); 193 | } 194 | 195 | Job() { 196 | Init(); 197 | } 198 | Job(const Job& job) { 199 | Init(); 200 | Set(&job); 201 | } 202 | ~Job() { UnSet(); } 203 | 204 | /* 205 | void debug(){ 206 | printf("jobaddr = %x",this); 207 | printf("title = %s\n",title); 208 | printf("src = %s\n",src); 209 | printf("dst = %s\n",dst); 210 | printf("cmd = %s\n",cmd); 211 | printf("bufSize = %d\n",bufSize); 212 | printf("estimateMode = %d\n",estimateMode); 213 | printf("diskMode = %d\n",diskMode); 214 | printf("ignoreErr = %d\n",ignoreErr); 215 | printf("usingMD5 = %d\n",usingMD5); 216 | printf("enableOwdel = %d\n",enableOwdel ? 1 : 0); 217 | printf("enableAcl = %d\n",enableAcl ? 1 : 0); 218 | printf("enableXattr = %d\n",enableXattr ? 1 : 0); 219 | printf("enableVerify = %d\n",enableVerify ? 1 : 0); 220 | printf("Dotignore_mode = %d\n",Dotignore_mode ? 1 : 0); 221 | printf("LTFS_mode = %d\n",LTFS_mode ? 1 : 0); 222 | if(isFilter){ 223 | printf("includeFilter = %s\n",includeFilter); 224 | printf("excludeFilter = %s\n",excludeFilter); 225 | printf("fromDateFilter = %s\n",fromDateFilter); 226 | printf("toDateFilter = %s\n",toDateFilter); 227 | printf("minSizeFilter = %s\n",minSizeFilter); 228 | printf("maxSizeFilter = %s\n",maxSizeFilter); 229 | } 230 | printf("flags = %x\n",flags); 231 | fflush(stdout); 232 | } 233 | */ 234 | }; 235 | 236 | struct FinAct { 237 | void *title; 238 | void *sound; 239 | void *command; 240 | //以下はメール送信機能用に追加 241 | void *account; 242 | void *password; 243 | void *smtpserver; 244 | void *port; 245 | void *tomailaddr; 246 | void *frommailaddr; 247 | QStringList *mailsets; 248 | 249 | int shutdownTime; //自動シャットダウン用の時間は未実装 250 | 251 | int flags; 252 | enum { BUILTIN=0x1, ERR_SOUND=0x2, ERR_CMD=0x4, ERR_SHUTDOWN=0x8, WAIT_CMD=0x10, 253 | FORCE=0x20, SUSPEND=0x40, HIBERNATE=0x80, SHUTDOWN=0x100, NORMAL_CMD=0x200, 254 | NORMAL_MAIL=0x1000,ERR_MAIL=0x2000}; 255 | void Init() { 256 | memset(this, 0, sizeof(FinAct)); 257 | shutdownTime = -1; 258 | } 259 | void SetString(void *_title, void *_sound, void *_command, 260 | void *_account,void *_password,void *_smtpserver,void *_port,void *_tomailaddr,void *_frommailaddr){ 261 | title = strdupV(_title); 262 | sound = strdupV(_sound); 263 | command = strdupV(_command); 264 | account = strdupV(_account); 265 | password = strdupV(_password); 266 | smtpserver = strdupV(_smtpserver); 267 | port = strdupV(_port); 268 | tomailaddr = strdupV(_tomailaddr); 269 | frommailaddr = strdupV(_frommailaddr); 270 | } 271 | void Set(const FinAct *finAct) { 272 | memcpy(this, finAct, sizeof(FinAct)); 273 | SetString(finAct->title, finAct->sound, finAct->command, 274 | finAct->account,finAct->password,finAct->smtpserver,finAct->port,finAct->tomailaddr,finAct->frommailaddr); 275 | } 276 | void UnSet() { 277 | free(command); 278 | free(sound); 279 | free(title); 280 | free(account); 281 | free(password); 282 | free(smtpserver); 283 | free(port); 284 | free(tomailaddr); 285 | free(frommailaddr); 286 | Init(); 287 | } 288 | FinAct() { 289 | Init(); 290 | } 291 | FinAct(const FinAct& action) { 292 | Init(); 293 | Set(&action); 294 | } 295 | ~FinAct() { UnSet(); } 296 | }; 297 | 298 | class Cfg { 299 | protected: 300 | BOOL Init(void *user_dir, void *virtual_dir); 301 | BOOL IniStrToV(char *inipath, void *path); 302 | BOOL VtoIniStr(void *path, char *inipath); 303 | BOOL EntryHistory(void **path_array, void ****history_array, int max); 304 | 305 | public: 306 | enum FileLogMode{NO_FILELOG = 0x00000000, //FILELOG出力なし 307 | AUTO_FILELOG = 0x00000001, //カレント時刻名でFILELOG出力 308 | FIX_FILELOG = 0x00000002, //CLI延長の固定ファイル名でFILELOG出力 309 | ADD_CSVFILELOG = 0x00000010}; //CSVファイル出力要求 310 | 311 | int bufSize; 312 | int maxTransSize; 313 | int maxAionum; 314 | //bool enableReadahead; 315 | int maxOpenFiles; 316 | int maxAttrSize; 317 | int maxDirSize; 318 | int maxHistory; 319 | int maxHistoryNext; 320 | int copyMode; 321 | int copyFlags; 322 | int skipEmptyDir; // 0:no, 1:filter-mode only, 2:always 323 | int forceStart; // 0:delete only, 1:always(copy+delete), 2:always wait 324 | bool enableLTFS; 325 | int ignoreErr; 326 | int estimateMode; 327 | int diskMode; 328 | int lcid; 329 | int waitTick; 330 | int speedLevel; 331 | BOOL isAutoSlowIo; 332 | BOOL alwaysLowIo; 333 | BOOL enableOwdel; 334 | BOOL enableAcl; 335 | BOOL enableXattr; 336 | BOOL enableVerify; 337 | BOOL enableVerifyErrDel; 338 | BOOL Dotignore_mode; 339 | int usingMD5; 340 | BOOL enableNSA; 341 | BOOL delDirWithFilter; 342 | BOOL enableMoveAttr; 343 | BOOL serialMove; 344 | BOOL serialVerifyMove; 345 | BOOL isDisableutime; 346 | BOOL isReparse; 347 | int isLinkDest; 348 | int maxLinkHash; 349 | //_int64 allowContFsize; 350 | BOOL isReCreate; 351 | BOOL isExtendFilter; 352 | bool isJobListMode; 353 | int taskbarMode; // 0: use tray, 1: use taskbar 354 | int infoSpan; // information update timing (0:250msec, 1:500msec, 2:1000msec) 355 | BOOL isTopLevel; 356 | BOOL isErrLog; 357 | BOOL enableOdirect; 358 | int fileLogMode; 359 | 360 | BOOL aclErrLog; 361 | BOOL streamErrLog; 362 | BOOL isRunasButton; 363 | BOOL isSameDirRename; 364 | BOOL execConfirm; 365 | void **srcPathHistory; 366 | void **dstPathHistory; 367 | void **delPathHistory; 368 | void **includeHistory; 369 | void **excludeHistory; 370 | void **fromDateHistory; 371 | void **toDateHistory; 372 | void **minSizeHistory; 373 | void **maxSizeHistory; 374 | void *execPathV; 375 | void *execDirV; 376 | 377 | QString userDirV; 378 | QString statDirV; 379 | QString soundDirV; 380 | 381 | void *errLogPathV; 382 | QString fileLogDirV; 383 | Job **jobArray; 384 | int jobMax; 385 | 386 | JobList **joblistArray; 387 | int joblistMax; 388 | FinAct **finActArray; 389 | int finActMax; 390 | QPoint macpos; 391 | QSize macsize; 392 | bool rwstat; 393 | bool async; 394 | QByteArray share_key; //秘密鍵をがっちゃんこする領域 395 | QBlowfish *bf; 396 | 397 | Cfg(); 398 | ~Cfg(); 399 | BOOL ReadIni(void *user_dir, void *virtual_dir); 400 | BOOL PostReadIni(void); 401 | BOOL WriteIni(void); 402 | BOOL EntryPathHistory(void *src, void *dst); 403 | BOOL EntryDelPathHistory(void *del); 404 | BOOL EntryFilterHistory(void *inc, void *exc, void *from, void *to, void *min, void *max); 405 | 406 | int SearchJobV(void *title); 407 | BOOL AddJobV(const Job *job); 408 | BOOL DelJobV(void *title); 409 | 410 | int SearchJobList(void *title); 411 | int SearchJobnuminAllJobList(void* job_title); 412 | bool AddJobList(const JobList *joblist); 413 | int AddJobtoJobList(int joblistindex,Job *job); 414 | bool DelJobList(void* title); 415 | int DelJobinAllJobList(void* job_title); 416 | int DelJobinJobList(void *job_title,void*joblist_title); 417 | 418 | int SearchFinActV(void *title, BOOL cmd_line=FALSE); 419 | BOOL AddFinActV(const FinAct *job); 420 | BOOL DelFinActV(void *title); 421 | 422 | QByteArray decryptData(QByteArray encyptdata); 423 | QByteArray encryptData(QByteArray decryptdata); 424 | }; 425 | 426 | #define INVALID_POINTVAL -10000 427 | #define INVALID_SIZEVAL -10000 428 | 429 | #define IS_INVALID_POINT(ptx,pty) (ptx == INVALID_POINTVAL && pty == INVALID_POINTVAL) 430 | #define IS_INVALID_SIZE(szx,szy) (szx == INVALID_SIZEVAL && szy == INVALID_SIZEVAL) 431 | 432 | 433 | #endif 434 | -------------------------------------------------------------------------------- /confirmdialog.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : 「実行前確認」 のダイアログ 6 | Reference : 7 | ======================================================================== */ 8 | 9 | #include "confirmdialog.h" 10 | #include "ui_confirmdialog.h" 11 | 12 | confirmDialog::confirmDialog(QWidget *parent, 13 | FastCopy::Info *_info, 14 | Cfg *_cfg, 15 | const void *_title, 16 | const void *_src, 17 | const void *_dst, 18 | bool _isShellext) : 19 | QDialog(parent), 20 | ui(new Ui::confirmDialog) 21 | { 22 | ui->setupUi(this); 23 | exec_button = new QPushButton(tr("&Execute")); 24 | ui->buttonBox->addButton(exec_button,QDialogButtonBox::AcceptRole); 25 | 26 | info = _info; 27 | cfg = _cfg; 28 | title = _title; 29 | src = _src; 30 | dst = _dst; 31 | isShellExt = _isShellext; 32 | 33 | if(title != NULL){ 34 | this->setWindowTitle((char*)title); 35 | } 36 | 37 | ui->textEdit_Src->setText((char*)src); 38 | 39 | if(dst != NULL){ 40 | ui->textEdit_Dst->setText((char*)dst); 41 | } 42 | else{ 43 | //deleteモード 44 | ui->label_Dst->hide(); 45 | this->resize(this->width(),this->height() - ui->label_Dst->height()); 46 | ui->textEdit_Dst->hide(); 47 | this->resize(this->width(),this->height() - ui->textEdit_Dst->height()); 48 | } 49 | 50 | } 51 | 52 | confirmDialog::~confirmDialog() 53 | { 54 | delete ui; 55 | delete exec_button; 56 | } 57 | -------------------------------------------------------------------------------- /confirmdialog.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef CONFIRMDIALOG_H 9 | #define CONFIRMDIALOG_H 10 | 11 | #include 12 | #include 13 | 14 | //#include 15 | #include 16 | #include 17 | 18 | namespace Ui { 19 | class confirmDialog; 20 | } 21 | 22 | class confirmDialog : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | //shellextは未実装 28 | explicit confirmDialog(QWidget *parent = 0, 29 | FastCopy::Info *_info = NULL, 30 | Cfg *_cfg = NULL, 31 | const void *_title = NULL, 32 | const void *_src = NULL, 33 | const void *_dst = NULL, 34 | bool _isShellext = false); 35 | ~confirmDialog(); 36 | 37 | private: 38 | Ui::confirmDialog *ui; 39 | QPushButton *exec_button; 40 | 41 | const void *src; 42 | const void *dst; 43 | const void *title; 44 | Cfg *cfg; 45 | FastCopy::Info *info; 46 | BOOL isShellExt; 47 | }; 48 | 49 | #endif // CONFIRMDIALOG_H 50 | -------------------------------------------------------------------------------- /confirmdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | confirmDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Execute Copy 15 | 16 | 17 | 18 | 5 19 | 20 | 21 | 5 22 | 23 | 24 | 5 25 | 26 | 27 | 5 28 | 29 | 30 | 31 | 32 | 33 | 12 34 | 35 | 36 | 37 | Source 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 11 46 | 47 | 48 | 49 | Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 12 58 | 59 | 60 | 61 | DestDir 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 0 70 | 0 71 | 72 | 73 | 74 | 75 | 16777215 76 | 75 77 | 78 | 79 | 80 | 81 | 11 82 | 83 | 84 | 85 | Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse 86 | 87 | 88 | 89 | 90 | 91 | 92 | Qt::LeftToRight 93 | 94 | 95 | Qt::Horizontal 96 | 97 | 98 | QDialogButtonBox::Cancel 99 | 100 | 101 | true 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | buttonBox 111 | accepted() 112 | confirmDialog 113 | accept() 114 | 115 | 116 | 248 117 | 254 118 | 119 | 120 | 157 121 | 274 122 | 123 | 124 | 125 | 126 | buttonBox 127 | rejected() 128 | confirmDialog 129 | reject() 130 | 131 | 132 | 316 133 | 260 134 | 135 | 136 | 286 137 | 274 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /finactdialog.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : 「終了時処理」 のダイアログ 6 | Reference : 7 | ======================================================================== */ 8 | #include "finactdialog.h" 9 | #include "ui_finactdialog.h" 10 | #include "mainwindow.h" 11 | #include 12 | #include 13 | #include 14 | 15 | FinActDialog::FinActDialog(QWidget *parent,Cfg *cfg_pt) : 16 | QDialog(parent), 17 | ui(new Ui::FinActDialog) 18 | { 19 | ui->setupUi(this); 20 | this->cfg = cfg_pt; 21 | this->mainParent = parent; 22 | player = new QMediaPlayer; 23 | 24 | for (int i=0; i < cfg->finActMax; i++) { 25 | ui->comboBox_Action->insertItem(i,(char*)cfg->finActArray[i]->title); 26 | } 27 | 28 | for (int i=0; i < 3; i++) { 29 | ui->comboBox_CommandTiming->insertItem(i,(char*)GetLoadStrV(IDS_FACMD_ALWAYS+i)); 30 | ui->comboBox_MailTiming->insertItem(i,(char*)GetLoadStrV(IDS_FACMD_ALWAYS+i)); 31 | } 32 | //電源関連処理が実装される日まで非表示実装 33 | ui->groupBox_Power->setVisible(false); 34 | //uiファイルデフォルトに従って自由にパスを設定、編集可能 35 | //ui->comboBox_SoundFile 36 | ui->comboBox_SoundFile->setEditable(true); 37 | //非表示にしたぶん空欄になってるので、リサイズ 38 | this->resize(this->sizeHint()); 39 | 40 | Reflect(max(((MainWindow*)mainParent)->GetFinActIdx(),0)); 41 | } 42 | 43 | FinActDialog::~FinActDialog() 44 | { 45 | delete ui; 46 | delete player; 47 | } 48 | 49 | BOOL FinActDialog::Reflect(int idx) 50 | { 51 | if (idx >= cfg->finActMax) return FALSE; 52 | 53 | FinAct *finAct = cfg->finActArray[idx]; 54 | ui->comboBox_Action->setCurrentIndex(idx); 55 | ui->comboBox_SoundFile->setEditText((char*)finAct->sound); 56 | ui->lineEdit_Command->setText((char*)finAct->command); 57 | 58 | char shutdown_time[100] = "60"; 59 | BOOL is_stop = finAct->shutdownTime >= 0; 60 | 61 | if (is_stop){ 62 | sprintf(shutdown_time, "%d", finAct->shutdownTime); 63 | } 64 | ui->lineEdit_GraceSec->setText(shutdown_time); 65 | ui->checkBox_Standby->setChecked(is_stop && (finAct->flags & FinAct::SUSPEND) ? true : false); 66 | ui->checkBox_Hibernation->setChecked(is_stop && (finAct->flags & FinAct::HIBERNATE) ? true : false); 67 | ui->checkBox_Force->setChecked(is_stop && (finAct->flags & FinAct::FORCE) ? true : false); 68 | ui->checkBox_Shutdown->setChecked(is_stop && (finAct->flags & FinAct::SHUTDOWN) ? true : false); 69 | ui->checkBox_DontExecute->setChecked(is_stop && (finAct->flags & FinAct::ERR_SHUTDOWN) ? true : false); 70 | 71 | ui->lineEdit_Account->setText((char*)finAct->account); 72 | ui->lineEdit_Password->setText((char*)finAct->password); 73 | ui->lineEdit_SMTPServer->setText((char*)finAct->smtpserver); 74 | ui->lineEdit_Port->setText((char*)finAct->port); 75 | ui->lineEdit_ToMailAddr->setText((char*)finAct->tomailaddr); 76 | ui->lineEdit_FromMailAddr->setText((char*)finAct->frommailaddr); 77 | 78 | ui->checkBox_Error->setChecked((finAct->flags & FinAct::ERR_SOUND) ? true : false); 79 | ui->checkBox_Commandwait->setChecked((finAct->flags & FinAct::WAIT_CMD) ? true : false); 80 | 81 | 82 | int fidx = (finAct->flags & FinAct::ERR_CMD) ? 2 : 83 | (finAct->flags & FinAct::NORMAL_CMD) ? 1 : 0; 84 | ui->comboBox_CommandTiming->setCurrentIndex(fidx); 85 | 86 | int midx = (finAct->flags & FinAct::ERR_MAIL) ? 2 : 87 | (finAct->flags & FinAct::NORMAL_MAIL) ? 1 : 0; 88 | ui->comboBox_MailTiming->setCurrentIndex(midx); 89 | 90 | ui->pushButton_Del->setEnabled((finAct->flags & FinAct::BUILTIN) ? false : true); 91 | return TRUE; 92 | } 93 | 94 | BOOL FinActDialog::AddFinAct() 95 | { 96 | FinAct finAct; 97 | 98 | char title[MAX_PATH]; 99 | char sound[MAX_PATH]; 100 | char command[MAX_PATH]; 101 | 102 | if(strncpy(title,ui->comboBox_Action->currentText().toLocal8Bit().data(),MAX_PATH) <= 0 103 | || lstrcmpiV(title, FALSE_V) == 0){ 104 | return FALSE; 105 | } 106 | 107 | int idx = cfg->SearchFinActV(title); 108 | 109 | strncpy(sound,ui->comboBox_SoundFile->currentText().toLocal8Bit().data(),MAX_PATH); 110 | strncpy(command,ui->lineEdit_Command->text().toLocal8Bit().data(),MAX_PATH); 111 | finAct.SetString(title, sound, command, 112 | ui->lineEdit_Account->text().toLocal8Bit().data(), 113 | ui->lineEdit_Password->text().toLocal8Bit().data(), 114 | ui->lineEdit_SMTPServer->text().toLocal8Bit().data(), 115 | ui->lineEdit_Port->text().toLocal8Bit().data(), 116 | ui->lineEdit_ToMailAddr->text().toLocal8Bit().data(), 117 | ui->lineEdit_FromMailAddr->text().toLocal8Bit().data()); 118 | 119 | if (GetChar(sound, 0)) { 120 | finAct.flags |= ui->checkBox_Error->isChecked() ? FinAct::ERR_SOUND : 0; 121 | } 122 | if (GetChar(command, 0)) { 123 | int fidx = ui->comboBox_CommandTiming->currentIndex(); 124 | finAct.flags |= (fidx == 1 ? FinAct::NORMAL_CMD : fidx == 2 ? FinAct::ERR_CMD : 0); 125 | finAct.flags |= ui->checkBox_Commandwait->isChecked() ? FinAct::WAIT_CMD : 0; 126 | } 127 | 128 | if(!ui->lineEdit_Account->text().isEmpty() && 129 | !ui->lineEdit_Password->text().isEmpty() && 130 | !ui->lineEdit_SMTPServer->text().isEmpty() && 131 | !ui->lineEdit_Port->text().isEmpty() && 132 | !ui->lineEdit_ToMailAddr->text().isEmpty() && 133 | !ui->lineEdit_FromMailAddr->text().isEmpty()){ 134 | int midx = ui->comboBox_MailTiming->currentIndex(); 135 | finAct.flags |= (midx == 1 ? FinAct::NORMAL_MAIL : midx == 2 ? FinAct::ERR_MAIL : 0); 136 | } 137 | 138 | if(idx >= 1 && (cfg->finActArray[idx]->flags & FinAct::BUILTIN)){ 139 | finAct.flags |= cfg->finActArray[idx]->flags & 140 | (FinAct::SUSPEND|FinAct::HIBERNATE|FinAct::SHUTDOWN); 141 | } 142 | else{ 143 | finAct.flags |= ui->checkBox_Standby->isChecked() ? FinAct::SUSPEND : 0; 144 | finAct.flags |= ui->checkBox_Hibernation->isChecked() ? FinAct::HIBERNATE : 0; 145 | finAct.flags |= ui->checkBox_Shutdown->isChecked() ? FinAct::SHUTDOWN : 0; 146 | } 147 | 148 | if(finAct.flags & (FinAct::SUSPEND|FinAct::HIBERNATE|FinAct::SHUTDOWN)){ 149 | finAct.flags |= ui->checkBox_Force->isChecked() ? FinAct::FORCE : 0; 150 | finAct.flags |= ui->checkBox_DontExecute->isChecked() ? FinAct::ERR_SHUTDOWN : 0; 151 | finAct.shutdownTime = 60; 152 | if(!ui->lineEdit_GraceSec->text().isEmpty()){ 153 | finAct.shutdownTime = strtoulV(ui->lineEdit_GraceSec->text().toLocal8Bit().data(),0,10); 154 | } 155 | } 156 | 157 | if(cfg->AddFinActV(&finAct)){ 158 | cfg->WriteIni(); 159 | if(ui->comboBox_Action->count() < cfg->finActMax){ 160 | ui->comboBox_Action->addItem((char*)title); 161 | } 162 | Reflect(cfg->SearchFinActV(title)); 163 | } 164 | else{ 165 | QMessageBox errorBox; 166 | errorBox.setText("Add FinAct Error"); 167 | errorBox.setStandardButtons(QMessageBox::Ok); 168 | errorBox.setDefaultButton(QMessageBox::Ok); 169 | errorBox.setIcon(QMessageBox::Warning); 170 | errorBox.exec(); 171 | } 172 | return TRUE; 173 | } 174 | 175 | BOOL FinActDialog::DelFinAct() 176 | { 177 | char buf[MAX_PATH],msg[MAX_PATH]; 178 | 179 | if(strncpy(buf,ui->comboBox_Action->currentText().toLocal8Bit().data(),MAX_PATH) > 0){ 180 | int idx = cfg->SearchFinActV(buf); 181 | sprintfV(msg, GetLoadStrV(IDS_FINACTNAME), buf); 182 | 183 | QMessageBox msgBox; 184 | 185 | 186 | if(cfg->finActArray[idx]->flags & FinAct::BUILTIN){ 187 | msgBox.setText("Can't delete built-in Action"); 188 | msgBox.setStandardButtons(QMessageBox::Ok); 189 | msgBox.setDefaultButton(QMessageBox::Ok); 190 | msgBox.setIcon(QMessageBox::Critical); 191 | msgBox.exec(); 192 | } 193 | else{ 194 | 195 | msgBox.setText((char*)GetLoadStrV(IDS_DELCONFIRM)); 196 | msgBox.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel); 197 | msgBox.setIcon(QMessageBox::Question); 198 | if(msgBox.exec() == QMessageBox::Ok){ 199 | cfg->DelFinActV(buf); 200 | cfg->WriteIni(); 201 | ui->comboBox_Action->removeItem(idx); 202 | idx = idx == cfg->finActMax ? idx -1 : idx; 203 | ui->comboBox_Action->setCurrentIndex(idx); 204 | Reflect(idx); 205 | } 206 | } 207 | } 208 | return TRUE; 209 | } 210 | 211 | void FinActDialog::on_pushButton_Create_clicked() 212 | { 213 | AddFinAct(); 214 | QMessageBox msgbox; 215 | msgbox.setStandardButtons(QMessageBox::Ok); 216 | msgbox.setIcon(QMessageBox::Information); 217 | msgbox.setText((char*)GetLoadStrV(IDS_FINACT_CRESAV_INFO)); 218 | msgbox.exec(); 219 | } 220 | 221 | void FinActDialog::on_pushButton_Del_clicked() 222 | { 223 | DelFinAct(); 224 | } 225 | 226 | void FinActDialog::on_comboBox_Action_currentIndexChanged(int index) 227 | { 228 | Reflect(index); 229 | } 230 | 231 | void FinActDialog::on_pushButton_SoundFile_clicked() 232 | { 233 | QFileDialog file_dialog(this); 234 | QString srcstr; 235 | 236 | srcstr = file_dialog.getOpenFileName( 237 | this, 238 | (char*)GetLoadStrV(IDS_OPENFILE), 239 | cfg->soundDirV, 240 | tr("Sound Files (*.wav)")); 241 | if(!srcstr.isEmpty()){ 242 | ui->comboBox_SoundFile->setEditText(srcstr); 243 | } 244 | } 245 | 246 | void FinActDialog::on_pushButton_Play_clicked() 247 | { 248 | 249 | QString target_filepath = ui->comboBox_SoundFile->currentText(); 250 | QFileInfo soundfile_info(target_filepath); 251 | if(soundfile_info.isFile() && soundfile_info.suffix() == "wav"){ 252 | 253 | player->setMedia(QUrl::fromLocalFile(target_filepath)); 254 | player->play(); 255 | } 256 | else{ 257 | QMessageBox errorBox; 258 | errorBox.setText("please select Sound file(aiff,mp3,wav)."); 259 | errorBox.setStandardButtons(QMessageBox::Ok); 260 | errorBox.setDefaultButton(QMessageBox::Ok); 261 | errorBox.setIcon(QMessageBox::Warning); 262 | errorBox.exec(); 263 | } 264 | } 265 | 266 | void FinActDialog::on_pushButton_Command_clicked() 267 | { 268 | QFileDialog file_dialog(this); 269 | QString srcstr; 270 | 271 | srcstr = file_dialog.getOpenFileName( 272 | this, 273 | (char*)GetLoadStrV(IDS_OPENFILE), 274 | QStandardPaths::writableLocation(QStandardPaths::HomeLocation), 275 | 0, 276 | 0, 277 | 0); 278 | //nullじゃない?(キャンセルされてない?) 279 | if(!srcstr.isEmpty()){ 280 | //設定してもよさそうね 281 | ui->comboBox_CommandTiming->setCurrentText(srcstr); 282 | } 283 | } 284 | 285 | //未使用未実装 286 | void FinActDialog::on_checkBox_Standby_clicked(bool checked) 287 | { 288 | if(checked){ 289 | ui->checkBox_Hibernation->setChecked(false); 290 | ui->checkBox_Shutdown->setChecked(false); 291 | } 292 | } 293 | 294 | void FinActDialog::on_checkBox_Hibernation_clicked(bool checked) 295 | { 296 | if(checked){ 297 | ui->checkBox_Standby->setChecked(false); 298 | ui->checkBox_Shutdown->setChecked(false); 299 | } 300 | } 301 | 302 | void FinActDialog::on_checkBox_Shutdown_clicked(bool checked) 303 | { 304 | if(checked){ 305 | ui->checkBox_Standby->setChecked(false); 306 | ui->checkBox_Hibernation->setChecked(false); 307 | } 308 | } 309 | -------------------------------------------------------------------------------- /finactdialog.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef FINACTDIALOG_H 9 | #define FINACTDIALOG_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Ui { 19 | class FinActDialog; 20 | } 21 | 22 | class FinActDialog : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | explicit FinActDialog(QWidget *parent = 0,Cfg *cfg_pt = NULL); 28 | ~FinActDialog(); 29 | 30 | protected: 31 | Cfg *cfg; 32 | QWidget *mainParent; 33 | QMediaPlayer *player; 34 | QFileInfoList list; 35 | 36 | public: 37 | BOOL Reflect(int idx); 38 | BOOL AddFinAct(); 39 | BOOL DelFinAct(); 40 | 41 | private slots: 42 | void on_pushButton_Create_clicked(); 43 | void on_pushButton_Del_clicked(); 44 | void on_comboBox_Action_currentIndexChanged(int index); 45 | void on_pushButton_SoundFile_clicked(); 46 | void on_pushButton_Play_clicked(); 47 | void on_pushButton_Command_clicked(); 48 | void on_checkBox_Standby_clicked(bool checked); 49 | void on_checkBox_Hibernation_clicked(bool checked); 50 | void on_checkBox_Shutdown_clicked(bool checked); 51 | private: 52 | Ui::FinActDialog *ui; 53 | 54 | }; 55 | 56 | #endif // FINACTDIALOG_H 57 | -------------------------------------------------------------------------------- /help/RapidCopyEmailSettingExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/help/RapidCopyEmailSettingExample.png -------------------------------------------------------------------------------- /icon/RapidCopy0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/RapidCopy0.png -------------------------------------------------------------------------------- /icon/RapidCopy1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/RapidCopy1.png -------------------------------------------------------------------------------- /icon/RapidCopy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/RapidCopy2.png -------------------------------------------------------------------------------- /icon/RapidCopy3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/RapidCopy3.png -------------------------------------------------------------------------------- /icon/RapidCopy4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/RapidCopy4.png -------------------------------------------------------------------------------- /icon/checkmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/checkmark.png -------------------------------------------------------------------------------- /icon/delete_sign_filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/delete_sign_filled.png -------------------------------------------------------------------------------- /icon/past.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/icon/past.png -------------------------------------------------------------------------------- /jobdialog.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : 「シングルジョブ管理」 のダイアログ 6 | Reference : 7 | ======================================================================== */ 8 | #include "jobdialog.h" 9 | #include "ui_jobdialog.h" 10 | #include "mainwindow.h" 11 | 12 | JobDialog::JobDialog(QWidget *parent,Cfg *cfg_pt) : 13 | QDialog(parent), 14 | ui(new Ui::JobDialog) 15 | { 16 | char buf[MAX_PATH]; 17 | 18 | ui->setupUi(this); 19 | this->cfg = cfg_pt; 20 | mainwindow = (void*)parent; 21 | 22 | //ウインドウ位置微調整はさぼり 23 | for (int i=0; i < cfg->jobMax; i++){ 24 | //ジョブ管理ダイアログで削除、修正更新できるのはシングルジョブだけ 25 | if(cfg->jobArray[i]->flags & Job::SINGLE_JOB){ 26 | ui->comboBox_Job->addItem((char*)cfg->jobArray[i]->title); 27 | } 28 | } 29 | 30 | strcpy(buf,(char*)(((MainWindow *)mainwindow)->GetJobTitle().toLocal8Bit().data())); 31 | if (strlen(buf) > 0) { 32 | 33 | int idx = cfg->SearchJobV(buf); 34 | if(idx >= 0){ 35 | ui->comboBox_Job->setCurrentIndex(idx); 36 | } 37 | else{ 38 | ui->comboBox_Job->addItem(buf); 39 | } 40 | } 41 | ui->pushButton_Delete->setEnabled(cfg->jobMax ? true : false); 42 | } 43 | 44 | JobDialog::~JobDialog() 45 | { 46 | delete ui; 47 | } 48 | 49 | bool JobDialog::AddJob(){ 50 | 51 | char title[MAX_PATH]; 52 | int jobidx; 53 | if(ui->comboBox_Job->currentText().isEmpty()){ 54 | return FALSE; 55 | } 56 | //保存しようとしているジョブ名がすでに存在かつ、ジョブリスト用ジョブの名称と重複してないかチェック 57 | jobidx = cfg->SearchJobV(ui->comboBox_Job->currentText().toLocal8Bit().data()); 58 | if(jobidx != -1 && cfg->jobArray[jobidx]->flags & Job::JOBLIST_JOB){ 59 | //ジョブリストモード用のジョブ名と重複してるのでリターンだなもし 60 | QMessageBox msgbox; 61 | msgbox.setStandardButtons(QMessageBox::Ok); 62 | msgbox.setIcon(QMessageBox::Warning); 63 | msgbox.setText((char*)GetLoadStrV(IDS_SINGLEJOB_MODERROR)); 64 | msgbox.exec(); 65 | return FALSE; 66 | } 67 | 68 | strcpy(title,ui->comboBox_Job->currentText().toLocal8Bit().data()); 69 | 70 | int src_len = ((MainWindow *)mainwindow)->GetSrclen() + STR_NULL_GUARD; 71 | if (src_len >= NEW_MAX_HISTORY_BUF) { 72 | QMessageBox msgbox; 73 | msgbox.setStandardButtons(QMessageBox::Ok); 74 | msgbox.setIcon(QMessageBox::Warning); 75 | msgbox.setText("Source is too long (max.1052672 bytes)"); 76 | msgbox.exec(); 77 | return FALSE; 78 | } 79 | 80 | Job job; 81 | int idx = ((MainWindow *)mainwindow)->GetCopyModeIndex(); 82 | CopyInfo *info = ((MainWindow *)mainwindow)->GetCopyInfo(); 83 | void *src = new char [src_len]; 84 | char dst[MAX_PATH]=""; 85 | char inc[MAX_PATH]="", exc[MAX_PATH]=""; 86 | char from_date[MINI_BUF]="", to_date[MINI_BUF]=""; 87 | char min_size[MINI_BUF]="", max_size[MINI_BUF]=""; 88 | 89 | //mainWindow側メソッドで設定 90 | ((MainWindow *)mainwindow)->GetJobfromMain(&job); 91 | 92 | QString src_string = (((MainWindow *)mainwindow)->GetSrc()); 93 | 94 | strncpy((char*)src,src_string.toLocal8Bit().data(),src_len); 95 | if (info[idx].mode != FastCopy::DELETE_MODE) { 96 | QString dst_string = (((MainWindow *)mainwindow)->GetDst()); 97 | strncpy(dst,dst_string.toLocal8Bit().data(),MAX_PATH); 98 | job.diskMode = ((MainWindow *)mainwindow)->GetDiskMode(); 99 | } 100 | 101 | if (job.isFilter) { 102 | ((MainWindow *)mainwindow)->GetFilterfromMain(inc,exc,from_date,to_date,min_size,max_size); 103 | } 104 | job.SetString(title, src, dst, info[idx].cmdline_name, inc, exc, 105 | from_date, to_date, min_size, max_size); 106 | job.isListing = false; 107 | job.flags |= Job::SINGLE_JOB; 108 | if (cfg->AddJobV(&job)) { 109 | cfg->WriteIni(); 110 | ((MainWindow *)mainwindow)->SetJobTitle(title); 111 | QMessageBox msgbox; 112 | msgbox.setStandardButtons(QMessageBox::Ok); 113 | msgbox.setIcon(QMessageBox::Information); 114 | msgbox.setText((char*)GetLoadStrV(IDS_JOBACT_SUCCESS_INFO)); 115 | msgbox.exec(); 116 | } 117 | else{ 118 | QMessageBox msgbox; 119 | msgbox.setStandardButtons(QMessageBox::Ok); 120 | msgbox.setIcon(QMessageBox::Warning); 121 | msgbox.setText((char*)GetLoadStrV(IDS_JOBACT_ERROR_INFO)); 122 | msgbox.setInformativeText((char*)GetLoadStrV(IDS_JOBACT_ERROR_DETAIL_INFO)); 123 | msgbox.exec(); 124 | } 125 | 126 | delete [] src; 127 | return TRUE; 128 | } 129 | 130 | bool JobDialog::DelJob(){ 131 | char buf[MAX_PATH], msg[MAX_PATH]; 132 | 133 | if(!ui->comboBox_Job->currentText().isEmpty()){ 134 | 135 | strncpy(buf,ui->comboBox_Job->currentText().toLocal8Bit().data(),MAX_PATH); 136 | 137 | int idx = cfg->SearchJobV(buf); 138 | sprintfV(msg, GetLoadStrV(IDS_JOBNAME), buf); 139 | if (idx >= 0){ 140 | QMessageBox msgbox; 141 | 142 | //保存しようとしているジョブ名がすでに存在かつ、ジョブリスト用ジョブの名称と重複してないかチェック 143 | if(cfg->jobArray[idx]->flags & Job::JOBLIST_JOB){ 144 | //ジョブリストモード用のジョブ名と重複してるのでエラーリターン 145 | msgbox.setStandardButtons(QMessageBox::Ok); 146 | msgbox.setIcon(QMessageBox::Warning); 147 | msgbox.setText((char*)GetLoadStrV(IDS_SINGLEJOB_MODERROR)); 148 | msgbox.exec(); 149 | return false; 150 | } 151 | msgbox.setStandardButtons(QMessageBox::Ok|QMessageBox::Cancel); 152 | msgbox.setIcon(QMessageBox::Question); 153 | msgbox.setText((char*)GetLoadStrV(IDS_DELCONFIRM)); 154 | msgbox.setInformativeText(msg); 155 | if(msgbox.exec() == QMessageBox::Ok){ 156 | cfg->DelJobinAllJobList(buf); 157 | cfg->DelJobV(buf); 158 | cfg->WriteIni(); 159 | ui->comboBox_Job->removeItem(ui->comboBox_Job->currentIndex()); 160 | ui->comboBox_Job->setCurrentIndex(idx == 0 ? 0 : idx < cfg->jobMax ? idx : idx -1); 161 | ((MainWindow *)mainwindow)->DelJobTitle(); 162 | } 163 | } 164 | } 165 | ui->pushButton_Delete->setChecked(cfg->jobMax ? true : false); 166 | return TRUE; 167 | } 168 | 169 | void JobDialog::on_pushButton_Execute_clicked() 170 | { 171 | if(AddJob()){ 172 | //成功ならしれっとダイアログ閉じる 173 | this->close(); 174 | } 175 | } 176 | 177 | void JobDialog::on_pushButton_Delete_clicked() 178 | { 179 | DelJob(); 180 | } 181 | 182 | 183 | -------------------------------------------------------------------------------- /jobdialog.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef JOBDIALOG_H 9 | #define JOBDIALOG_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | //#include "mainwindow.h" 17 | namespace Ui { 18 | class JobDialog; 19 | } 20 | 21 | class JobDialog : public QDialog 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit JobDialog(QWidget *parent = 0,Cfg *cfg_pt = NULL); 27 | ~JobDialog(); 28 | 29 | private: 30 | Ui::JobDialog *ui; 31 | bool AddJob(); 32 | bool DelJob(); 33 | 34 | protected: 35 | Cfg *cfg; 36 | void *mainwindow; 37 | 38 | private slots: 39 | void on_pushButton_Delete_clicked(); 40 | void on_pushButton_Execute_clicked(); 41 | }; 42 | 43 | #endif // JOBDIALOG_H 44 | -------------------------------------------------------------------------------- /jobdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | JobDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 348 10 | 127 11 | 12 | 13 | 14 | 15 | 16777215 16 | 16777215 17 | 18 | 19 | 20 | Job Register/Modify & Delete 21 | 22 | 23 | 24 | 5 25 | 26 | 27 | 28 | 29 | Enter the name of the job to add/change/delete 30 | 31 | 32 | true 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Qt::Horizontal 42 | 43 | 44 | 45 | 40 46 | 20 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 10 56 | 57 | 58 | 59 | QFrame::StyledPanel 60 | 61 | 62 | QFrame::Plain 63 | 64 | 65 | Delete selected jobs 66 | 67 | 68 | true 69 | 70 | 71 | 72 | 73 | 74 | 75 | Register/Modify 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 10 84 | 85 | 86 | 87 | QFrame::StyledPanel 88 | 89 | 90 | 1 91 | 92 | 93 | Register/Modify Job in main window params 94 | 95 | 96 | true 97 | 98 | 99 | Qt::NoTextInteraction 100 | 101 | 102 | 103 | 104 | 105 | 106 | Delete 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | Qt::Vertical 116 | 117 | 118 | 119 | 20 120 | 40 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /joblistrenamedialog.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : 「ジョブリストのリネーム」専用ダイアログ 6 | Reference : 7 | ======================================================================== */ 8 | 9 | #include "joblistrenamedialog.h" 10 | #include "ui_joblistrenamedialog.h" 11 | #include "mainwindow.h" 12 | 13 | JobListRenameDialog::JobListRenameDialog(QWidget *parent,Cfg *cfg_pt,QString before_name,QString* after_name) : 14 | QDialog(parent), 15 | ui(new Ui::JobListRenameDialog) 16 | { 17 | ui->setupUi(this); 18 | cfg = cfg_pt; 19 | joblistname_before = before_name; 20 | ui->lineEdit_newJobListName->setText(joblistname_before); 21 | this->setWindowTitle((char*)GetLoadStrV(IDS_JOBLISTRENAME_TITLE)); 22 | joblistname_after = after_name; 23 | } 24 | 25 | JobListRenameDialog::~JobListRenameDialog() 26 | { 27 | delete ui; 28 | } 29 | 30 | void JobListRenameDialog::on_lineEdit_newJobListName_textChanged(const QString &arg1) 31 | { 32 | if(cfg->SearchJobList(arg1.toLocal8Bit().data()) == -1){ 33 | ui->pushButton_Ok->setEnabled(true); 34 | } 35 | else{ 36 | ui->pushButton_Ok->setEnabled(false); 37 | } 38 | return; 39 | } 40 | 41 | void JobListRenameDialog::on_pushButton_Ok_clicked() 42 | { 43 | //MainWindowへのリターン文字列(リネーム後文字列)セット 44 | joblistname_after->clear(); 45 | joblistname_after->append(ui->lineEdit_newJobListName->text()); 46 | //リターン 47 | this->accept(); 48 | } 49 | 50 | void JobListRenameDialog::on_pushButton_Cancel_clicked() 51 | { 52 | //内容をemptyにしてリターン 53 | joblistname_after->clear(); 54 | this->reject(); 55 | } 56 | -------------------------------------------------------------------------------- /joblistrenamedialog.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef JOBLISTRENAMEDIALOG_H 9 | #define JOBLISTRENAMEDIALOG_H 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace Ui { 18 | class JobListRenameDialog; 19 | } 20 | 21 | class JobListRenameDialog : public QDialog 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit JobListRenameDialog(QWidget *parent = 0,Cfg *cfg_pt=NULL,QString before_name=NULL,QString *after_name=NULL); 27 | ~JobListRenameDialog(); 28 | 29 | private: 30 | Ui::JobListRenameDialog *ui; 31 | QString *joblistname_after; 32 | 33 | protected: 34 | Cfg *cfg; 35 | void *mainwindow; 36 | QString joblistname_before; 37 | 38 | 39 | private slots: 40 | void on_lineEdit_newJobListName_textChanged(const QString &arg1); 41 | void on_pushButton_Ok_clicked(); 42 | void on_pushButton_Cancel_clicked(); 43 | }; 44 | 45 | #endif // JOBLISTRENAMEDIALOG_H 46 | -------------------------------------------------------------------------------- /joblistrenamedialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | JobListRenameDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 330 10 | 100 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | 14 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Qt::Vertical 30 | 31 | 32 | 33 | 20 34 | 40 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Qt::Horizontal 45 | 46 | 47 | 48 | 40 49 | 20 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 0 59 | 0 60 | 61 | 62 | 63 | Cancel 64 | 65 | 66 | 67 | 68 | 69 | 70 | Ok 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /license/License_EN.txt: -------------------------------------------------------------------------------- 1 | Copyright 2004-2012, SHIROUZU Hiroaki All rights reserved. 2 | Copyright 2014-2019, Kengo Sawatsu All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | xxHash Library 25 | Copyright (c) 2012-2014, Yann Collet 26 | All rights reserved. 27 | 28 | Redistribution and use in source and binary forms, with or without modification, 29 | are permitted provided that the following conditions are met: 30 | 31 | * Redistributions of source code must retain the above copyright notice, this 32 | list of conditions and the following disclaimer. 33 | 34 | * Redistributions in binary form must reproduce the above copyright notice, this 35 | list of conditions and the following disclaimer in the documentation and/or 36 | other materials provided with the distribution. 37 | 38 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 42 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 45 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | 49 | 50 | 51 | Copyright (c) 2013 Raivis Strogonovs 52 | Simple Smtp for Qt5 source repository : https://github.com/xcoder123/SimpleSmtp_SSL_QT5 53 | 54 | http://morf.lv 55 | 56 | Permission is hereby granted, free of charge, 57 | to any person obtaining a copy of this software and associated documentation files (the "Software"), 58 | to deal in the Software without restriction, including without limitation the rights to use, 59 | copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, 60 | and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in all copies 63 | or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 67 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 68 | DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 69 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | 71 | -------------------------------------------------------------------------------- /license/License_JP.txt: -------------------------------------------------------------------------------- 1 | Copyright 2004-2012, SHIROUZU Hiroaki All rights reserved. 2 | Copyright 2014-2019, Kengo Sawatsu All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | 24 | xxHash Library 25 | Copyright (c) 2012-2014, Yann Collet 26 | All rights reserved. 27 | 28 | Redistribution and use in source and binary forms, with or without modification, 29 | are permitted provided that the following conditions are met: 30 | 31 | * Redistributions of source code must retain the above copyright notice, this 32 | list of conditions and the following disclaimer. 33 | 34 | * Redistributions in binary form must reproduce the above copyright notice, this 35 | list of conditions and the following disclaimer in the documentation and/or 36 | other materials provided with the distribution. 37 | 38 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 42 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 45 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | 49 | 50 | 51 | Copyright (c) 2013 Raivis Strogonovs 52 | Simple Smtp for Qt5 source repository : https://github.com/xcoder123/SimpleSmtp_SSL_QT5 53 | 54 | http://morf.lv 55 | 56 | Permission is hereby granted, free of charge, 57 | to any person obtaining a copy of this software and associated documentation files (the "Software"), 58 | to deal in the Software without restriction, including without limitation the rights to use, 59 | copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, 60 | and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 61 | 62 | The above copyright notice and this permission notice shall be included in all copies 63 | or substantial portions of the Software. 64 | 65 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 66 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 67 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 68 | DAMAGES OR OTHER LIABILITY,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 69 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : Main関数 6 | Reference : 7 | ======================================================================== */ 8 | 9 | #include 10 | #include 11 | #include "mainwindow.h" 12 | #include 13 | 14 | MainWindow *mainwindow_pt; 15 | 16 | //シグナルハンドラ関数 17 | //最小限の処理しかしてはいけない、再代入可能関数以外はコールしてはいけない 18 | //printf()するとバグになるので注意 19 | void mainsignal_handler(int signum){ 20 | mainwindow_pt->sighandler_mainwindow(signum); 21 | return; 22 | } 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | 27 | struct sigaction sa_sigint; 28 | 29 | //FastCopyv2.11のANSI/UNICODE対応関数テーブル準備処理の名残 30 | TLibInit_Win32V(); 31 | 32 | QApplication Qmain(argc, argv); 33 | //自力のVUPチェックをする場合はsslライブラリ関連警告標準出力に出てしまうので、それを抑止 34 | //参考:https://bugreports.qt.io/browse/QTBUG-43173 35 | QLoggingCategory::setFilterRules("qt.network.ssl.warning=false"); 36 | 37 | MainWindow w; 38 | mainwindow_pt = &w; 39 | //シグナルハンドラ設定 40 | memset(&sa_sigint, 0, sizeof(sa_sigint)); 41 | sa_sigint.sa_handler = mainsignal_handler; 42 | 43 | //abort()コールはシグナルキャッチしちゃダメよ 44 | //if (sigaction(SIGABRT, &sa_sigint, NULL) == SYSCALL_ERR) { 45 | // qDebug() << "sigaction SIGINT Error."; 46 | //} 47 | 48 | //ハードウェア障害(メモリ故障など) 49 | if (sigaction(SIGBUS, &sa_sigint, NULL) == SYSCALL_ERR) { 50 | qDebug() << "sigaction SIGBUS Error."; 51 | } 52 | //ゼロ除算、小数点溢れ 53 | if (sigaction(SIGFPE, &sa_sigint, NULL) == SYSCALL_ERR) { 54 | qDebug() << "sigaction SIGFPE Error."; 55 | } 56 | //不正アセンブラコール? 57 | if (sigaction(SIGILL, &sa_sigint, NULL) == SYSCALL_ERR) { 58 | qDebug() << "sigaction SIGILL Error."; 59 | } 60 | //CLI起動時のCtrl+C 61 | if (sigaction(SIGINT, &sa_sigint, NULL) == SYSCALL_ERR) { 62 | qDebug() << "sigaction SIGINT Error."; 63 | } 64 | //kill -9(SIGKILL) 対策はやりたいけどできない。SIGSTOPもね 65 | /* 66 | if (sigaction(SIGKILL, &sa_sigint, NULL) == SYSCALL_ERR) { 67 | qDebug() << "sigaction SIGKILL Error."; 68 | } 69 | */ 70 | //通常終了 71 | if (sigaction(SIGQUIT, &sa_sigint, NULL) == SYSCALL_ERR) { 72 | qDebug() << "sigaction SIGQUIT Error."; 73 | } 74 | //セグメンテーションフォルト 75 | if (sigaction(SIGSEGV, &sa_sigint, NULL) == SYSCALL_ERR) { 76 | qDebug() << "sigaction SIGSEGV Error."; 77 | } 78 | //killデフォルト動作 79 | if (sigaction(SIGTERM, &sa_sigint, NULL) == SYSCALL_ERR) { 80 | qDebug() << "sigaction SIGTERM Error."; 81 | } 82 | 83 | if(w.IsRunasshow()){ 84 | w.show(); 85 | } 86 | else{ 87 | w.hide(); 88 | } 89 | return Qmain.exec(); 90 | } 91 | -------------------------------------------------------------------------------- /mainsettingdialog.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28 4 | Copyright : Kengo Sawatsu 5 | Summary : 「Preference(一般設定)」 のダイアログ 6 | Reference : 7 | ======================================================================== */ 8 | #include "mainsettingdialog.h" 9 | #include "ui_mainsettingdialog.h" 10 | #include "mainwindow.h" 11 | 12 | struct VerifyInfo VERIFYINFO_LIST [] = { 13 | {IDS_SHA1,TDigest::SHA1}, 14 | {IDS_MD5,TDigest::MD5}, 15 | {IDS_XX,TDigest::XX}, 16 | {IDS_SHA2_256,TDigest::SHA2_256}, 17 | {IDS_SHA2_512,TDigest::SHA2_512}, 18 | {IDS_SHA3_256,TDigest::SHA3_256}, 19 | {IDS_SHA3_512,TDigest::SHA3_512}, 20 | }; 21 | 22 | mainsettingDialog::mainsettingDialog(QWidget *parent,Cfg *cfg_pt) : 23 | QDialog(parent), 24 | ui(new Ui::mainsettingDialog) 25 | { 26 | 27 | ui->setupUi(this); 28 | this->cfg = cfg_pt; 29 | //一般タブに初期設定 30 | 31 | //ベリファイモードリスト作成 32 | for (int i=0; VERIFYINFO_LIST[i].resId; i++) { 33 | ui->comboBox_VerifyMode->addItem((char*)GetLoadStrV(VERIFYINFO_LIST[i].resId)); 34 | } 35 | 36 | ui->checkBox_rwstat->setEnabled(false); 37 | ui->checkBox_rwstat->setVisible(false); 38 | GetData(); 39 | ui->general_optionlist->setCurrentRow(0); 40 | 41 | ui->checkBox_Rdahead->setVisible(false); 42 | } 43 | 44 | mainsettingDialog::~mainsettingDialog() 45 | { 46 | delete ui; 47 | } 48 | 49 | //EvCreate代わりのカレントコンフィグ取得->GUI設定ウインドウ 50 | BOOL mainsettingDialog::GetData() 51 | { 52 | //Defaults 53 | ui->lineEdit_Buffer->setText(QString::number(cfg->bufSize)); 54 | ui->checkBox_NonStop->setChecked(cfg->ignoreErr ? true:false); 55 | ui->checkBox_Estimate->setChecked(cfg->estimateMode ? true:false); 56 | ui->checkBox_ACL->setChecked(cfg->enableAcl); 57 | ui->checkBox_Xattr->setChecked(cfg->enableXattr); 58 | ui->checkBox_Dotignore->setChecked(cfg->Dotignore_mode); 59 | ui->checkBox_Verify->setChecked(cfg->enableVerify); 60 | //ui->checkBox_F_NOCACHE->setChecked(cfg->enableF_NOCACHE); 61 | ui->checkBox_LTFS->setChecked(cfg->enableLTFS); 62 | 63 | ui->checkBox_Owdel->setChecked(cfg->enableOwdel); 64 | ui->checkBox_ShowExtend->setChecked(cfg->isExtendFilter); 65 | 66 | ui->checkBox_JobList->setChecked(cfg->isJobListMode); 67 | SetSpeedLevelLabel(cfg->speedLevel); 68 | 69 | //I/O settings 70 | ui->lineEdit_Iomax->setText(QString::number(cfg->maxTransSize)); 71 | ui->lineEdit_aionum->setText(QString::number(cfg->maxAionum)); 72 | ui->checkBox_O_DIRECT->setChecked(cfg->enableOdirect); 73 | 74 | //Copy/Move Options 75 | ui->checkBox_Samedir->setChecked(cfg->isSameDirRename); 76 | ui->checkBox_Nocreate->setChecked(cfg->skipEmptyDir); 77 | ui->checkBox_Symlink->setChecked(cfg->isReparse); 78 | ui->checkBox_Movemode->setChecked(cfg->enableMoveAttr); 79 | ui->checkBox_Moveone->setChecked(cfg->serialMove); 80 | ui->checkBox_Moveone_verify->setChecked(cfg->serialVerifyMove); 81 | ui->checkBox_Noutime->setChecked(cfg->isDisableutime); 82 | ui->checkBox_Dumpdel->setChecked(cfg->enableVerifyErrDel); 83 | 84 | //Delete Options 85 | ui->checkBox_NSA->setChecked(cfg->enableNSA); 86 | ui->checkBox_Delfilter->setChecked(cfg->delDirWithFilter); 87 | 88 | //Log Settings 89 | ui->lineEdit_Srcdstnum->setText(QString::number(cfg->maxHistoryNext)); 90 | ui->checkBox_Errlog->setChecked(cfg->isErrLog); 91 | 92 | ui->checkBox_Filelog->setChecked(cfg->fileLogMode); 93 | if(cfg->fileLogMode & Cfg::AUTO_FILELOG){ 94 | ui->checkBox_FilelogCSV->setChecked(cfg->fileLogMode & Cfg::ADD_CSVFILELOG ? true : false); 95 | } 96 | ui->checkBox_Aclerr->setChecked(cfg->aclErrLog); 97 | ui->checkBox_Xattrerr->setChecked(cfg->streamErrLog); 98 | 99 | //Misc 100 | ui->checkBox_Dontwait->setChecked(cfg->forceStart ? true : false); 101 | ui->checkBox_Confirm_exe->setChecked(cfg->execConfirm); 102 | ui->checkBox_Taskminimize->setChecked(cfg->taskbarMode); 103 | switch(cfg->infoSpan){ 104 | case 0: 105 | ui->radioButton_250ms->setChecked(true); 106 | break; 107 | case 1: 108 | ui->radioButton_500ms->setChecked(true); 109 | break; 110 | case 2: 111 | ui->radioButton_1000ms->setChecked(true); 112 | break; 113 | 114 | default: 115 | ui->radioButton_500ms->setChecked(true); 116 | break; 117 | } 118 | 119 | ui->checkBox_EnglishUI->setChecked(cfg->lcid == QLocale::Japanese ? false : true); 120 | ui->comboBox_VerifyMode->setCurrentIndex(cfg->usingMD5); 121 | ui->checkBox_rwstat->setChecked(cfg->rwstat); 122 | return TRUE; 123 | } 124 | 125 | int mainsettingDialog::SetSpeedLevelLabel(int level) 126 | { 127 | if (level == -1){ 128 | level = ui->slider_Speed->value(); 129 | } 130 | else{ 131 | ui->slider_Speed->setValue(level); 132 | } 133 | 134 | char buf[64]; 135 | sprintf(buf, 136 | level == SPEED_FULL ? (char*)GetLoadStrV(IDS_FULLSPEED_DISP) : 137 | level == SPEED_AUTO ? (char*)GetLoadStrV(IDS_AUTOSLOW_DISP) : 138 | level == SPEED_SUSPEND ? (char*)GetLoadStrV(IDS_SUSPEND_DISP) : 139 | (char*)GetLoadStrV(IDS_RATE_DISP), 140 | level); 141 | ui->label_Realspeed->setText(buf); 142 | return level; 143 | } 144 | 145 | BOOL mainsettingDialog::SetData() 146 | { 147 | //Defaults 148 | cfg->bufSize = ui->lineEdit_Buffer->text().toInt(); 149 | cfg->ignoreErr = ui->checkBox_NonStop->checkState() ? 1 : 0; 150 | cfg->estimateMode = ui->checkBox_Estimate->checkState() ? 1 : 0; 151 | cfg->enableAcl = ui->checkBox_ACL->checkState(); 152 | cfg->enableXattr = ui->checkBox_Xattr->checkState(); 153 | 154 | cfg->enableVerify = ui->checkBox_Verify->checkState(); 155 | //cfg->enableF_NOCACHE = ui->checkBox_F_NOCACHE->checkState(); 156 | cfg->enableOwdel = ui->checkBox_Owdel->checkState(); 157 | cfg->isExtendFilter = ui->checkBox_ShowExtend->checkState(); 158 | cfg->isJobListMode = ui->checkBox_JobList->checkState(); 159 | cfg->speedLevel = SetSpeedLevelLabel(); 160 | 161 | //I/O settings 162 | cfg->maxTransSize = ui->lineEdit_Iomax->text().toInt(); 163 | cfg->maxAionum = ui->lineEdit_aionum->text().toInt(); 164 | cfg->enableOdirect = ui->checkBox_O_DIRECT->checkState(); 165 | 166 | //Copy/Move Options 167 | cfg->isSameDirRename = ui->checkBox_Samedir->checkState(); 168 | cfg->skipEmptyDir = ui->checkBox_Nocreate->checkState() ? 1 : 0; 169 | cfg->isReparse = ui->checkBox_Symlink->checkState(); 170 | cfg->enableMoveAttr = ui->checkBox_Movemode->checkState(); 171 | cfg->serialMove = ui->checkBox_Moveone->checkState(); 172 | cfg->serialVerifyMove = ui->checkBox_Moveone_verify->checkState(); 173 | cfg->enableLTFS = ui->checkBox_LTFS->checkState(); 174 | cfg->Dotignore_mode = ui->checkBox_Dotignore->checkState(); 175 | cfg->isDisableutime = ui->checkBox_Noutime->checkState(); 176 | cfg->enableVerifyErrDel = ui->checkBox_Dumpdel->checkState(); 177 | 178 | //Delete Options 179 | cfg->enableNSA = ui->checkBox_NSA->checkState(); 180 | cfg->delDirWithFilter = ui->checkBox_Delfilter->checkState(); 181 | 182 | //Log Settings 183 | cfg->maxHistoryNext = ui->lineEdit_Srcdstnum->text().toInt(); 184 | cfg->isErrLog = ui->checkBox_Errlog->checkState(); 185 | //廃止 186 | cfg->fileLogMode = ui->checkBox_Filelog->checkState() ? Cfg::AUTO_FILELOG : Cfg::NO_FILELOG; 187 | if(cfg->fileLogMode & Cfg::AUTO_FILELOG){ 188 | cfg->fileLogMode |= ui->checkBox_FilelogCSV->isChecked() ? Cfg::ADD_CSVFILELOG : 0; 189 | } 190 | cfg->aclErrLog = ui->checkBox_Aclerr->checkState(); 191 | cfg->streamErrLog = ui->checkBox_Xattrerr->checkState(); 192 | 193 | //Misc 194 | cfg->forceStart = ui->checkBox_Dontwait->checkState() ? 1 : 0; 195 | cfg->execConfirm = ui->checkBox_Confirm_exe->checkState(); 196 | cfg->taskbarMode = ui->checkBox_Taskminimize->checkState(); 197 | if(ui->radioButton_250ms->isChecked()){ 198 | cfg->infoSpan = 0; 199 | } 200 | else if(ui->radioButton_500ms->isChecked()){ 201 | cfg->infoSpan = 1; 202 | } 203 | else{ 204 | cfg->infoSpan = 2; 205 | } 206 | cfg->lcid = ui->checkBox_EnglishUI->checkState() ? QLocale::English : QLocale::Japanese; 207 | cfg->usingMD5 = ui->comboBox_VerifyMode->currentIndex(); 208 | cfg->rwstat = ui->checkBox_rwstat->checkState(); 209 | return TRUE; 210 | } 211 | 212 | 213 | void mainsettingDialog::on_buttonBox_accepted() 214 | { 215 | //現在設定をcfgクラスに反映 216 | SetData(); 217 | //定義ファイルに書き込む 218 | cfg->WriteIni(); 219 | } 220 | 221 | void mainsettingDialog::on_buttonBox_rejected() 222 | { 223 | //何もしない 224 | } 225 | 226 | void mainsettingDialog::on_general_optionlist_currentRowChanged(int changedrowindex) 227 | { 228 | // qDebug("changed %d",changedrowindex); 229 | } 230 | 231 | void mainsettingDialog::on_slider_Speed_valueChanged(int value) 232 | { 233 | SetSpeedLevelLabel(value); 234 | } 235 | 236 | void mainsettingDialog::on_checkBox_Filelog_stateChanged(int arg1) 237 | { 238 | switch(arg1){ 239 | 240 | case Qt::Unchecked: 241 | ui->checkBox_FilelogCSV->setChecked(false); 242 | ui->checkBox_FilelogCSV->setEnabled(false); 243 | break; 244 | case Qt::Checked: 245 | case Qt::PartiallyChecked: 246 | ui->checkBox_FilelogCSV->setEnabled(true); 247 | break; 248 | default: 249 | break; 250 | } 251 | } 252 | 253 | void mainsettingDialog::on_lineEdit_Iomax_textChanged(const QString &arg1) 254 | { 255 | int iosize = arg1.toInt(); 256 | int olap = ui->lineEdit_aionum->text().toInt(); 257 | ui->lineEdit_totaliosize->setText(QString::number(iosize*olap)); 258 | } 259 | 260 | void mainsettingDialog::on_lineEdit_aionum_textChanged(const QString &arg1) 261 | { 262 | int olap = arg1.toInt(); 263 | int iosize = ui->lineEdit_Iomax->text().toInt(); 264 | ui->lineEdit_totaliosize->setText(QString::number(iosize*olap)); 265 | } 266 | -------------------------------------------------------------------------------- /mainsettingdialog.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef MAINSETTINGDIALOG_H 9 | #define MAINSETTINGDIALOG_H 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | struct VerifyInfo { 18 | UINT resId; 19 | TDigest::Type type; 20 | }; 21 | 22 | namespace Ui { 23 | class mainsettingDialog; 24 | } 25 | 26 | class mainsettingDialog : public QDialog 27 | { 28 | Q_OBJECT 29 | 30 | public: 31 | explicit mainsettingDialog(QWidget *parent = 0,Cfg *cfg_pt = NULL); 32 | ~mainsettingDialog(); 33 | 34 | private: 35 | Ui::mainsettingDialog *ui; 36 | int SetSpeedLevelLabel(int level = -1); 37 | 38 | protected: 39 | Cfg *cfg; 40 | VerifyInfo *verifyInfo; 41 | 42 | private slots: 43 | void on_buttonBox_accepted(); 44 | void on_buttonBox_rejected(); 45 | void on_general_optionlist_currentRowChanged(int changedrowindex); 46 | BOOL SetData(); 47 | BOOL GetData(); 48 | 49 | void on_slider_Speed_valueChanged(int value); 50 | void on_checkBox_Filelog_stateChanged(int arg1); 51 | void on_lineEdit_Iomax_textChanged(const QString &arg1); 52 | void on_lineEdit_aionum_textChanged(const QString &arg1); 53 | }; 54 | 55 | #endif // MAINSETTINGDIALOG_H 56 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-28(Sun) 4 | Copyright : Kengo Sawatsu 5 | Reference : 6 | ======================================================================== */ 7 | 8 | #ifndef MAINWINDOW_H 9 | #define MAINWINDOW_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | //#include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include "cfg.h" 43 | 44 | #define NIM_ADD 0 45 | #define NIM_MODIFY 1 46 | #define NIM_DELETE 2 47 | 48 | #define FASTCOPYLOG_MUTEX FASTCOPY_ELOG_MUTEX 49 | 50 | #define UNICODE_PARAGRAPH_BYTES 3 51 | 52 | //mac OS X では16384が開発機におけるFinderのD&Dでの入力maxパス数だった。 53 | //しかし、16384をフルにQActionに放り込むと選択でぐーるぐるしちゃう&&Qt内部でエラーになっちゃうので、 54 | //安全に倒して1024パスくらいを制限とする。 55 | #define NEW_MAX_HISTORY_BUF ((MAX_PATH + UNICODE_PARAGRAPH_BYTES + STR_NULL_GUARD) * 1024) 56 | #define MAX_HISTORY_BUF 8192 57 | #define MAX_HISTORY_CHAR_BUF (MAX_HISTORY_BUF * 4) 58 | 59 | #define MINI_BUF 128 60 | 61 | #define FILELOG_MINSIZE 512 * 1024 62 | 63 | struct CopyInfo { 64 | UINT resId; 65 | char *list_str; 66 | UINT cmdline_resId; 67 | void *cmdline_name; 68 | FastCopy::Mode mode; 69 | FastCopy::OverWrite overWrite; 70 | }; 71 | 72 | #define MAX_NORMAL_FASTCOPY_ICON 4 73 | #define FCNORMAL_ICON_IDX 0 74 | #define FCWAIT_ICON_IDX MAX_NORMAL_FASTCOPY_ICON 75 | #define MAX_FASTCOPY_ICON MAX_NORMAL_FASTCOPY_ICON + 1 76 | #define ICON_RESOURCE_NAMEBASE ":/icon/icon/" 77 | #define ICON_RESOURCE_EXTNAME ".png" 78 | #define TRANSLATE_RESOURCE_NAMEBASE ":/qm" 79 | #define HELP_RESOURCE_NAMEBASE_JA ":/help/help/index.html" 80 | #define HELP_RESOURCE_NAMEBASE_EN ":/help/help/index_en.html" 81 | #define HELP_RESOURCE_NAMEBASE_EMAIL ":/help/help/RapidCopyEmailSettingExample.png" 82 | #define LOCAL_HELPFILENAME_JA "help_ja.html" 83 | #define LOCAL_HELPFILENAME_EN "help_en.html" 84 | #define LOCAL_HELPFILENAME_EMAIL "RapidCopyEmailSettingExample.png" 85 | #define LOCAL_LICENSEFILE_JP "license_jp.txt" 86 | #define LOCAL_LICENSEFILE_EN "license_en.txt" 87 | 88 | 89 | #define SOUND_RESOURCE_NUM 28 //:/sound/sound/RapidCopy_SE_XX num 90 | #define SOUND_RESOURCE_NAMEBASE ":/sound/sound/RapidCopy_SE_" // + "XXX.wav" 91 | #define LOCAL_SOUNDFILENAME_NAMEBASE "/RapidCopy_SE_" // + "XXX.wav" 92 | #define RAPIDCOPY_REC_DIVIDER "-------------------------------------------------\n" 93 | #define RAPIDCOPY_CSV_REC_DIVIDER "//////////\n" 94 | 95 | #define SPEED_FULL 11 96 | #define SPEED_AUTO 10 97 | #define SPEED_SUSPEND 0 98 | 99 | #define REPORT_COMMAND_NUM 3 //保守資料取得アクション時に実行するコマンドの個数 100 | 101 | #define FINACTCMD_STACKSIZE (1024 * 1024 * 1) //後処理コマンド実行スレッドのスタックサイズ 102 | 103 | // ファイルパスをdragしてくるとついてくるURI 104 | #define URI_FILE_STR "file://" 105 | 106 | #define JOBLISTNAME_MAX 512 //JOBLIST name maxlen(include null) 107 | #define CMD_ARG_ERR EX_USAGE //CLIモード実行で引数不正 108 | 109 | class Command_Thread : public QThread{ 110 | Q_OBJECT 111 | public: 112 | Command_Thread(QString *command,int stack_size,QStringList *arg_v=NULL); 113 | void run(); 114 | 115 | private: 116 | int my_stacksize; //自Thread StackSize 117 | QString *command; //command文字列 118 | QStringList *arg_v; //引数リスト 119 | }; 120 | 121 | namespace Ui { 122 | class MainWindow; 123 | } 124 | 125 | class MainWindow : public QMainWindow 126 | { 127 | Q_OBJECT 128 | 129 | public slots: 130 | 131 | bool EvClicked(void); 132 | //QtではGUIの操作を行うのはメインスレッドじゃないとダメ。 133 | //しかし、他スレッドからpostEventしても他のスレッド自身のイベントディスパッチャに渡されてしまいフリーズ。 134 | //仕方ないのでGUI更新を行うイベント出口処理をピンポイントにSLOT化 135 | FastCopy::Confirm ConfirmNotify(FastCopy::Confirm _confirm); 136 | 137 | public: 138 | explicit MainWindow(QWidget *parent = 0); 139 | ~MainWindow(); 140 | 141 | bool EnableErrLogFile(bool on); 142 | int CmdNameToComboIndex(void *cmd_name); 143 | 144 | bool CommandLineExecV(int argc,QStringList argv); 145 | 146 | bool SetMiniWindow(void); 147 | bool SetWindowTitle(); 148 | bool IsRunasshow() {return isRunAsshow;} 149 | _int64 GetDateInfo(void *buf, bool is_end); 150 | _int64 GetSizeInfo(void *buf); 151 | bool SetInfo(bool is_finish_status=FALSE); 152 | bool SetStatusBarInfo(TransInfo *ti_ptr,bool is_finish_status); 153 | bool SetJobListInfo(TransInfo *ti,bool is_finish_status); 154 | enum SetHistMode { SETHIST_LIST, SETHIST_EDIT, SETHIST_CLEAR, SETHIST_INIT }; 155 | void SetComboBox(QComboBox *item, void **history, SetHistMode mode); 156 | void SetComboBox_new(QPlainTextEdit *item, void **history, SetHistMode mode); 157 | void SetPathHistory_new(SetHistMode mode, QObject *item); 158 | void SetFilterHistory(SetHistMode mode, QComboBox *item=NULL); 159 | bool TaskTray(int nimMode, QIcon*hSetIcon , char* tip); 160 | CopyInfo *GetCopyInfo() { return copyInfo; } 161 | void SetFinAct(int idx); 162 | int GetFinActIdx() { return finActIdx; } 163 | QString GetJobTitle(); 164 | void SetJobTitle(void *title); 165 | void DelJobTitle(void); 166 | int GetSrclen(); 167 | int GetDstlen(); 168 | QString GetSrc(); 169 | QString GetDst(); 170 | int GetDiskMode(); 171 | int GetCopyModeIndex(); 172 | void GetJobfromMain(Job *job); 173 | void GetFilterfromMain(char* inc,char* exc,char* from_date, 174 | char* to_date,char* min_size,char* max_size); 175 | FastCopy::Mode GetCopyMode(void); 176 | FastCopy::OverWrite GetOverWriteMode(void); 177 | 178 | void sighandler_mainwindow(int signum); 179 | 180 | protected: 181 | enum AutoCloseLevel { NO_CLOSE, NOERR_CLOSE, FORCE_CLOSE }; 182 | enum { NORMAL_EXEC=1, LISTING_EXEC=2, CMDLINE_EXEC=4 ,VERIFYONLY_EXEC=8}; 183 | enum { RUNAS_IMMEDIATE=1, RUNAS_SHELLEXT=2, RUNAS_AUTOCLOSE=4 }; 184 | 185 | FastCopy fastCopy; 186 | FastCopy::Info info; 187 | 188 | int orgArgc; 189 | QStringList orgArgv; 190 | Cfg cfg; 191 | QIcon *hMainIcon[MAX_FASTCOPY_ICON]; 192 | CopyInfo *copyInfo; 193 | int finActIdx; 194 | int doneRatePercent; 195 | int lastTotalSec; 196 | int calcTimes; 197 | bool isAbort; 198 | 199 | AutoCloseLevel autoCloseLevel; 200 | bool isTaskTray; 201 | int speedLevel; 202 | bool isMouseover; //マウスオーバー判定フラグ true=マウスオーバー中 false=マウスオーバー無し 203 | 204 | bool noConfirmDel; 205 | bool noConfirmStop; 206 | UINT diskMode; 207 | bool isRegExp; 208 | bool isShellExt; //未使用未実装 209 | int skipEmptyDir; 210 | int forceStart; 211 | bool dotignoremode; 212 | char errLogPathV[MAX_PATH]; 213 | char fileLogPathV[MAX_PATH]; 214 | char fileCsvPathV[MAX_PATH]; 215 | QString fileLogDirV; 216 | char statLogPathV[MAX_PATH]; 217 | bool isErrLog; 218 | int fileLogMode; 219 | bool isReparse; 220 | bool isLinkDest; 221 | int maxLinkHash; 222 | bool isReCreate; 223 | bool resultStatus; 224 | 225 | int listBufOffset; 226 | int csvfileBufOffset; 227 | int errBufOffset; 228 | bool isErrEditHide; 229 | UINT curIconIndex; 230 | bool isDelay; 231 | 232 | struct tm startTm; 233 | QString *pathLogBuf; 234 | QString *pathLogcsvBuf; 235 | int hErrLog; 236 | void *hErrLogMutex; 237 | int hFileLog; 238 | int hcsvFileLog; //csv出力専用ファイルハンドル 239 | int hStatLog; 240 | TransInfo ti; 241 | QString mailsub; //subject(件名)用文字列 242 | QString mailbody; //body(本文)用文字列 243 | bool isCommandStart; //CLIで起動したか?true=CLI,false=GUI 244 | 245 | // for detect autoslow status 246 | DWORD timerCnt; 247 | DWORD timerLast; 248 | QThread::Priority curPriority; 249 | QTimer mw_Timer; //メインウインドウ用タイムアウトタイマ 250 | QTime sys_time; // システム起動時からの通算秒取得用 251 | int mw_TimerId; // mainwindowタイマID 252 | Command_Thread *hCommandThread; //後処理の外部コマンド実行用スレッド 253 | QString jobtitle_static; //カレントjob名用ワーク。JOBTITLE_STATICの代わり 254 | QSystemTrayIcon systray; //最小化時のシステムトレイオブジェクト 255 | 256 | bool isRunAsshow; //スタート時、GUI表示する? 257 | bool verify_before; //GUIでのベリファイ専用モード指定時、変更前のverify有無記憶 258 | QPalette default_palette; //標準の色覚えておく用 259 | QMediaPlayer player; //終了時処理でのサウンド再生用 260 | QProcess command_process[REPORT_COMMAND_NUM]; //保守資料取得時起動するプロセス数 261 | QString commands[REPORT_COMMAND_NUM]; //実行するコマンド文字列の配列 262 | QStringList args[REPORT_COMMAND_NUM]; //実行コマンドに投入する引数 263 | QByteArray p_data[REPORT_COMMAND_NUM]; //実行コマンドの標準出力を受け取るバッファ 264 | QDateTime dateTime; //保守資料取得実行時刻 265 | int commands_donecnt; //保守資料取得時、並列同時実行したプロセスの実行終了した数 266 | QMenu src_HistoryMenu; //src入力フィールドのヒストリ用メニュー 267 | QMenu dst_HistoryMenu; //dst入力フィールドのヒストリ用メニュー 268 | QLabel status_label; //statusBarに表示する文字列用領域 269 | 270 | //各種設定用ダイアログ 271 | mainsettingDialog *setupDlg; 272 | confirmDialog *confirmDlg; 273 | aboutDialog *aboutDlg; 274 | FinActDialog *finactDlg; 275 | JobDialog *jobDlg; 276 | JobListRenameDialog *joblistrenameDlg; 277 | 278 | //終了時処理のメニューアクション用 279 | QActionGroup *finact_Group; 280 | QAction *finAct_Menu; 281 | //ジョブ関連メニューアクション用 282 | QActionGroup *job_Group; //jobの数に合わせてがんがる 283 | QList job_Groups; //JobGroupの数にあわせて作成されるメニュー群 284 | QMenu *joblist_menu; //fix joblist menu; 285 | //srchistory 286 | QActionGroup *srchist_Group; 287 | //dsthistory 288 | QActionGroup *dsthist_Group; 289 | //QApplicationインスタンス 290 | QCoreApplication *main; 291 | QTranslator *translater; 292 | 293 | QList joblist; //ジョブリストのワーク 294 | int joblistcurrentidx; //現在実行中のジョブリスト中のジョブ番号 295 | bool joblistisstarting; //true=ジョブリスト実行中 false=ジョブリスト実行してない 296 | bool joblistiscancel; //true=ジョブリストキャンセル要求 false = ジョブリストキャンセルしてない 297 | struct tm jobliststarttm; //ジョブリストがスタートした時の時刻 298 | int joblistcurrentfileidx;//詳細ファイルログ枝番用 299 | int joblist_joberrornum;//ジョブリスト中で失敗したジョブの数 300 | //0=いずれのジョブも失敗してない. 数=エラーになったジョブの数 301 | bool joblist_cancelsignal;//ジョブリストの変更検知用フラグ 302 | bool joblist_isnosave; //ジョブリストがセーブ済みじゃないフラグ 303 | Job joblist_prev_job; //ジョブリスト操作中、直前まで操作していたジョブ内容のコピー 304 | 305 | protected: 306 | bool SetCopyModeList(void); 307 | bool IsForeground(); 308 | bool IsSendingMail(bool is_prepare); 309 | bool IsFirstJob(); 310 | bool IsLastJob(); 311 | bool SetupWindow(); 312 | bool event(QEvent *event); 313 | void changeEvent(QEvent *event); 314 | void timerEvent(QTimerEvent *timer_event); 315 | 316 | bool ExecCopy(DWORD exec_flags); 317 | bool ExecCopyCore(void); 318 | bool EndCopy(void); 319 | bool ExecFinalAction(); 320 | bool CancelCopy(void); 321 | 322 | void SetItemEnable(bool is_delete); 323 | void SetItemEnable_Verify(bool verify_before_update=true); 324 | void SetExtendFilter(bool enable); 325 | void ReflectFilterCheck(bool enabled); 326 | bool SwapTarget(bool check_only=FALSE); 327 | bool SwapTargetCore(const void *s, const void *d, void *out_s, void *out_d); 328 | void UpdateMenu(); 329 | void UpdateJobList(bool req_current = false); 330 | void EnableJobList(bool required_unlock); 331 | void EnableJobMenus(bool isEnable); 332 | bool CheckJobListmodified(); 333 | void SetJob(int idx,bool use_joblistwk=false,bool cancel_signal=false); 334 | bool IsListing() { return (info.flags & FastCopy::LISTING_ONLY) ? true : FALSE; } 335 | bool IsVerifyListing() { return (info.flags & FastCopy::LISTING_ONLY_VERIFY) ? true : false; } 336 | void SetPriority(QThread::Priority new_class); 337 | int UpdateSpeedLevel(BOOL is_timer=FALSE); 338 | void SetListInfo(); 339 | void SetFileLogInfo(); 340 | void WriteStatInfo(); 341 | bool SetTaskTrayInfo(bool is_finish_status, double doneRate, int remain_h, int remain_m, 342 | int remain_s); 343 | bool CalcInfo(double *doneRate, int *remain_sec, int *total_sec); 344 | void EditPathLog(QString *buf,void* src,void * dst,bool is_delete_mode,char* inc,char* exc,int idx,bool csv_req); 345 | void WriteLogHeader(int hFile, bool add_filelog=true,bool csv_title=false); 346 | bool WriteLogFooter(int hFile,bool csv_title=false); 347 | bool WriteErrLog(bool is_initerr=FALSE,int message_no=0); 348 | void WriteMailLog(); 349 | bool StartFileLog(); 350 | void EndFileLog(); 351 | bool StartStatLog(); 352 | void EndStatLog(); 353 | bool InitEv(); 354 | void SetJobListmodifiedSignal(bool enable); 355 | bool EvCreate(); 356 | 357 | int SetSpeedLevelLabel(int level); 358 | void Show(int mode=SW_NORMAL); 359 | void castPath(QPlainTextEdit *target,QString append_path,int append_path_count,bool replace_req); 360 | void LaunchNextJob(); 361 | bool isJobListwithSilent(); 362 | bool UpdateJobListtoini(); 363 | bool DeleteJobListtoini(QString del_joblistname); 364 | 365 | void dragEnterEvent(QDragEnterEvent *event); 366 | void dropEvent(QDropEvent *event); 367 | bool eventFilter(QObject *target, QEvent *event); 368 | void closeEvent(QCloseEvent *event); 369 | 370 | private slots: 371 | 372 | void jobListjob_Change_Detected(); 373 | void on_actionUserDir_U_triggered(); 374 | void on_actionOpenLog_triggered(); 375 | void on_actionHelp_triggered(); 376 | void on_actionSwap_Source_DestDir_triggered(); 377 | void on_actionShow_Extended_Filter_toggled(bool arg1); 378 | void on_actionMain_Settings_triggered(); 379 | void on_actionAuto_HDD_mode_triggered(bool checked); 380 | void on_actionSame_HDD_mode_triggered(bool checked); 381 | void on_actionDiff_HDD_mode_triggered(bool checked); 382 | void on_actionWindowPos_Fix_triggered(bool checked); 383 | void on_actionWindowSize_Fix_triggered(bool checked); 384 | void on_actionAbout_triggered(); 385 | void on_actionRun_RapidCopy_triggered(); 386 | void on_speed_Slider_valueChanged(int value); 387 | void actpostprocess_triggered(QAction *_action); 388 | void actpostprocessdlg_triggered(); 389 | void job_triggered(QAction *_action); 390 | void hist_triggered(QAction *_action); 391 | void on_actionShow_SingleJob_triggered(); 392 | void iconActivated(QSystemTrayIcon::ActivationReason reason); 393 | void on_checkBox_Verify_clicked(bool checked); 394 | void on_Latest_URL_triggered(); 395 | void on_actionSave_Report_at_Desktop_triggered(); 396 | void process_stdout_output(); 397 | void process_exit(); 398 | void on_plainTextEdit_Src_textChanged(); 399 | void on_actionOpenDetailLogDir_triggered(); 400 | void on_actionQuit_triggered(); 401 | void on_actionClear_Source_and_DestDir_triggered(); 402 | void on_plainTextEdit_Src_blockCountChanged(int newBlockCount); 403 | void on_plainTextEdit_Dst_textChanged(); 404 | void on_actionClose_Window_triggered(); 405 | void on_comboBox_Mode_currentIndexChanged(int index); 406 | void on_pushButton_JobDelete_clicked(); 407 | void on_pushButton_JobDeleteAll_clicked(); 408 | void on_pushButton_JobListSave_clicked(); 409 | void on_pushButton_JobListDelete_clicked(); 410 | void on_pushButton_JobListRename_clicked(); 411 | void on_comboBox_JobListName_activated(int index); 412 | void on_comboBox_JobListName_editTextChanged(const QString &arg1); 413 | void on_checkBox_JobListForceLaunch_clicked(bool checked); 414 | void on_listWidget_JobList_itemChanged(QListWidgetItem *item); 415 | void listWidget_JobList_rowsMoved(QModelIndex parent,int start,int end,QModelIndex dest,int row); 416 | void on_actionEnable_JobList_Mode_toggled(bool arg1); 417 | void on_listWidget_JobList_clicked(const QModelIndex &index); 418 | void on_checkBox_LTFS_stateChanged(int arg1); 419 | 420 | private: 421 | Ui::MainWindow *ui; 422 | }; 423 | #endif // MAINWINDOW_H 424 | -------------------------------------------------------------------------------- /osl.cpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-29 4 | Copyright : Kengo Sawatsu 5 | Summary : FastCopyの互換関数群 6 | Reference : 7 | ======================================================================== */ 8 | #include "osl.h" 9 | #include "string.h" 10 | 11 | //max関数ないので自分で定義 12 | int max(int a,int b){ 13 | return a>b?a:b; 14 | } 15 | 16 | int min(int a,int b){ 17 | return aC++型変換及びOS依存定数ヘッダ 8 | ======================================================================== */ 9 | 10 | #ifndef OSL_H 11 | #define OSL_H 12 | 13 | #include 14 | #include 15 | #include 16 | //system static convert 17 | 18 | #define MAX_PATH PATH_MAX 19 | 20 | //VC++ -> ANSI C99 Type Convert 21 | #define BOOL bool 22 | #define UINT unsigned int 23 | #define WCHAR char 24 | #define DWORD unsigned long 25 | #define WORD long 26 | #define TRUE true 27 | #define FALSE false 28 | #define BYTE unsigned char 29 | 30 | #define _int64 qint64 31 | #define BLANKARG (void*)&"" 32 | 33 | #define INVALID_HANDLE_VALUE (NULL) 34 | 35 | #define STAT (struct stat_t) 36 | 37 | #define SYSCALL_ERR (-1) 38 | #define FCNTL_ON 1 39 | 40 | int max(int a,int b); 41 | int min(int a,int b); 42 | bool IsDir2(int d); 43 | 44 | // errnoと発生ファイル名、発生システムコール名を表示するマクロ 45 | // 使用する時はerrno.hをincludeしてね 46 | #define ERRNO_OUT(_err_no,_name) { \ 47 | printf("error caused CALL= %s FILE=%s,LINE=%d,errno=%d\n",_name,__FILE__,__LINE__,_err_no); \ 48 | fflush(stdout); \ 49 | } 50 | 51 | #define ERRQT_OUT(_no,_name,_string){ \ 52 | printf("error caused CALL= %s FILE=%s,LINE=%d,no=%d,string=%s\n",_name,__FILE__,__LINE__,_no,_string); \ 53 | fflush(stdout); \ 54 | } 55 | 56 | #define STR_NULL_GUARD 1 //MAX_PATHなど、あてにならない文字列長定数の\0保証 57 | 58 | //struct tm補正用定数 59 | #define TM_YEAR_OFFSET 1900 60 | #define TM_MONTH_OFFSET 1 61 | 62 | //nanosleep用定数 63 | #define NANO_SECOND_MULTIPLIER 1000000 // 1 millisecond = 1,000,000 Nanoseconds 64 | const long INTERVAL_MS = 250 * NANO_SECOND_MULTIPLIER; 65 | const long INTERVAL_MS_AIO = 500 * NANO_SECOND_MULTIPLIER; 66 | 67 | //statfsのf_typeで取得できるファイルシステムタイプdefine 68 | //usr/include/linux/magic.h以外で認識したいファイルシステムをdefineする。 69 | //本来はkernelに直接書かれているものらしい。。(manによると) 70 | #define CIFS_MAGIC_NUMBER 0xFF534D42 71 | #define FUSE_SUPER_MAGIC 0x65735546 72 | #define HFS_SUPER_MAGIC 0x4244 73 | #define JFS_SUPER_MAGIC 0x3153464a 74 | #define NTFS_SB_MAGIC 0x5346544e 75 | #define UDF_SUPER_MAGIC 0x15013346 76 | #define XFS_SUPER_MAGIC 0x58465342 77 | #define SMB2_SUPER_MAGIC 0xFE534D42 78 | 79 | //Log出力時の文字列 80 | //RapidCopyが独自に決めてるだけだよ 81 | #define FSLOGNAME_UNKNOWN "UNKNOWN" 82 | #define FSLOGNAME_ADFS "ADFS" 83 | #define FSLOGNAME_AFS "AFS" 84 | #define FSLOGNAME_CODA "CODA" 85 | #define FSLOGNAME_EXT "EXT" 86 | #define FSLOGNAME_EXT2 FSLOGNAME_EXT 87 | #define FSLOGNAME_EXT3 FSLOGNAME_EXT 88 | #define FSLOGNAME_EXT4 FSLOGNAME_EXT 89 | #define FSLOGNAME_BTRFS "BTRFS" 90 | #define FSLOGNAME_F2FS "F2FS" 91 | #define FSLOGNAME_ISO "ISO" 92 | #define FSLOGNAME_FAT "FAT" 93 | #define FSLOGNAME_NFS "NFS" 94 | #define FSLOGNAME_REISERFS "REISERFS" 95 | #define FSLOGNAME_SMBFS "SMB" 96 | #define FSLOGNAME_SMB2FS "SMB2" 97 | #define FSLOGNAME_CIFS "CIFS" 98 | #define FSLOGNAME_FUSE "FUSE" 99 | #define FSLOGNAME_HFS "HFS" 100 | #define FSLOGNAME_JFS "JFS" 101 | #define FSLOGNAME_NTFS "NTFS" 102 | #define FSLOGNAME_UDF "UDF" 103 | #define FSLOGNAME_XFS "XFS" 104 | 105 | #define SW_NORMAL 10 106 | #define SW_MINIMIZE 11 107 | #define SW_HIDE 12 108 | #define SW_SHOW 13 109 | 110 | #endif // OSL_H 111 | -------------------------------------------------------------------------------- /qblowfish.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of QBlowfish and is licensed under the MIT License 3 | 4 | Copyright (C) 2012 Roopesh Chander 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject 12 | to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 21 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 22 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | 27 | #include "qblowfish.h" 28 | #include "qblowfish_p.h" 29 | #include 30 | #include 31 | 32 | QBlowfish::QBlowfish(const QByteArray &key) 33 | : m_key(key) 34 | , m_initialized(false) 35 | , m_paddingEnabled(false) 36 | { 37 | } 38 | 39 | void QBlowfish::setPaddingEnabled(bool enabled) 40 | { 41 | m_paddingEnabled = enabled; 42 | } 43 | 44 | bool QBlowfish::isPaddingEnabled() const 45 | { 46 | return m_paddingEnabled; 47 | } 48 | 49 | QByteArray QBlowfish::encrypted(const QByteArray &_clearText) 50 | { 51 | QByteArray clearText(_clearText); 52 | if (clearText.isEmpty()) { 53 | return QByteArray(); 54 | } 55 | 56 | if (isPaddingEnabled()) { 57 | // Add padding as per PKCS5 58 | // Ref: RFC 5652 http://tools.ietf.org/html/rfc5652#section-6.3 59 | quint8 paddingLength = 8 - (clearText.size() % 8); 60 | QByteArray paddingBa(paddingLength, static_cast(paddingLength)); 61 | clearText.append(paddingBa); 62 | } else { 63 | if (clearText.size() % 8 != 0) { 64 | qWarning("Cannot encrypt. Clear-text length is not a multiple of 8 and padding is not enabled."); 65 | return QByteArray(); 66 | } 67 | } 68 | 69 | Q_ASSERT(clearText.size() % 8 == 0); 70 | if ((clearText.size() % 8 == 0) && init()) { 71 | 72 | QByteArray copyBa(clearText.constData(), clearText.size()); 73 | for (int i = 0; i < clearText.size(); i += 8) { 74 | coreEncrypt(copyBa.data() + i); 75 | } 76 | return copyBa; 77 | 78 | } 79 | return QByteArray(); 80 | } 81 | 82 | QByteArray QBlowfish::decrypted(const QByteArray &cipherText) 83 | { 84 | if (cipherText.isEmpty()) { 85 | return QByteArray(); 86 | } 87 | 88 | //Q_ASSERT(cipherText.size() % 8 == 0); 89 | if ((cipherText.size() % 8 == 0) && init()) { 90 | 91 | QByteArray copyBa(cipherText.constData(), cipherText.size()); 92 | for (int i = 0; i < cipherText.size(); i += 8) { 93 | coreDecrypt(copyBa.data() + i); 94 | } 95 | 96 | if (isPaddingEnabled()) { 97 | // Remove padding as per PKCS5 98 | quint8 paddingLength = static_cast(copyBa.right(1).at(0)); 99 | QByteArray paddingBa(paddingLength, static_cast(paddingLength)); 100 | if (copyBa.right(paddingLength) == paddingBa) { 101 | return copyBa.left(copyBa.length() - paddingLength); 102 | } 103 | return QByteArray(); 104 | } 105 | return copyBa; 106 | } 107 | return QByteArray(); 108 | } 109 | 110 | /* 111 | Core encryption code follows. This is an implementation of the Blowfish algorithm as described at: 112 | http://www.schneier.com/paper-blowfish-fse.html 113 | */ 114 | 115 | bool QBlowfish::init() 116 | { 117 | if (m_initialized) { 118 | return true; 119 | } 120 | 121 | if (m_key.isEmpty()) { 122 | qWarning("Cannot init. Key is empty."); 123 | return false; 124 | } 125 | 126 | m_sbox1 = QByteArray::fromHex(QByteArray::fromRawData(sbox0, SBOX_SIZE_BYTES * 2)); 127 | m_sbox2 = QByteArray::fromHex(QByteArray::fromRawData(sbox1, SBOX_SIZE_BYTES * 2)); 128 | m_sbox3 = QByteArray::fromHex(QByteArray::fromRawData(sbox2, SBOX_SIZE_BYTES * 2)); 129 | m_sbox4 = QByteArray::fromHex(QByteArray::fromRawData(sbox3, SBOX_SIZE_BYTES * 2)); 130 | m_parray = QByteArray::fromHex(QByteArray::fromRawData(parray, PARRAY_SIZE_BYTES * 2)); 131 | 132 | const QByteArray &key = m_key; 133 | int keyLength = key.length(); 134 | for (int i = 0; i < PARRAY_SIZE_BYTES; i++) { 135 | m_parray[i] = static_cast(static_cast(m_parray[i]) ^ static_cast(key[i % keyLength])); 136 | } 137 | 138 | char seed[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 139 | 140 | // Update p-array 141 | for (int i = 0; i < (PARRAY_SIZE_BYTES / 4); i += 2) { 142 | coreEncrypt(seed); 143 | for (int j = 0; j < 8; j++) { 144 | // P1 = xL; P2 = xR 145 | m_parray[i * 4 + j] = seed[j]; 146 | } 147 | } 148 | 149 | // Update s-boxes 150 | for (int sboxIndex = 1; sboxIndex <= 4; sboxIndex++) { 151 | QByteArray *sbox = 0; 152 | switch (sboxIndex) { 153 | case 1: sbox = &m_sbox1; break; 154 | case 2: sbox = &m_sbox2; break; 155 | case 3: sbox = &m_sbox3; break; 156 | case 4: sbox = &m_sbox4; break; 157 | default: Q_ASSERT(false); 158 | } 159 | Q_ASSERT(sbox != 0); 160 | 161 | for (int i = 0; i < (SBOX_SIZE_BYTES / 4); i += 2) { 162 | coreEncrypt(seed); 163 | for (int j = 0; j < 8; j++) { 164 | // S1,1 = xL; S1,2 = xR 165 | sbox->operator[](i * 4 + j) = seed[j]; 166 | } 167 | } 168 | } 169 | 170 | m_initialized = true; 171 | return true; 172 | } 173 | 174 | void QBlowfish::coreEncrypt(char *x) // encrypts 8 bytes pointed to by x, result is written to the same location 175 | { 176 | // Divide x into two 32-bit halves: xL, xR 177 | char *xL = x; 178 | char *xR = x + 4; 179 | uchar f_xL_bytes[4] = { 0, 0, 0, 0 }; 180 | 181 | for (int i = 0; i < 16; i++) { 182 | 183 | // xL = xL XOR Pi 184 | for (int j = 0; j < 4; j++) { 185 | // quint8 old_xL = xL[j]; 186 | xL[j] = static_cast(static_cast(xL[j]) ^ static_cast(m_parray[i * 4 + j])); 187 | } 188 | 189 | // Divide xL into four eight-bit quarters: a, b, c, and d 190 | quint8 a = static_cast(xL[0]); 191 | quint8 b = static_cast(xL[1]); 192 | quint8 c = static_cast(xL[2]); 193 | quint8 d = static_cast(xL[3]); 194 | 195 | // F(xL) = ((S1,a + S2,b mod 2**32) XOR S3,c) + S4,d mod 2**32 196 | quint32 s1a = qFromBigEndian(reinterpret_cast(m_sbox1.constData() + a * 4)); 197 | quint32 s2b = qFromBigEndian(reinterpret_cast(m_sbox2.constData() + b * 4)); 198 | quint32 s3c = qFromBigEndian(reinterpret_cast(m_sbox3.constData() + c * 4)); 199 | quint32 s4d = qFromBigEndian(reinterpret_cast(m_sbox4.constData() + d * 4)); 200 | quint32 f_xL = ((((s1a + s2b) & 0xffffffff) ^ s3c) + s4d) & 0xffffffff; 201 | qToBigEndian(f_xL, f_xL_bytes); 202 | 203 | // xR = F(xL) XOR xR 204 | for (int j = 0; j < 4; j++) { 205 | xR[j] = static_cast(static_cast(f_xL_bytes[j]) ^ static_cast(xR[j])); 206 | } 207 | 208 | // Swap xL and xR, but not in the last iteration 209 | if (i != 15) { 210 | for (int j = 0; j < 4; j++) { 211 | char temp = xL[j]; 212 | xL[j] = xR[j]; 213 | xR[j] = temp; 214 | } 215 | } 216 | 217 | } 218 | 219 | // xR = xR XOR P17 220 | // xL = xL XOR P18 221 | for (int j = 0; j < 4; j++) { 222 | xR[j] = static_cast(static_cast(xR[j]) ^ static_cast(m_parray[16 * 4 + j])); 223 | xL[j] = static_cast(static_cast(xL[j]) ^ static_cast(m_parray[17 * 4 + j])); 224 | } 225 | } 226 | 227 | void QBlowfish::coreDecrypt(char *x) // decrypts 8 bytes pointed to by x, result is written to the same location 228 | { 229 | // Divide x into two 32-bit halves: xL, xR 230 | char *xL = x; 231 | char *xR = x + 4; 232 | uchar f_xL_bytes[4] = { 0, 0, 0, 0 }; 233 | 234 | // xL = xL XOR P18 235 | // xR = xR XOR P17 236 | for (int j = 0; j < 4; j++) { 237 | xL[j] = static_cast(static_cast(xL[j]) ^ static_cast(m_parray[17 * 4 + j])); 238 | xR[j] = static_cast(static_cast(xR[j]) ^ static_cast(m_parray[16 * 4 + j])); 239 | } 240 | 241 | for (int i = 15; i >= 0; i--) { 242 | 243 | // Swap xL and xR, but not in the first iteration 244 | if (i != 15) { 245 | for (int j = 0; j < 4; j++) { 246 | char temp = xL[j]; 247 | xL[j] = xR[j]; 248 | xR[j] = temp; 249 | } 250 | } 251 | 252 | // Divide xL into four eight-bit quarters: a, b, c, and d 253 | quint8 a = static_cast(xL[0]); 254 | quint8 b = static_cast(xL[1]); 255 | quint8 c = static_cast(xL[2]); 256 | quint8 d = static_cast(xL[3]); 257 | 258 | // F(xL) = ((S1,a + S2,b mod 2**32) XOR S3,c) + S4,d mod 2**32 259 | quint32 s1a = qFromBigEndian(reinterpret_cast(m_sbox1.constData() + a * 4)); 260 | quint32 s2b = qFromBigEndian(reinterpret_cast(m_sbox2.constData() + b * 4)); 261 | quint32 s3c = qFromBigEndian(reinterpret_cast(m_sbox3.constData() + c * 4)); 262 | quint32 s4d = qFromBigEndian(reinterpret_cast(m_sbox4.constData() + d * 4)); 263 | quint32 f_xL = ((((s1a + s2b) & 0xffffffff) ^ s3c) + s4d) & 0xffffffff; 264 | qToBigEndian(f_xL, f_xL_bytes); 265 | 266 | // xR = F(xL) XOR xR 267 | for (int j = 0; j < 4; j++) { 268 | xR[j] = static_cast(static_cast(f_xL_bytes[j]) ^ static_cast(xR[j])); 269 | } 270 | 271 | // xL = xL XOR Pi 272 | for (int j = 0; j < 4; j++) { 273 | xL[j] = static_cast(static_cast(xL[j]) ^ static_cast(m_parray[i * 4 + j])); 274 | } 275 | 276 | } 277 | } 278 | -------------------------------------------------------------------------------- /qblowfish.h: -------------------------------------------------------------------------------- 1 | #ifndef QBLOWFISH_H 2 | #define QBLOWFISH_H 3 | 4 | #include 5 | 6 | class QBlowfish 7 | { 8 | public: 9 | QBlowfish(const QByteArray &key); 10 | bool init(); 11 | 12 | // Padding: 13 | // 14 | // Blowfish works on 8-byte blocks. Padding makes it usable even 15 | // in case where the input size is not in exact 8-byte blocks. 16 | // 17 | // If padding is disabled (the default), encrypted() will work only if the 18 | // input size (in bytes) is a multiple of 8. (If it's not a multiple of 8, 19 | // encrypted() will return a null bytearray.) 20 | // 21 | // If padding is enabled, we increase the input length to a multiple of 8 22 | // by padding bytes as per PKCS5 23 | // 24 | // If padding was enabled during encryption, it should be enabled during 25 | // decryption for correct decryption (and vice versa). 26 | 27 | void setPaddingEnabled(bool enabled); 28 | bool isPaddingEnabled() const; 29 | 30 | // Encrypt / decrypt 31 | QByteArray encrypted(const QByteArray &clearText); 32 | QByteArray decrypted(const QByteArray &cipherText); 33 | 34 | private: 35 | // core encrypt/decrypt methods, encrypts/decrypts in-place 36 | void coreEncrypt(char *x); 37 | void coreDecrypt(char *x); 38 | 39 | QByteArray m_key; 40 | bool m_initialized; 41 | bool m_paddingEnabled; 42 | QByteArray m_parray; 43 | QByteArray m_sbox1, m_sbox2, m_sbox3, m_sbox4; 44 | }; 45 | 46 | #endif // QBLOWFISH_H 47 | -------------------------------------------------------------------------------- /qblowfish_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | Source: http://www.schneier.com/code/constants.txt 3 | */ 4 | 5 | #ifndef Q_BLOWFISH_P_H 6 | #define Q_BLOWFISH_P_H 7 | 8 | #define SBOX_SIZE_BYTES (256 * 4) 9 | #define PARRAY_SIZE_BYTES (18 * 4) 10 | 11 | char sbox0[] = 12 | "d1310ba698dfb5ac2ffd72dbd01adfb7b8e1afed6a267e96" 13 | "ba7c9045f12c7f9924a19947b3916cf70801f2e2858efc16" 14 | "636920d871574e69a458fea3f4933d7e0d95748f728eb658" 15 | "718bcd5882154aee7b54a41dc25a59b59c30d5392af26013" 16 | "c5d1b023286085f0ca417918b8db38ef8e79dcb0603a180e" 17 | "6c9e0e8bb01e8a3ed71577c1bd314b2778af2fda55605c60" 18 | "e65525f3aa55ab945748986263e8144055ca396a2aab10b6" 19 | "b4cc5c341141e8cea15486af7c72e993b3ee1411636fbc2a" 20 | "2ba9c55d741831f6ce5c3e169b87931eafd6ba336c24cf5c" 21 | "7a325381289586773b8f48986b4bb9afc4bfe81b66282193" 22 | "61d809ccfb21a991487cac605dec8032ef845d5de98575b1" 23 | "dc262302eb651b8823893e81d396acc50f6d6ff383f44239" 24 | "2e0b4482a484200469c8f04a9e1f9b5e21c66842f6e96c9a" 25 | "670c9c61abd388f06a51a0d2d8542f68960fa728ab5133a3" 26 | "6eef0b6c137a3be4ba3bf0507efb2a98a1f1651d39af0176" 27 | "66ca593e82430e888cee8619456f9fb47d84a5c33b8b5ebe" 28 | "e06f75d885c12073401a449f56c16aa64ed3aa62363f7706" 29 | "1bfedf72429b023d37d0d724d00a1248db0fead349f1c09b" 30 | "075372c980991b7b25d479d8f6e8def7e3fe501ab6794c3b" 31 | "976ce0bd04c006bac1a94fb6409f60c45e5c9ec2196a2463" 32 | "68fb6faf3e6c53b51339b2eb3b52ec6f6dfc511f9b30952c" 33 | "cc814544af5ebd09bee3d004de334afd660f2807192e4bb3" 34 | "c0cba85745c8740fd20b5f39b9d3fbdb5579c0bd1a60320a" 35 | "d6a100c6402c7279679f25fefb1fa3cc8ea5e9f8db3222f8" 36 | "3c7516dffd616b152f501ec8ad0552ab323db5fafd238760" 37 | "53317b483e00df829e5c57bbca6f8ca01a87562edf1769db" 38 | "d542a8f6287effc3ac6732c68c4f5573695b27b0bbca58c8" 39 | "e1ffa35db8f011a010fa3d98fd2183b84afcb56c2dd1d35b" 40 | "9a53e479b6f84565d28e49bc4bfb9790e1ddf2daa4cb7e33" 41 | "62fb1341cee4c6e8ef20cada36774c01d07e9efe2bf11fb4" 42 | "95dbda4dae909198eaad8e716b93d5a0d08ed1d0afc725e0" 43 | "8e3c5b2f8e7594b78ff6e2fbf2122b648888b812900df01c" 44 | "4fad5ea0688fc31cd1cff191b3a8c1ad2f2f2218be0e1777" 45 | "ea752dfe8b021fa1e5a0cc0fb56f74e818acf3d6ce89e299" 46 | "b4a84fe0fd13e0b77cc43b81d2ada8d9165fa26680957705" 47 | "93cc7314211a1477e6ad206577b5fa86c75442f5fb9d35cf" 48 | "ebcdaf0c7b3e89a0d6411bd3ae1e7e4900250e2d2071b35e" 49 | "226800bb57b8e0af2464369bf009b91e5563911d59dfa6aa" 50 | "78c14389d95a537f207d5ba202e5b9c5832603766295cfa9" 51 | "11c819684e734a41b3472dca7b14a94a1b5100529a532915" 52 | "d60f573fbc9bc6e42b60a47681e6740008ba6fb5571be91f" 53 | "f296ec6b2a0dd915b6636521e7b9f9b6ff34052ec5855664" 54 | "53b02d5da99f8fa108ba47996e85076a" 55 | ; 56 | 57 | char sbox1[] = 58 | "4b7a70e9b5b32944db75092ec4192623ad6ea6b049a7df7d" 59 | "9cee60b88fedb266ecaa8c71699a17ff5664526cc2b19ee1" 60 | "193602a575094c29a0591340e4183a3e3f54989a5b429d65" 61 | "6b8fe4d699f73fd6a1d29c07efe830f54d2d38e6f0255dc1" 62 | "4cdd20868470eb266382e9c6021ecc5e09686b3f3ebaefc9" 63 | "3c9718146b6a70a1687f358452a0e286b79c5305aa500737" 64 | "3e07841c7fdeae5c8e7d44ec5716f2b8b03ada37f0500c0d" 65 | "f01c1f040200b3ffae0cf51a3cb574b225837a58dc0921bd" 66 | "d19113f97ca92ff69432477322f547013ae5e58137c2dadc" 67 | "c8b576349af3dda7a94461460fd0030eecc8c73ea4751e41" 68 | "e238cd993bea0e2f3280bba1183eb3314e548b384f6db908" 69 | "6f420d03f60a04bf2cb8129024977c795679b072bcaf89af" 70 | "de9a771fd9930810b38bae12dccf3f2e5512721f2e6b7124" 71 | "501adde69f84cd877a5847187408da17bc9f9abce94b7d8c" 72 | "ec7aec3adb851dfa63094366c464c3d2ef1c18473215d908" 73 | "dd433b3724c2ba1612a14d432a65c45150940002133ae4dd" 74 | "71dff89e10314e5581ac77d65f11199b043556f1d7a3c76b" 75 | "3c11183b5924a509f28fe6ed97f1fbfa9ebabf2c1e153c6e" 76 | "86e34570eae96fb1860e5e0a5a3e2ab3771fe71c4e3d06fa" 77 | "2965dcb999e71d0f803e89d65266c8252e4cc9789c10b36a" 78 | "c6150eba94e2ea78a5fc3c531e0a2df4f2f74ea7361d2b3d" 79 | "1939260f19c279605223a708f71312b6ebadfe6eeac31f66" 80 | "e3bc4595a67bc883b17f37d1018cff28c332ddefbe6c5aa5" 81 | "6558218568ab9802eecea50fdb2f953b2aef7dad5b6e2f84" 82 | "1521b62829076170ecdd4775619f151013cca830eb61bd96" 83 | "0334fe1eaa0363cfb5735c904c70a239d59e9e0bcbaade14" 84 | "eecc86bc60622ca79cab5cabb2f3846e648b1eaf19bdf0ca" 85 | "a02369b9655abb5040685a323c2ab4b3319ee9d5c021b8f7" 86 | "9b540b19875fa09995f7997e623d7da8f837889a97e32d77" 87 | "11ed935f166812810e358829c7e61fd696dedfa17858ba99" 88 | "57f584a51b2272639b83c3ff1ac24696cdb30aeb532e3054" 89 | "8fd948e46dbc312858ebf2ef34c6ffeafe28ed61ee7c3c73" 90 | "5d4a14d9e864b7e342105d14203e13e045eee2b6a3aaabea" 91 | "db6c4f15facb4fd0c742f442ef6abbb5654f3b1d41cd2105" 92 | "d81e799e86854dc7e44b476a3d816250cf62a1f25b8d2646" 93 | "fc8883a0c1c7b6a37f1524c369cb749247848a0b5692b285" 94 | "095bbf00ad19489d1462b17423820e0058428d2a0c55f5ea" 95 | "1dadf43e233f70613372f0928d937e41d65fecf16c223bdb" 96 | "7cde3759cbee74604085f2a7ce77326ea607808419f8509e" 97 | "e8efd85561d99735a969a7aac50c06c25a04abfc800bcadc" 98 | "9e447a2ec3453484fdd567050e1e9ec9db73dbd3105588cd" 99 | "675fda79e3674340c5c43465713e38d83d28f89ef16dff20" 100 | "153e21e78fb03d4ae6e39f2bdb83adf7" 101 | ; 102 | 103 | char sbox2[] = 104 | "e93d5a68948140f7f64c261c94692934411520f77602d4f7" 105 | "bcf46b2ed4a20068d40824713320f46a43b7d4b7500061af" 106 | "1e39f62e9724454614214f74bf8b88404d95fc1d96b591af" 107 | "70f4ddd366a02f45bfbc09ec03bd97857fac6dd031cb8504" 108 | "96eb27b355fd3941da2547e6abca0a9a28507825530429f4" 109 | "0a2c86dae9b66dfb68dc1462d7486900680ec0a427a18dee" 110 | "4f3ffea2e887ad8cb58ce0067af4d6b6aace1e7cd3375fec" 111 | "ce78a399406b2a4220fe9e35d9f385b9ee39d7ab3b124e8b" 112 | "1dc9faf74b6d185626a36631eae397b23a6efa74dd5b4332" 113 | "6841e7f7ca7820fbfb0af54ed8feb397454056acba489527" 114 | "55533a3a20838d87fe6ba9b7d096954b55a867bca1159a58" 115 | "cca9296399e1db33a62a4a563f3125f95ef47e1c9029317c" 116 | "fdf8e80204272f7080bb155c05282ce395c11548e4c66d22" 117 | "48c1133fc70f86dc07f9c9ee41041f0f404779a45d886e17" 118 | "325f51ebd59bc0d1f2bcc18f41113564257b7834602a9c60" 119 | "dff8e8a31f636c1b0e12b4c202e1329eaf664fd1cad18115" 120 | "6b2395e0333e92e13b240b62eebeb92285b2a20ee6ba0d99" 121 | "de720c8c2da2f728d012784595b794fd647d0862e7ccf5f0" 122 | "5449a36f877d48fac39dfd27f33e8d1e0a476341992eff74" 123 | "3a6f6eabf4f8fd37a812dc60a1ebddf8991be14cdb6e6b0d" 124 | "c67b55106d672c372765d43bdcd0e804f1290dc7cc00ffa3" 125 | "b5390f92690fed0b667b9ffbcedb7d9ca091cf0bd9155ea3" 126 | "bb132f88515bad247b9479bf763bd6eb37392eb3cc115979" 127 | "8026e297f42e312d6842ada7c66a2b3b12754ccc782ef11c" 128 | "6a124237b79251e706a1bbe64bfb63501a6b101811caedfa" 129 | "3d25bdd8e2e1c3c9444216590a121386d90cec6ed5abea2a" 130 | "64af674eda86a85fbebfe98864e4c3fe9dbc8057f0f7c086" 131 | "60787bf86003604dd1fd8346f6381fb07745ae04d736fccc" 132 | "83426b33f01eab71b08041873c005e5f77a057bebde8ae24" 133 | "55464299bf582e614e58f48ff2ddfda2f474ef388789bdc2" 134 | "5366f9c3c8b38e74b475f25546fcd9b97aeb26618b1ddf84" 135 | "846a0e79915f95e2466e598e20b457708cd55591c902de4c" 136 | "b90bace1bb8205d011a862487574a99eb77f19b6e0a9dc09" 137 | "662d09a1c4324633e85a1f0209f0be8c4a99a0251d6efe10" 138 | "1ab93d1d0ba5a4dfa186f20f2868f169dcb7da83573906fe" 139 | "a1e2ce9b4fcd7f5250115e01a70683faa002b5c40de6d027" 140 | "9af88c27773f8641c3604c0661a806b5f0177a28c0f586e0" 141 | "006058aa30dc7d6211e69ed72338ea6353c2dd94c2c21634" 142 | "bbcbee5690bcb6deebfc7da1ce591d766f05e4094b7c0188" 143 | "39720a3d7c927c2486e3725f724d9db91ac15bb4d39eb8fc" 144 | "ed54557808fca5b5d83d7cd34dad0fc41e50ef5eb161e6f8" 145 | "a28514d96c51133c6fd5c7e756e14ec4362abfceddc6c837" 146 | "d79a323492638212670efa8e406000e0" 147 | ; 148 | 149 | char sbox3[] = 150 | "3a39ce37d3faf5cfabc277375ac52d1b5cb0679e4fa33742" 151 | "d382274099bc9bbed5118e9dbf0f7315d62d1c7ec700c47b" 152 | "b78c1b6b21a19045b26eb1be6a366eb45748ab2fbc946e79" 153 | "c6a376d26549c2c8530ff8ee468dde7dd5730a1d4cd04dc6" 154 | "2939bbdba9ba4650ac9526e8be5ee304a1fad5f06a2d519a" 155 | "63ef8ce29a86ee22c089c2b843242ef6a51e03aa9cf2d0a4" 156 | "83c061ba9be96a4d8fe51550ba645bd62826a2f9a73a3ae1" 157 | "4ba99586ef5562e9c72fefd3f752f7da3f046f6977fa0a59" 158 | "80e4a91587b086019b09e6ad3b3ee593e990fd5a9e34d797" 159 | "2cf0b7d9022b8b5196d5ac3a017da67dd1cf3ed67c7d2d28" 160 | "1f9f25cfadf2b89b5ad6b4725a88f54ce029ac71e019a5e6" 161 | "47b0acfded93fa9be8d3c48d283b57ccf8d5662979132e28" 162 | "785f0191ed756055f7960e44e3d35e8c15056dd488f46dba" 163 | "03a161250564f0bdc3eb9e153c9057a297271aeca93a072a" 164 | "1b3f6d9b1e6321f5f59c66fb26dcf3197533d928b155fdf5" 165 | "035634828aba3cbb28517711c20ad9f8abcc5167ccad925f" 166 | "4de817513830dc8e379d58629320f991ea7a90c2fb3e7bce" 167 | "5121ce64774fbe32a8b6e37ec3293d4648de53696413e680" 168 | "a2ae0810dd6db22469852dfd09072166b39a460a6445c0dd" 169 | "586cdecf1c20c8ae5bbef7dd1b588d40ccd2017f6bb4e3bb" 170 | "dda26a7e3a59ff453e350a44bcb4cdd572eacea8fa6484bb" 171 | "8d6612aebf3c6f47d29be463542f5d9eaec2771bf64e6370" 172 | "740e0d8de75b1357f8721671af537d5d4040cb084eb4e2cc" 173 | "34d2466a0115af84e1b0042895983a1d06b89fb4ce6ea048" 174 | "6f3f3b823520ab82011a1d4b277227f8611560b1e7933fdc" 175 | "bb3a792b344525bda08839e151ce794b2f32c9b7a01fbac9" 176 | "e01cc87ebcc7d1f6cf0111c3a1e8aac71a908749d44fbd9a" 177 | "d0dadecbd50ada380339c32ac69136678df9317ce0b12b4f" 178 | "f79e59b743f5bb3af2d519ff27d9459cbf97222c15e6fc2a" 179 | "0f91fc719b941525fae59361ceb69cebc2a8645912baa8d1" 180 | "b6c1075ee3056a0c10d25065cb03a442e0ec6e0e1698db3b" 181 | "4c98a0be3278e9649f1f9532e0d392dfd3a0342b8971f21e" 182 | "1b0a74414ba3348cc5be7120c37632d8df359f8d9b992f2e" 183 | "e60b6f470fe3f11de54cda541edad891ce6279cfcd3e7e6f" 184 | "1618b166fd2c1d05848fd2c5f6fb2299f523f357a6327623" 185 | "93a8353156cccd02acf081625a75ebb56e16369788d273cc" 186 | "de96629281b949d04c50901b71c65614e6c6c7bd327a140a" 187 | "45e1d006c3f27b9ac9aa53fd62a80f00bb25bfe235bdd2f6" 188 | "71126905b2040222b6cbcf7ccd769c2b53113ec01640e3d3" 189 | "38abbd602547adf0ba38209cf746ce7677afa1c520756060" 190 | "85cbfe4e8ae88dd87aaaf9b04cf9aa7e1948c25c02fb8a8c" 191 | "01c36ae4d6ebe1f990d4f869a65cdea03f09252dc208e69f" 192 | "b74e6132ce77e25b578fdfe33ac372e6" 193 | ; 194 | 195 | char parray[] = 196 | "243f6a8885a308d313198a2e03707344a4093822299f31d0" 197 | "082efa98ec4e6c89452821e638d01377be5466cf34e90c6c" 198 | "c0ac29b7c97c50dd3f84d5b5b54709179216d5d98979fb1b" 199 | ; 200 | 201 | #endif // Q_BLOWFISH_P_H 202 | -------------------------------------------------------------------------------- /rapidcopy_main.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-02-24T19:03:31 4 | # 5 | #------------------------------------------------- 6 | QT += gui 7 | 8 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets multimedia 9 | 10 | QMAKE_CXXFLAGS += -std=c++11 11 | 12 | #CONFIG parameter detail. Default is Ubuntu. 13 | #If you want to build on CentOS7, Change below. 14 | #CentOS = CentOS7 15 | 16 | #CONFIG += CentOS7 17 | 18 | TARGET = RapidCopy 19 | DEFINES += _GNU_SOURCE 20 | TRANSLATIONS += RapidCopy_ja_JP.ts 21 | 22 | if(CentOS7){ 23 | LIBS += /usr/lib64/libacl.so /usr/lib64/libbsd.so 24 | DEFINES += _CENTOS7 25 | } 26 | else{ 27 | LIBS += /usr/lib/libacl.so /usr/lib/x86_64-linux-gnu/libbsd.so 28 | DEFINE += _UBUNTU 29 | } 30 | 31 | SOURCES += main.cpp \ 32 | mainwindow.cpp \ 33 | cfg.cpp \ 34 | fastcopy.cpp \ 35 | osl.cpp \ 36 | regexp.cpp \ 37 | tapi32ex.cpp \ 38 | tapi32v.cpp \ 39 | tlist.cpp \ 40 | tmisc.cpp \ 41 | utility.cpp \ 42 | version.cpp \ 43 | mainsettingdialog.cpp \ 44 | confirmdialog.cpp \ 45 | aboutdialog.cpp \ 46 | xxhash.c \ 47 | finactdialog.cpp \ 48 | smtp.cpp \ 49 | jobdialog.cpp \ 50 | qblowfish.cpp \ 51 | joblistrenamedialog.cpp 52 | 53 | HEADERS += \ 54 | cfg.h \ 55 | fastcopy.h \ 56 | osl.h \ 57 | regexp.h \ 58 | tapi32ex.h \ 59 | tapi32v.h \ 60 | tlib.h \ 61 | tmisc.h \ 62 | utility.h \ 63 | version.h \ 64 | resource.h \ 65 | mainwindow.h \ 66 | mainsettingdialog.h \ 67 | confirmdialog.h \ 68 | aboutdialog.h \ 69 | xxhash.h \ 70 | finactdialog.h \ 71 | smtp.h \ 72 | jobdialog.h \ 73 | qblowfish.h \ 74 | qblowfish_p.h \ 75 | joblistrenamedialog.h 76 | 77 | FORMS += mainwindow.ui \ 78 | mainsettingdialog.ui \ 79 | confirmdialog.ui \ 80 | aboutdialog.ui \ 81 | finactdialog.ui \ 82 | jobdialog.ui \ 83 | joblistrenamedialog.ui 84 | 85 | RESOURCES += res.qrc 86 | 87 | -------------------------------------------------------------------------------- /regexp.cpp: -------------------------------------------------------------------------------- 1 | static char *regexp_id = 2 | "@(#)Copyright (C) 2005-2006 H.Shirouzu regexp.cpp ver1.84"; 3 | /* ======================================================================== 4 | Project Name : Regular Expression / Wild Card Match Library 5 | Create : 2005-11-03(The) 6 | Update : 2006-01-31(Tue) 7 | ported update : 2016-02-28 8 | Copyright : H.Shirouzu Kengo.Sawatsu 9 | Summary : 独自の正規表現、ワイルドカードライブラリだったが 10 | : Qtベースの機能に移行。 11 | Reference : 12 | ======================================================================== */ 13 | 14 | #include "tlib.h" 15 | #include "regexp.h" 16 | 17 | RegExp_q::RegExp_q() 18 | { 19 | exp_list = new QStringList(); 20 | reg = new QRegExp(); 21 | } 22 | 23 | RegExp_q::~RegExp_q() 24 | { 25 | delete exp_list; 26 | delete reg; 27 | } 28 | 29 | void RegExp_q::Init(char* def_pattern) 30 | { 31 | hasdef_pattern = false; 32 | 33 | if(exp_list){ 34 | delete exp_list; 35 | } 36 | exp_list = new QStringList(); 37 | //初期パターン値設定要求有り? 38 | if(def_pattern){ 39 | exp_list->append(def_pattern); 40 | hasdef_pattern = true; 41 | } 42 | 43 | if(reg){ 44 | delete reg; 45 | } 46 | reg = new QRegExp(); 47 | reg->setPatternSyntax(QRegExp::WildcardUnix); 48 | } 49 | 50 | BOOL RegExp_q::RegisterWildCard(const void *wild_str, RegExp_q::CaseSense cs) 51 | { 52 | if(cs == RegExp_q::CASE_SENSE){ 53 | reg->setCaseSensitivity(Qt::CaseSensitive); 54 | } 55 | else{ 56 | reg->setCaseSensitivity(Qt::CaseInsensitive); 57 | } 58 | reg->setPattern((char*)wild_str); 59 | if(!reg->isValid()){ 60 | return false; 61 | } 62 | 63 | if(!hasdef_pattern){ 64 | exp_list->append((char*)wild_str); 65 | } 66 | //初期値持ちの場合は初期値をクリアしてから追加 67 | else{ 68 | //初期値をクリア 69 | exp_list->clear(); 70 | exp_list->append((char*)wild_str); 71 | hasdef_pattern = false; 72 | } 73 | return true; 74 | } 75 | 76 | BOOL RegExp_q::IsMatch(const void *target) 77 | { 78 | for(int i=0;i < exp_list->size();i++){ 79 | reg->setPattern(exp_list->at(i)); 80 | if(reg->exactMatch((char*)target)){ 81 | return true; 82 | } 83 | } 84 | return false; 85 | } 86 | 87 | BOOL RegExp_q::IsRegistered() 88 | { 89 | return true; 90 | } 91 | 92 | void RegExp_q::RemoveDuplicateEntry(){ 93 | 94 | int remove_entry = 0; 95 | remove_entry = exp_list->removeDuplicates(); 96 | if(remove_entry){ 97 | qDebug("remove entry num = %d",remove_entry); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /regexp.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 2005-2006 H.Shirouzu regexp.cpp ver1.84 */ 2 | /* ======================================================================== 3 | Project Name : Regular Expression / Wild Card Match Library 4 | Create : 2005-11-03(The) 5 | Update : 2006-01-31(Tue) 6 | port update : 2016-02-28 7 | Copyright : H.Shirouzu,Kengo Sawatsu 8 | SUmmary : 正規表現クラス 9 | Reference : 10 | ======================================================================== */ 11 | #include 12 | #include 13 | #include 14 | 15 | //Qtライブラリでワイルドカードするためのクラス 16 | class RegExp_q { 17 | public: 18 | RegExp_q(); 19 | ~RegExp_q(); 20 | 21 | enum CaseSense { CASE_SENSE, CASE_INSENSE }; 22 | 23 | void Init(char* def_pattern=NULL); 24 | BOOL RegisterWildCard(const void *wild_str, CaseSense cs=CASE_SENSE); 25 | BOOL IsMatch(const void *target); 26 | BOOL IsRegistered(void); 27 | void RemoveDuplicateEntry(); 28 | 29 | protected: 30 | QStringList *exp_list; //フィルタ文字列配列のリスト。 31 | QRegExp *reg; 32 | bool hasdef_pattern; 33 | 34 | }; 35 | 36 | 37 | -------------------------------------------------------------------------------- /res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon/RapidCopy0.png 4 | icon/RapidCopy1.png 5 | icon/RapidCopy2.png 6 | icon/RapidCopy3.png 7 | icon/RapidCopy4.png 8 | icon/checkmark.png 9 | icon/delete_sign_filled.png 10 | icon/past.png 11 | 12 | 13 | RapidCopy_ja_JP.qm 14 | 15 | 16 | help/index.html 17 | help/index_en.html 18 | help/RapidCopyEmailSettingExample.png 19 | 20 | 21 | sound/RapidCopy_SE_01.wav 22 | sound/RapidCopy_SE_02.wav 23 | sound/RapidCopy_SE_03.wav 24 | sound/RapidCopy_SE_04.wav 25 | sound/RapidCopy_SE_05.wav 26 | sound/RapidCopy_SE_06.wav 27 | sound/RapidCopy_SE_07.wav 28 | sound/RapidCopy_SE_08.wav 29 | sound/RapidCopy_SE_09.wav 30 | sound/RapidCopy_SE_10.wav 31 | sound/RapidCopy_SE_11.wav 32 | sound/RapidCopy_SE_12.wav 33 | sound/RapidCopy_SE_13.wav 34 | sound/RapidCopy_SE_14.wav 35 | sound/RapidCopy_SE_15.wav 36 | sound/RapidCopy_SE_16.wav 37 | sound/RapidCopy_SE_17.wav 38 | sound/RapidCopy_SE_18.wav 39 | sound/RapidCopy_SE_19.wav 40 | sound/RapidCopy_SE_20.wav 41 | sound/RapidCopy_SE_21.wav 42 | sound/RapidCopy_SE_22.wav 43 | sound/RapidCopy_SE_23.wav 44 | sound/RapidCopy_SE_24.wav 45 | sound/RapidCopy_SE_25.wav 46 | sound/RapidCopy_SE_26.wav 47 | sound/RapidCopy_SE_27.wav 48 | sound/RapidCopy_SE_28.wav 49 | 50 | 51 | license/License_EN.txt 52 | license/License_JP.txt 53 | 54 | 55 | -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | Project Name : Fast/Force copy file and directory 3 | Create : 2016-02-25 4 | Update : 2016-02-25 5 | Copyright : Kengo Sawatsu 6 | port update : 2016-02-28 7 | Reference : 8 | Summary : メッセージカタログ,errnoヘッダ 9 | ======================================================================== */ 10 | 11 | #include 12 | #include 13 | 14 | #define IDS_MKDIR 1 15 | #define IDS_RMDIR 2 16 | #define IDS_SRC_SELECT 3 17 | #define IDS_DST_SELECT 4 18 | #define IDS_SAMEDISK 5 19 | #define IDS_DIFFDISK 6 20 | #define IDS_FIX_SAMEDISK 7 21 | #define IDS_FIX_DIFFDISK 8 22 | #define IDS_VERIFY 9 23 | #define IDS_SHA1 10 24 | #define IDS_MD5 11 25 | #define IDS_XX 12 26 | #define IDS_SHA2_256 13 27 | #define IDS_SHA2_512 14 28 | #define IDS_SHA3_256 15 29 | #define IDS_SHA3_512 16 30 | #define IDS_SIZEVERIFY 17 31 | #define IDS_ALLSKIP 20 32 | #define IDS_ATTRCMP 21 33 | #define IDS_UPDATECOPY 22 34 | #define IDS_FORCECOPY 23 35 | #define IDS_SYNCCOPY 24 36 | #define IDS_MUTUAL 25 37 | #define IDS_MOVEATTR 26 38 | #define IDS_MOVEFORCE 27 39 | #define IDS_DELETE 28 40 | #define IDS_EXECUTE 29 41 | #define IDS_CANCEL 30 42 | #define IDS_BEHAVIOR 31 43 | #define IDS_UPDATE 32 44 | #define IDS_FILESELECT 33 45 | #define IDS_DIRSELECT 34 46 | #define IDS_SAMEPATHERR 41 47 | #define IDS_PARENTPATHERR 42 48 | #define IDS_MOVECONFIRM 43 49 | #define IDS_SHELLEXT_MODIFY 44 50 | #define IDS_SHELLEXT_EXEC 45 51 | #define IDS_FASTCOPYURL 46 52 | #define IDS_FASTCOPYHELP 47 53 | #define IDS_EXCEPTIONLOG 48 54 | #define IDS_SYNCCONFIRM 49 55 | #define IDS_BACKSLASHERR 50 56 | #define IDS_DELETECONFIRM 51 57 | #define IDS_ERRSTOP 60 58 | #define IDS_CONFIRMFORCEEND 61 59 | #define IDS_STOPCONFIRM 62 60 | #define IDS_DELSTOPCONFIRM 63 61 | #define IDS_DELCONFIRM 64 62 | #define IDS_DUPCONFIRM 65 63 | #define IDS_NOFILTER_USAGE 66 64 | #define IDS_LISTCONFIRM 67 65 | #define IDS_JOBNAME 68 66 | #define IDS_JOBNOTFOUND 69 67 | #define IDS_LISTING 70 68 | #define IDS_FIXPOS_MSG 72 69 | #define IDS_FIXSIZE_MSG 73 70 | #define IDS_FINACTNAME 74 71 | #define IDS_FINACTMENU 75 72 | #define IDS_FINACT_NORMAL 76 73 | #define IDS_ELEVATE 77 74 | #define IDS_SHUTDOWN_MSG 78 75 | #define IDS_HIBERNATE_MSG 79 76 | #define IDS_SUSPEND_MSG 80 77 | #define IDS_FINACT_SUSPEND 81 78 | #define IDS_FINACT_HIBERNATE 82 79 | #define IDS_FINACT_SHUTDOWN 83 80 | #define IDS_DATEFORMAT_MSG 84 81 | #define IDS_SIZEFORMAT_MSG 85 82 | #define IDS_CMDNOTFOUND 86 83 | #define IDS_VERIFYNOTFOUND 87 84 | #define IDS_FINACTNOTFOUND 88 85 | #define IDS_DATEISOVER 89 86 | #define IDS_OPENFILE 90 87 | #define IDS_SOUNDFILEERR 91 88 | #define IDS_REPORTOUT 92 89 | #define IDS_VERIFY_FILE_MISSING_ERR 93 90 | #define IDS_VERIFY_FILE_SIZE_ERR 94 91 | #define IDS_VERIFY_FILE_DATE_ERR 95 92 | #define IDS_VERIFY_DIR_MISSING_ERR 96 93 | #define IDS_VERIFY_DIR_SIZE_ERR 97 94 | #define IDS_VERIFY_DIR_DATE_ERR 98 95 | #define IDS_REPORTING_NOT_CANCEL 99 96 | #define IDS_UNDO 100 97 | #define IDS_CUT 101 98 | #define IDS_COPY 102 99 | #define IDS_PASTE 103 100 | #define IDS_DEL 104 101 | #define IDS_SELECTALL 105 102 | #define IDS_STATUS_WAITING_OTHER 106 103 | #define IDS_STATUS_PRESEARCHING 107 104 | #define IDS_STATUS_COPYING 108 105 | #define IDS_STATUS_VERIFYING 109 106 | #define IDS_STATUS_LISTING 110 107 | #define IDS_STATUS_DELETING 111 108 | #define IDS_XYARG_NOTFOUND 112 109 | #define IDS_CLIMODE_PROHIBIT 113 110 | #define IDS_FASTCOPYURL_EN 114 111 | #define IDS_CMDCSVNOTFOUND 119 112 | #define IDS_FACMD_ALWAYS 120 113 | #define IDS_FACMD_NORMAL 121 114 | #define IDS_FACMD_ERROR 122 115 | #define IDS_CMDCSVWITHFILELOG_ERROR 123 116 | #define IDS_CMDLTFSATTR_ERROR 124 117 | #define IDS_PATH_INITERROR 125 118 | #define IDS_CONFIRM_REJECTED 126 119 | #define IDS_VERIFY_ERROR_WARN_1 127 120 | #define IDS_VERIFY_ERROR_WARN_2 128 121 | #define IDS_VERIFY_ERROR_WARN_3 129 122 | #define IDS_MOVEDIR_FAILED 130 123 | #define IDS_NEWWINDOW_FAILED 131 124 | #define IDS_SMALLBUF_ERR 132 125 | 126 | #define IDS_FASTCOPY 1000 127 | #define IDS_USAGE 1001 128 | #define IDS_HIST_CLEAR 1002 129 | #define IDS_SIZESKIP 1003 130 | # 131 | 132 | #define IDS_CMD_NOEXIST_ONLY 1080 133 | #define IDS_CMD_DIFF 1081 134 | #define IDS_CMD_UPDATE 1082 135 | #define IDS_CMD_FORCE_COPY 1083 136 | #define IDS_CMD_SYNC 1084 137 | #define IDS_CMD_MUTUAL 1085 138 | #define IDS_CMD_MOVE 1086 139 | #define IDS_CMD_DELETE 1087 140 | #define IDS_CMD_OPT 1088 141 | #define IDS_CMD_MOVEATTR 1089 142 | #define IDS_BUFSIZE_OPT 1090 143 | #define IDS_ERRSTOP_OPT 1091 144 | #define IDS_OPENWIN_OPT 1092 145 | #define IDS_AUTOCLOSE_OPT 1093 146 | #define IDS_FORCECLOSE_OPT 1094 147 | #define IDS_NOEXEC_OPT 1095 148 | #define IDS_NOCONFIRMDEL_OPT 1096 149 | #define IDS_LOG_OPT 1097 150 | #define IDS_TO_OPT 1098 151 | #define IDS_ESTIMATE_OPT 1099 152 | #define IDS_JOB_OPT 1100 153 | #define IDS_AUTOSLOW_OPT 1101 154 | #define IDS_SPEED_OPT 1102 155 | #define IDS_UTF8LOG_OPT 1103 156 | #define IDS_ALLFILES_FILTER 1104 157 | #define IDS_CMD_VERIFY 1105 158 | #define IDS_JOBLIST_OPT 1106 159 | #define IDS_CMD_SIZE 1107 160 | #define IDS_CMD_SIZEVERIFY 1108 161 | 162 | #define IDS_INCLUDE_OPT 1115 163 | #define IDS_EXCLUDE_OPT 1117 164 | #define IDS_REGEXP_OPT 1119 165 | #define IDS_FORCESTART_OPT 1120 166 | #define IDS_SKIPEMPTYDIR_OPT 1121 167 | #define IDS_DISKMODE_OPT 1122 168 | #define IDS_DISKMODE_SAME 1123 169 | #define IDS_DISKMODE_DIFF 1124 170 | #define IDS_DISKMODE_AUTO 1125 171 | #define IDS_ACL_OPT 1126 172 | #define IDS_STREAM_OPT 1127 173 | #define IDS_OWDEL_OPT 1128 174 | #define IDS_SPEED_FULL 1129 175 | #define IDS_SPEED_AUTOSLOW 1130 176 | #define IDS_SPEED_SUSPEND 1131 177 | #define IDS_REPARSE_OPT 1132 178 | #define IDS_RUNAS_OPT 1133 179 | #define IDS_USERDIR_MENU 1134 180 | #define IDS_LOGFILE_OPT 1135 181 | #define IDS_NOCONFIRMSTOP_OPT 1136 182 | #define IDS_VERIFY_OPT 1137 183 | #define IDS_USEROLDDIR_MENU 1138 184 | #define IDS_WIPEDEL_OPT 1139 185 | #define IDS_SRCFILE_OPT 1140 186 | #define IDS_SRCFILEW_OPT 1141 187 | #define IDS_FINACT_OPT 1142 188 | #define IDS_NOTEPAD 1146 189 | #define IDS_LINKDEST_OPT 1147 190 | #define IDS_RECREATE_OPT 1148 191 | #define IDS_FROMDATE_OPT 1149 192 | #define IDS_TODATE_OPT 1150 193 | #define IDS_MINSIZE_OPT 1151 194 | #define IDS_MAXSIZE_OPT 1152 195 | #define IDS_STANDBY 1153 196 | #define IDS_HIBERNATE 1154 197 | #define IDS_SHUTDOWN 1155 198 | #define IDS_FILELOG_OPT 1156 199 | #define IDS_TRUE 1157 200 | #define IDS_FALSE 1158 201 | #define IDS_FILELOGNAME 1159 202 | #define IDS_FILELOG_SUBDIR 1160 203 | #define IDS_INSTALL_OPT 1161 204 | #define IDS_VERIFYMD5_OPT 1162 205 | #define IDS_VERIFYSHA1_OPT 1163 206 | #define IDS_VERIFYXX_OPT 1164 207 | #define IDS_VERIFYSHA2_256_OPT 1165 208 | #define IDS_VERIFYSHA2_512_OPT 1166 209 | #define IDS_VERIFYSHA3_256_OPT 1167 210 | #define IDS_VERIFYSHA3_512_OPT 1168 211 | #define IDS_FNOCACHE_OPT 1169 212 | #define IDS_LTFS_OPT 1170 213 | #define IDS_VERIFY_FALSE_OPT 1171 214 | #define IDS_DOTIGNORE_OPT 1172 215 | #define IDS_X_OPT 1173 216 | #define IDS_Y_OPT 1174 217 | #define IDS_FILECSVNAME 1175 218 | #define IDS_FILECSVTITLE 1176 219 | #define IDS_FILECSVEX 1177 220 | #define IDS_FILECSV_OPT 1178 221 | 222 | #define IDS_FULLSPEED_DISP 1201 223 | #define IDS_AUTOSLOW_DISP 1202 224 | #define IDS_SUSPEND_DISP 1203 225 | #define IDS_RATE_DISP 1204 226 | 227 | #define IDS_DST_CASE_ERR 1206 228 | #define IDS_FINACT_CRESAV_INFO 1207 229 | #define IDS_FINACT_DELETE_INFO 1208 230 | #define IDS_JOBACT_SUCCESS_INFO 1209 231 | #define IDS_JOBACT_ERROR_INFO 1210 232 | #define IDS_FINACT_WAIT_INFO 1211 233 | #define IDS_GROWL_TITLE 1212 234 | #define IDS_PATH_INPUT 1213 235 | #define IDS_PATH_ADDED 1214 236 | #define IDS_JOBACT_ERROR_DETAIL_INFO 1215 237 | #define IDS_SRCHEAP_ERROR 1216 238 | #define IDS_SRCPATH_CLEAR 1217 239 | #define IDS_DSTPATH_CLEAR 1218 240 | #define IDS_FINACT_SANDBOX_SOUND_ERR 1219 241 | #define IDS_ABOUT_WINDOWTITLE 1220 242 | #define IDS_FINACT_EMPTYSTR 1221 243 | 244 | #define IDS_SIZECHANGED_ERROR 1229 245 | #define IDS_LTFS_REPLACE_WARN 1230 246 | #define IDS_LTFS_REPLACE_ERROR 1231 247 | #define IDS_JOBLISTACT_SUCCESS_INFO 1232 248 | #define IDS_JOBLISTACT_ERROR_INFO 1233 249 | #define IDS_JOB_DELETEREQ 1234 250 | #define IDS_JOBLISTDEL_SUCCESS_INFO 1235 251 | #define IDS_JOBLISTDEL_ERROR_INFO 1236 252 | #define IDS_JOBLISTMAX_ERROR 1237 253 | #define IDS_JOBGROUPDEL_ERROR 1238 254 | #define IDS_JOBLIST_PLACEHOLDER 1239 255 | #define IDS_JOBLIST_CANCEL 1240 256 | #define IDS_JOBLIST_EXECUTE 1241 257 | #define IDS_JOBLIST_JOBSAVE 1242 258 | #define IDS_JOBLISTNOTFOUND 1243 259 | #define IDS_SINGLELIST_MENUNAME 1244 260 | #define IDS_JOBLIST_CHANGENOTIFY 1245 261 | #define IDS_JOBNAME_CHANGE 1246 262 | #define IDS_JOBNAME_DUPERROR 1247 263 | #define IDS_JOBLIST_MENUNAME 1248 264 | #define IDS_SINGLEJOB_MODERROR 1249 265 | #define IDS_JOBLISTRENAME_TITLE 1250 266 | #define IDS_JOBLIST_DELETEREQ 1251 267 | #define IDS_JOB_DELETEALLREQ 1252 268 | #define IDS_JOB_CHANGEDNOTIFY 1253 269 | #define IDS_LTFS_REPLACE_CHECK_ERR 1254 270 | 271 | #define TOOLTIP_TXTEDIT_SRC 1300 272 | #define TOOLTIP_TXTEDIT_DST 1301 273 | 274 | #define FINACT_MENUITEM 30026 275 | 276 | //4xxxx はerrnoをベースにRapidCopy独自のエラーメッセージ変換する用 277 | #define RAPIDCOPY_ERRNO_BASE 40000 278 | #define RAPIDCOPY_ERRNO_EPERM RAPIDCOPY_ERRNO_BASE + EPERM 279 | #define RAPIDCOPY_ERRNO_ENOENT RAPIDCOPY_ERRNO_BASE + ENOENT 280 | #define RAPIDCOPY_ERRNO_EINTR RAPIDCOPY_ERRNO_BASE + EINTR 281 | #define RAPIDCOPY_ERRNO_EIO RAPIDCOPY_ERRNO_BASE + EIO 282 | #define RAPIDCOPY_ERRNO_ENXIO RAPIDCOPY_ERRNO_BASE + ENXIO 283 | #define RAPIDCOPY_ERRNO_E2BIG RAPIDCOPY_ERRNO_BASE + E2BIG 284 | #define RAPIDCOPY_ERRNO_ENOEXEC RAPIDCOPY_ERRNO_BASE + ENOEXEC 285 | #define RAPIDCOPY_ERRNO_EBADF RAPIDCOPY_ERRNO_BASE + EBADF 286 | #define RAPIDCOPY_ERRNO_ENOMEM RAPIDCOPY_ERRNO_BASE + ENOMEM 287 | #define RAPIDCOPY_ERRNO_EACCES RAPIDCOPY_ERRNO_BASE + EACCES 288 | #define RAPIDCOPY_ERRNO_EFAULT RAPIDCOPY_ERRNO_BASE + EFAULT 289 | #define RAPIDCOPY_ERRNO_ENOTBLK RAPIDCOPY_ERRNO_BASE + ENOTBLK 290 | #define RAPIDCOPY_ERRNO_EBUSY RAPIDCOPY_ERRNO_BASE + EBUSY 291 | #define RAPIDCOPY_ERRNO_EEXIST RAPIDCOPY_ERRNO_BASE + EEXIST 292 | #define RAPIDCOPY_ERRNO_EXDEV RAPIDCOPY_ERRNO_BASE + EXDEV 293 | #define RAPIDCOPY_ERRNO_ENODEV RAPIDCOPY_ERRNO_BASE + ENODEV 294 | #define RAPIDCOPY_ERRNO_ENOTDIR RAPIDCOPY_ERRNO_BASE + ENOTDIR 295 | #define RAPIDCOPY_ERRNO_EISDIR RAPIDCOPY_ERRNO_BASE + EISDIR 296 | #define RAPIDCOPY_ERRNO_EINVAL RAPIDCOPY_ERRNO_BASE + EINVAL 297 | #define RAPIDCOPY_ERRNO_ENFILE RAPIDCOPY_ERRNO_BASE + ENFILE 298 | #define RAPIDCOPY_ERRNO_EMFILE RAPIDCOPY_ERRNO_BASE + EMFILE 299 | #define RAPIDCOPY_ERRNO_EFBIG RAPIDCOPY_ERRNO_BASE + EFBIG 300 | #define RAPIDCOPY_ERRNO_ENOSPC RAPIDCOPY_ERRNO_BASE + ENOSPC 301 | #define RAPIDCOPY_ERRNO_EROFS RAPIDCOPY_ERRNO_BASE + EROFS 302 | #define RAPIDCOPY_ERRNO_EMLINK RAPIDCOPY_ERRNO_BASE + EMLINK 303 | //blank math 304 | #define RAPIDCOPY_ERRNO_EAGAIN RAPIDCOPY_ERRNO_BASE + EAGAIN 305 | //blank ipc/network 306 | #define RAPIDCOPY_ERRNO_ENOTSUP RAPIDCOPY_ERRNO_BASE + ENOTSUP 307 | #define RAPIDCOPY_ERRNO_ENETDOWN RAPIDCOPY_ERRNO_BASE + ENETDOWN 308 | #define RAPIDCOPY_ERRNO_ENETUNREACH RAPIDCOPY_ERRNO_BASE + ENETUNREACH 309 | #define RAPIDCOPY_ERRNO_ENETRESET RAPIDCOPY_ERRNO_BASE + ENETRESET 310 | #define RAPIDCOPY_ERRNO_ECONNABORTED RAPIDCOPY_ERRNO_BASE + ECONNABORTED 311 | #define RAPIDCOPY_ERRNO_ECONNRESET RAPIDCOPY_ERRNO_BASE + ECONNRESET 312 | #define RAPIDCOPY_ERRNO_ENOBUFS RAPIDCOPY_ERRNO_BASE + ENOBUFS 313 | #define RAPIDCOPY_ERRNO_ETIMEDOUT RAPIDCOPY_ERRNO_BASE + ETIMEDOUT 314 | //blank network 315 | #define RAPIDCOPY_ERRNO_ELOOP RAPIDCOPY_ERRNO_BASE + ELOOP 316 | #define RAPIDCOPY_ERRNO_ENAMETOOLONG RAPIDCOPY_ERRNO_BASE + ENAMETOOLONG 317 | //blank 318 | #define RAPIDCOPY_ERRNO_EDQUOT RAPIDCOPY_ERRNO_BASE + EDQUOT 319 | //blank nfs 320 | 321 | #define RAPIDCOPY_ERRNO_ENOSYS RAPIDCOPY_ERRNO_BASE + ENOSYS 322 | //blank 323 | //#define RAPIDCOPY_ERRNO_EDEVERR RAPIDCOPY_ERRNO_BASE + EDEVERR 324 | //#define RAPIDCOPY_ERRNO_EOVERFLOW RAPIDCOPY_ERRNO_BASE + EOVERFLOW 325 | //blankmann 326 | #define RAPIDCOPY_ERRNO_ENOATTR RAPIDCOPY_ERRNO_BASE + ENOATTR 327 | //blank 328 | #define RAPIDCOPY_ERRNO_EOPNOTSUPP RAPIDCOPY_ERRNO_BASE + EOPNOTSUPP 329 | 330 | 331 | //5xxxx is error counter message ID 332 | #define RAPIDCOPY_COUNTER_BASE 50000 333 | #define RAPIDCOPY_COUNTER_XATTR_ENOTSUP RAPIDCOPY_COUNTER_BASE 334 | #define RAPIDCOPY_COUNTER_ACL_EOPNOTSUPP RAPIDCOPY_COUNTER_BASE + 1 335 | #define RAPIDCOPY_COUNTER_UTIMES_EAGAIN RAPIDCOPY_COUNTER_BASE + 2 336 | #define RAPIDCOPY_COUNTER_XATTR_ENOTSUP_EA RAPIDCOPY_COUNTER_BASE + 3 337 | 338 | // sentinel 339 | #define IDS_SENTINEL 0xffffffff 340 | 341 | 342 | -------------------------------------------------------------------------------- /smtp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Raivis Strogonovs 3 | 4 | http://morf.lv 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | */ 12 | 13 | #include "smtp.h" 14 | #include "finactdialog.h" 15 | Smtp::Smtp( const QString &user, const QString &pass, const QString &host, int port, int timeout ) 16 | { 17 | 18 | socket = new QSslSocket(this); 19 | 20 | connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead())); 21 | connect(socket, SIGNAL(connected()), this, SLOT(connected() ) ); 22 | connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this,SLOT(errorReceived(QAbstractSocket::SocketError))); 23 | connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(stateChanged(QAbstractSocket::SocketState))); 24 | connect(socket, SIGNAL(disconnected()), this,SLOT(disconnected())); 25 | 26 | 27 | this->user = user; 28 | this->pass = pass; 29 | 30 | this->host = host; 31 | this->port = port; 32 | this->timeout = timeout; 33 | 34 | 35 | } 36 | 37 | void Smtp::sendMail(const QString &from, const QString &to, const QString &subject, const QString &body, QStringList files) 38 | { 39 | message = "To: " + to + "\n"; 40 | message.append("From: " + from + "\n"); 41 | message.append("Subject: " + subject + "\n"); 42 | 43 | //Let's intitiate multipart MIME with cutting boundary "frontier" 44 | message.append("MIME-Version: 1.0\n"); 45 | message.append("Content-Type: multipart/mixed; boundary=frontier\n\n"); 46 | 47 | 48 | 49 | message.append( "--frontier\n" ); 50 | //message.append( "Content-Type: text/html\n\n" ); //Uncomment this for HTML formating, coment the line below 51 | message.append( "Content-Type: text/plain\n\n" ); 52 | message.append(body); 53 | message.append("\n\n"); 54 | 55 | if(!files.isEmpty()) 56 | { 57 | //qDebug() << "Files to be sent: " << files.size(); 58 | foreach(QString filePath, files) 59 | { 60 | QFile file(filePath); 61 | if(file.exists()) 62 | { 63 | if (!file.open(QIODevice::ReadOnly)) 64 | { 65 | //qDebug("Couldn't open the file"); 66 | QMessageBox::warning( 0, tr( "Qt Simple SMTP client" ), tr( "Couldn't open the file\n\n" ) ); 67 | return ; 68 | } 69 | QByteArray bytes = file.readAll(); 70 | message.append( "--frontier\n" ); 71 | message.append( "Content-Type: application/octet-stream\nContent-Disposition: attachment; filename="+ QFileInfo(file.fileName()).fileName() +";\nContent-Transfer-Encoding: base64\n\n" ); 72 | message.append(bytes.toBase64()); 73 | message.append("\n"); 74 | } 75 | } 76 | } 77 | else 78 | //qDebug() << "No attachments found"; 79 | 80 | 81 | message.append( "--frontier--\n" ); 82 | 83 | message.replace( QString::fromLatin1( "\n" ), QString::fromLatin1( "\r\n" ) ); 84 | message.replace( QString::fromLatin1( "\r\n.\r\n" ),QString::fromLatin1( "\r\n..\r\n" ) ); 85 | 86 | 87 | this->from = from; 88 | rcpt = to; 89 | state = Init; 90 | socket->connectToHostEncrypted(host, port); //"smtp.gmail.com" and 465 for gmail TLS 91 | if (!socket->waitForConnected(timeout)) { 92 | //qDebug() << socket->errorString(); 93 | } 94 | 95 | t = new QTextStream( socket ); 96 | 97 | 98 | 99 | } 100 | 101 | Smtp::~Smtp() 102 | { 103 | delete t; 104 | delete socket; 105 | } 106 | void Smtp::stateChanged(QAbstractSocket::SocketState socketState) 107 | { 108 | //qDebug() <<"stateChanged " << socketState; 109 | } 110 | 111 | void Smtp::errorReceived(QAbstractSocket::SocketError socketError) 112 | { 113 | //qDebug() << "error " <errorString(); 120 | } 121 | 122 | void Smtp::connected() 123 | { 124 | //qDebug() << "Connected "; 125 | } 126 | 127 | void Smtp::readyRead() 128 | { 129 | //qDebug() <<"readyRead"; 130 | // SMTP is line-oriented 131 | 132 | QString responseLine; 133 | do 134 | { 135 | responseLine = socket->readLine(); 136 | response += responseLine; 137 | } 138 | while ( socket->canReadLine() && responseLine[3] != ' ' ); 139 | 140 | responseLine.truncate( 3 ); 141 | 142 | //qDebug() << "Server response code:" << responseLine; 143 | //qDebug() << "Server response: " << response; 144 | 145 | if ( state == Init && responseLine == "220" ) 146 | { 147 | // banner was okay, let's go on 148 | *t << "EHLO localhost" <<"\r\n"; 149 | t->flush(); 150 | 151 | state = HandShake; 152 | } 153 | //No need, because I'm using socket->startClienEncryption() which makes the SSL handshake for you 154 | /*else if (state == Tls && responseLine == "250") 155 | { 156 | // Trying AUTH 157 | //qDebug() << "STarting Tls"; 158 | *t << "STARTTLS" << "\r\n"; 159 | t->flush(); 160 | state = HandShake; 161 | }*/ 162 | else if (state == HandShake && responseLine == "250") 163 | { 164 | socket->startClientEncryption(); 165 | if(!socket->waitForEncrypted(timeout)) 166 | { 167 | //qDebug() << socket->errorString(); 168 | state = Close; 169 | } 170 | //Send EHLO once again but now encrypted 171 | 172 | *t << "EHLO localhost" << "\r\n"; 173 | t->flush(); 174 | state = Auth; 175 | } 176 | else if (state == Auth && responseLine == "250") 177 | { 178 | // Trying AUTH 179 | //qDebug() << "Auth"; 180 | *t << "AUTH LOGIN" << "\r\n"; 181 | t->flush(); 182 | state = User; 183 | } 184 | else if (state == User && responseLine == "334") 185 | { 186 | //Trying User 187 | //qDebug() << "Username"; 188 | //GMAIL is using XOAUTH2 protocol, which basically means that password and username has to be sent in base64 coding 189 | //https://developers.google.com/gmail/xoauth2_protocol 190 | *t << QByteArray().append(user).toBase64() << "\r\n"; 191 | t->flush(); 192 | 193 | state = Pass; 194 | } 195 | else if (state == Pass && responseLine == "334") 196 | { 197 | //Trying pass 198 | //qDebug() << "Pass"; 199 | *t << QByteArray().append(pass).toBase64() << "\r\n"; 200 | t->flush(); 201 | 202 | state = Mail; 203 | } 204 | else if ( state == Mail && responseLine == "235" ) 205 | { 206 | // HELO response was okay (well, it has to be) 207 | 208 | //Apperantly for Google it is mandatory to have MAIL FROM and RCPT email formated the following way -> 209 | //qDebug() << "MAIL FROM:<" << from << ">"; 210 | *t << "MAIL FROM:<" << from << ">\r\n"; 211 | t->flush(); 212 | state = Rcpt; 213 | } 214 | else if ( state == Rcpt && responseLine == "250" ) 215 | { 216 | //Apperantly for Google it is mandatory to have MAIL FROM and RCPT email formated the following way -> 217 | *t << "RCPT TO:<" << rcpt << ">\r\n"; //r 218 | t->flush(); 219 | state = Data; 220 | } 221 | else if ( state == Data && responseLine == "250" ) 222 | { 223 | 224 | *t << "DATA\r\n"; 225 | t->flush(); 226 | state = Body; 227 | } 228 | else if ( state == Body && responseLine == "354" ) 229 | { 230 | 231 | *t << message << "\r\n.\r\n"; 232 | t->flush(); 233 | state = Quit; 234 | } 235 | else if ( state == Quit && responseLine == "250" ) 236 | { 237 | 238 | *t << "QUIT\r\n"; 239 | t->flush(); 240 | // here, we just close. 241 | state = Close; 242 | emit status( tr( "Message sent" ) ); 243 | } 244 | else if ( state == Close ) 245 | { 246 | deleteLater(); 247 | return; 248 | } 249 | else 250 | { 251 | // something broke. 252 | QMessageBox::warning( 0, tr( "Qt Simple SMTP client" ), tr( "Unexpected reply from SMTP server:\n\n" ) + response ); 253 | state = Close; 254 | emit status( tr( "Failed to send message" ) ); 255 | } 256 | response = ""; 257 | } 258 | -------------------------------------------------------------------------------- /smtp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Raivis Strogonovs 3 | 4 | http://morf.lv 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*/ 11 | 12 | #ifndef SMTP_H 13 | #define SMTP_H 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class Smtp : public QObject 26 | { 27 | Q_OBJECT 28 | 29 | public: 30 | Smtp( const QString &user, const QString &pass, 31 | const QString &host, int port = 465, int timeout = 30000 ); 32 | ~Smtp(); 33 | 34 | void sendMail( const QString &from, const QString &to, 35 | const QString &subject, const QString &body, 36 | QStringList files = QStringList()); 37 | 38 | signals: 39 | void status( const QString &); 40 | 41 | private slots: 42 | void stateChanged(QAbstractSocket::SocketState socketState); 43 | void errorReceived(QAbstractSocket::SocketError socketError); 44 | void disconnected(); 45 | void connected(); 46 | void readyRead(); 47 | 48 | private: 49 | int timeout; 50 | QString message; 51 | QTextStream *t; 52 | QSslSocket *socket; 53 | QString from; 54 | QString rcpt; 55 | QString response; 56 | QString user; 57 | QString pass; 58 | QString host; 59 | int port; 60 | enum states{Tls, HandShake ,Auth,User,Pass,Rcpt,Mail,Data,Init,Body,Quit,Close}; 61 | int state; 62 | }; 63 | #endif 64 | -------------------------------------------------------------------------------- /sound/RapidCopy_SE_01.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_01.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_02.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_02.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_03.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_03.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_04.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_04.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_05.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_05.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_06.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_06.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_07.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_07.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_08.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_08.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_09.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_09.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_10.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_10.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_11.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_11.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_12.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_12.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_13.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_13.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_14.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_14.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_15.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_15.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_16.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_16.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_17.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_17.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_18.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_18.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_19.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_19.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_20.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_20.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_21.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_21.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_22.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_22.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_23.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_23.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_24.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_24.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_25.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_25.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_26.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_26.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_27.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_27.wav -------------------------------------------------------------------------------- /sound/RapidCopy_SE_28.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/sound/RapidCopy_SE_28.wav -------------------------------------------------------------------------------- /static_bin/CentOS72/RapidCopy.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/static_bin/CentOS72/RapidCopy.gz -------------------------------------------------------------------------------- /static_bin/ubuntu1604/RapidCopy.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/static_bin/ubuntu1604/RapidCopy.gz -------------------------------------------------------------------------------- /static_bin/ubuntu1804/RapidCopy.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KengoSawa2/RapidCopy/0add582397f6a537d2983d26e47684a766326872/static_bin/ubuntu1804/RapidCopy.gz -------------------------------------------------------------------------------- /tapi32ex.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2012 H.Shirouzu tapi32ex.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2012-04-02(Mon) 7 | port update : 2016-02-28 8 | Copyright : H.Shirouzu,Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef TAPI32EX_H 13 | #define TAPI32EX_H 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #define SHA2_256SIZE 32 20 | #define SHA2_512SIZE 64 21 | #define SHA3_256SIZE 32 22 | #define SHA3_512SIZE 64 23 | #define SHA1_SIZE 20 24 | #define MD5_SIZE 16 25 | #define XX_SIZE_32 4 26 | #define XX_SIZE_64 8 27 | 28 | u_int MakeHash(const void *data, int size, DWORD iv=0); 29 | 30 | class TDigest { 31 | protected: 32 | QCryptographicHash *hHash; //for MD5 and SHA1 33 | XXH64_state_t *xxHash; //for xxHash 34 | _int64 updateSize; 35 | 36 | public: 37 | enum Type { SHA1, MD5 ,XX,SHA2_256,SHA2_512,SHA3_256,SHA3_512 } type; 38 | 39 | TDigest(); 40 | ~TDigest(); 41 | BOOL Init(Type _type=SHA1); 42 | BOOL Reset(); 43 | BOOL Update(void *data, int size); 44 | BOOL GetVal(void *data); 45 | int GetDigestSize() { return type == MD5 ? MD5_SIZE : 46 | type == SHA1 ? SHA1_SIZE : 47 | type == XX ? XX_SIZE_64 : 48 | type == SHA2_256 ? SHA2_256SIZE : 49 | type == SHA2_512 ? SHA2_512SIZE : 50 | type == SHA3_256 ? SHA3_256SIZE : 51 | type == SHA3_512 ? SHA3_512SIZE : 52 | XX_SIZE_64;} 53 | void GetEmptyVal(void *data); 54 | }; 55 | 56 | BOOL TGenRandom(void *buf, int len); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /tapi32v.cpp: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tapi32v.cpp Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2010-05-09(Sun) 7 | ported update : 2016-03-01 8 | Copyright : H.Shirouzu,Kengo Sawatsu 9 | Summary : Win32APIのANSI/UNICODE振り分け初期化。 10 | Mac/Linux版では意味なし関数なので、その内整理、削除予定 11 | Reference : 12 | ======================================================================== */ 13 | 14 | #include "tlib.h" 15 | #include 16 | #include "osl.h" 17 | 18 | int ( *lstrcmpiV)(const void *str1, const void *str2); 19 | int (*lstrlenV)(const void *str); 20 | 21 | WCHAR (*lGetCharV)(const void *, int); 22 | void (*lSetCharV)(void *, int, WCHAR ch); 23 | WCHAR (*lGetCharIncV)(const void **); 24 | int (*strcmpV)(const void *str1, const void *str2); // static ... for qsort 25 | int (*strnicmpV)(const void *str1, const void *str2, int len); 26 | int (*strlenV)(const void *path); 27 | void *(*strcpyV)(void *dst, const void *src); 28 | void *(*strdupV)(const void *src); 29 | void *(*strchrV)(const void *src, int); 30 | void *(*strrchrV)(const void *src, int); 31 | long (*strtolV)(const void *, const void **, int base); 32 | u_long (*strtoulV)(const void *, const void **, int base); 33 | int (*sprintfV)(void *buf, const void *format,...); 34 | int (*MakePathV)(void *dest, const void *dir, const void *file); 35 | 36 | char *ASTERISK_V; // "*" 37 | char *FMT_CAT_ASTER_V; // "%s\\*" 38 | char *FMT_STR_V; // "%s" 39 | char *FMT_STRSTR_V; // "%s%s" 40 | char *FMT_QUOTE_STR_V; // "\"%s\"" 41 | const char *FMT_INT_STR_V; // "%d" 42 | char *BACK_SLASH_V; // "\\" 43 | char *SEMICOLON_V; // ";" 44 | char *UNICODE_PARAGRAPH; // u2029 45 | char *SEMICLN_SPC_V; // "; " 46 | char *NEWLINE_STR_V; // "\n" 47 | char *EMPTY_STR_V; // "" 48 | char *DOT_V; // "." 49 | char *DOTDOT_V; // ".." 50 | char *QUOTE_V; // "\"" 51 | char *TRUE_V; // "true" 52 | char *FALSE_V; // "false" 53 | int CHAR_LEN_V; // 1(char) 54 | int MAX_PATHLEN_V; // MAX_PATH 55 | 56 | void *GetLoadStrV(UINT resId) 57 | { 58 | return GetLoadStrA(resId); 59 | } 60 | 61 | //Windows版ではコールするWin32APIを振り分けるために最初に初期化関数として使うけど、 62 | //Mac/Linuxb版では意味なし関数。。その内削除したい。。 63 | BOOL TLibInit_Win32V() 64 | { 65 | lstrcmpiV = (int (*)(const void *, const void *))::strcasecmp; 66 | lstrlenV = (int (*)(const void *))::strlen; 67 | 68 | strcmpV = (int (*)(const void *, const void *))::strcmp; 69 | strnicmpV = (int (*)(const void *, const void *, int))::strncmp; 70 | strlenV = (int (*)(const void *))::strlen; 71 | strcpyV = (void *(*)(void *, const void *))::strcpy; 72 | strdupV = (void *(*)(const void *))::strdup; 73 | strchrV = (void *(*)(const void *, int))(const char *(*)(const char *, int))::strchr; 74 | strrchrV = (void *(*)(const void *, int))(const char *(*)(const char *, int))::strrchr; 75 | strtolV = (long (*)(const void *, const void **, int base))::strtol; 76 | strtoulV = (u_long (*)(const void *, const void **, int base))::strtoul; 77 | sprintfV = (int (*)(void *, const void *,...))(int (*)(char *, const char *,...))::sprintf; 78 | MakePathV = (int (*)(void *, const void *, const void *))::MakePath; 79 | 80 | CHAR_LEN_V = sizeof(char); 81 | MAX_PATHLEN_V = MAX_PATH; 82 | 83 | ASTERISK_V = "*"; 84 | FMT_CAT_ASTER_V = "%s/"; 85 | FMT_STR_V = "%s"; 86 | FMT_STRSTR_V = "%s%s"; 87 | FMT_QUOTE_STR_V = "\"%s\""; 88 | BACK_SLASH_V = "/"; 89 | SEMICOLON_V = ";"; 90 | UNICODE_PARAGRAPH = "\u2029"; 91 | SEMICLN_SPC_V = "; "; 92 | NEWLINE_STR_V = "\n"; 93 | EMPTY_STR_V = ""; 94 | DOT_V = "."; 95 | DOTDOT_V = ".."; 96 | QUOTE_V = "\""; 97 | TRUE_V = "true"; 98 | FALSE_V = "false"; 99 | return TRUE; 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /tapi32v.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2010 H.Shirouzu tapi32v.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 2005-04-10(Sun) 6 | Update : 2010-05-09(Sun) 7 | port update : 2016-02-28 8 | Copyright : H.Shirouzu,Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef TAPI32V_H 13 | #define TAPI32V_H 14 | 15 | #include "osl.h" 16 | 17 | //Windowsのwide対応用のV関数、本当は不要なんだけど。。その内ネイティブに置き換えよう。。 18 | extern int (*lstrcmpiV)(const void *str1, const void *str2); 19 | extern int (*lstrlenV)(const void *str); 20 | extern int (*strcmpV)(const void *str1, const void *str2); 21 | extern int (*strnicmpV)(const void *str1, const void *str2, int len); 22 | extern int (*strlenV)(const void *path); 23 | extern void *(*strcpyV)(void *dst, const void *src); 24 | extern void *(*strdupV)(const void *src); 25 | extern void *(*strchrV)(const void *src, int); 26 | extern void *(*strrchrV)(const void *src, int); 27 | extern long (*strtolV)(const void *, const void **, int base); 28 | extern u_long (*strtoulV)(const void *, const void **, int base); 29 | extern int (*sprintfV)(void *buf, const void *format,...); 30 | extern int (*MakePathV)(void *dest, const void *dir, const void *file); 31 | 32 | extern char *ASTERISK_V; // "*" 33 | extern char *FMT_CAT_ASTER_V; // "%s\\*" 34 | extern char *FMT_STR_V; // "%s" 35 | extern char *FMT_STRSTR_V; // "%s%s" 36 | extern char *FMT_QUOTE_STR_V; // "\"%s\"" 37 | extern const char *FMT_INT_STR_V; // "%d" 38 | extern char *BACK_SLASH_V; // "\\" 39 | extern char *SEMICOLON_V; // ";" 40 | extern char *UNICODE_PARAGRAPH; // u2029 41 | extern char *SEMICLN_SPC_V; // "; " 42 | extern char *NEWLINE_STR_V; // "\n" 43 | extern char *EMPTY_STR_V; // "" 44 | extern char *DOT_V; // "." 45 | extern char *DOTDOT_V; // ".." 46 | extern char *QUOTE_V; // "\"" 47 | extern char *TRUE_V; // "true" 48 | extern char *FALSE_V; // "false" 49 | extern int CHAR_LEN_V; // 2(WCHAR) or 1(char) 50 | extern int MAX_PATHLEN_V; 51 | 52 | inline void *MakeAddr(const void *addr, int len) { return (BYTE *)addr + len * CHAR_LEN_V; } 53 | 54 | inline void SetChar(void *addr, int offset, int val) { 55 | (*(char *)MakeAddr(addr, offset) = val); 56 | } 57 | inline char GetChar(const void *addr, int offset) { 58 | return *(char *)MakeAddr(addr, offset); 59 | } 60 | inline int DiffLen(const void *high, const void *low) { 61 | return (int)((char *)high - (char *)low); 62 | } 63 | 64 | void *GetLoadStrV(UINT resId); 65 | 66 | BOOL TLibInit_Win32V(); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /tlib.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2012 H.Shirouzu tlib.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 1996-06-01(Sat) 6 | Update : 2012-04-02(Mon) 7 | port update : 2016-02-28 8 | Copyright : H.Shirouzu, Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef TLIB_H 13 | #define TLIB_H 14 | 15 | #include 16 | #include 17 | #include 18 | #include "tmisc.h" 19 | #include "tapi32ex.h" 20 | #include "tapi32v.h" 21 | #include "osl.h" 22 | 23 | #define ALIGN_SIZE(all_size, block_size) (((all_size) + (block_size) -1) \ 24 | / (block_size) * (block_size)) 25 | //ファイル名最大長はに従う。 26 | #define MAX_FNAME_LEN NAME_MAX 27 | 28 | struct TListObj { 29 | TListObj *prior, *next; 30 | }; 31 | 32 | class TList { 33 | protected: 34 | TListObj top; 35 | int num; 36 | 37 | public: 38 | TList(void); 39 | void Init(void); 40 | void AddObj(TListObj *obj); 41 | void DelObj(TListObj *obj); 42 | TListObj *TopObj(void); 43 | TListObj *EndObj(void); 44 | TListObj *NextObj(TListObj *obj); 45 | TListObj *PriorObj(TListObj *obj); 46 | bool IsEmpty() { return top.next == ⊤ } 47 | void MoveList(TList *from_list); 48 | int Num() { return num; } 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /tlist.cpp: -------------------------------------------------------------------------------- 1 | static char *tlist_id = 2 | "@(#)Copyright (C) 1996-2009 H.Shirouzu tlist.cpp Ver0.97"; 3 | /* ======================================================================== 4 | Project Name : Win32 Lightweight Class Library Test 5 | Module Name : List Class 6 | Create : 1996-06-01(Sat) 7 | Update : 2011-05-23(Mon) 8 | port update : 2016-03-02 9 | Copyright : H.Shirouzu 10 | Reference : 11 | ======================================================================== */ 12 | 13 | #include "tlib.h" 14 | 15 | /* 16 | TList class 17 | */ 18 | TList::TList(void) 19 | { 20 | Init(); 21 | } 22 | 23 | void TList::Init(void) 24 | { 25 | top.prior = top.next = ⊤ 26 | num = 0; 27 | } 28 | 29 | void TList::AddObj(TListObj * obj) 30 | { 31 | obj->prior = top.prior; 32 | obj->next = ⊤ 33 | top.prior->next = obj; 34 | top.prior = obj; 35 | num++; 36 | } 37 | 38 | void TList::DelObj(TListObj * obj) 39 | { 40 | // if (!obj->next || !obj->prior || obj->next != &top && obj->prior != &top) { 41 | // Debug("DelObj(%p) (%p/%p)\n", obj, obj->next, obj->prior); 42 | // } 43 | if (obj->next) { 44 | obj->next->prior = obj->prior; 45 | } 46 | if (obj->prior) { 47 | obj->prior->next = obj->next; 48 | } 49 | obj->next = obj->prior = NULL; 50 | num--; 51 | } 52 | 53 | TListObj* TList::TopObj(void) 54 | { 55 | // if (top.next != &top && top.next->next != &top && top.next->prior != &top) { 56 | // Debug("TopObj(%p) \n", top.next); 57 | // } 58 | return top.next == &top ? NULL : top.next; 59 | } 60 | 61 | TListObj* TList::EndObj(void) 62 | { 63 | return top.next == &top ? NULL : top.prior; 64 | } 65 | 66 | TListObj* TList::NextObj(TListObj *obj) 67 | { 68 | return obj->next == &top ? NULL : obj->next; 69 | } 70 | 71 | TListObj* TList::PriorObj(TListObj *obj) 72 | { 73 | return obj->prior == &top ? NULL : obj->prior; 74 | } 75 | 76 | void TList::MoveList(TList *from_list) 77 | { 78 | if (from_list->top.next != &from_list->top) { // from_list is not empty 79 | if (top.next == &top) { // empty 80 | top = from_list->top; 81 | top.next->prior = top.prior->next = ⊤ 82 | } 83 | else { 84 | top.prior->next = from_list->top.next; 85 | from_list->top.next->prior = top.prior; 86 | from_list->top.prior->next = ⊤ 87 | top.prior = from_list->top.prior; 88 | } 89 | num += from_list->num; 90 | from_list->Init(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /tmisc.h: -------------------------------------------------------------------------------- 1 | /* @(#)Copyright (C) 1996-2011 H.Shirouzu tlib.h Ver0.99 */ 2 | /* ======================================================================== 3 | Project Name : Win32 Lightweight Class Library Test 4 | Module Name : Main Header 5 | Create : 1996-06-01(Sat) 6 | Update : 2011-05-23(Mon) 7 | port update : 2016-02-28 8 | Copyright : H.Shirouzu, Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef TLIBMISC_H 13 | #define TLIBMISC_H 14 | 15 | #include 16 | #include "osl.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | class THashTbl; 23 | 24 | class THashObj { 25 | public: 26 | THashObj *priorHash; 27 | THashObj *nextHash; 28 | u_int hashId; 29 | 30 | public: 31 | THashObj() { priorHash = nextHash = NULL; hashId = 0; } 32 | virtual ~THashObj() { if (priorHash && priorHash != this) UnlinkHash(); } 33 | 34 | virtual bool LinkHash(THashObj *top); 35 | virtual bool UnlinkHash(); 36 | friend class THashTbl; 37 | }; 38 | 39 | class THashTbl { 40 | protected: 41 | THashObj *hashTbl; 42 | int hashNum; 43 | int registerNum; 44 | bool isDeleteObj; 45 | 46 | virtual bool IsSameVal(THashObj *, const void *val) = 0; 47 | 48 | public: 49 | THashTbl(int _hashNum=0, bool _isDeleteObj=true); 50 | virtual ~THashTbl(); 51 | virtual bool Init(int _hashNum); 52 | virtual void UnInit(); 53 | virtual void Register(THashObj *obj, u_int hash_id); 54 | virtual void UnRegister(THashObj *obj); 55 | virtual THashObj *Search(const void *data, u_int hash_id); 56 | virtual int GetRegisterNum() { return registerNum; } 57 | // virtual u_int MakeHashId(const void *data) = 0; 58 | }; 59 | 60 | struct TResHashObj : THashObj { 61 | void *val; 62 | TResHashObj(UINT _resId, void *_val) { hashId = _resId; val = _val; } 63 | ~TResHashObj() { free(val); } 64 | 65 | }; 66 | 67 | class TResHash : public THashTbl { 68 | protected: 69 | virtual bool IsSameVal(THashObj *obj, const void *val) { 70 | return obj->hashId == *(u_int *)val; 71 | } 72 | 73 | public: 74 | TResHash(int _hashNum) : THashTbl(_hashNum) {} 75 | TResHashObj *Search(UINT resId) { return (TResHashObj *)THashTbl::Search(&resId, resId); } 76 | void Register(TResHashObj *obj) { THashTbl::Register(obj, obj->hashId); } 77 | }; 78 | 79 | class Condition { 80 | protected: 81 | enum WaitEvent { CLEAR_EVENT=0, DONE_EVENT, WAIT_EVENT }; 82 | QMutex cs; 83 | QMutex *hEvents; 84 | WaitEvent *waitEvents; 85 | int max_threads; 86 | int waitCnt; 87 | 88 | public: 89 | Condition(void); 90 | ~Condition(); 91 | 92 | bool Initialize(int _max_threads); 93 | void UnInitialize(void); 94 | 95 | void Lock(void) { cs.lock();} 96 | void UnLock(void) { cs.unlock();} 97 | 98 | // ロックを取得してから利用すること 99 | int WaitThreads() { return waitCnt; } 100 | int IsWait() { return waitCnt ? true : FALSE; } 101 | void DetachThread() { max_threads--; } 102 | int MaxThreads() { return max_threads; } 103 | 104 | bool Wait(DWORD); 105 | void Notify(void); 106 | }; 107 | 108 | #define PAGE_SIZE (4 * 1024) 109 | 110 | class VBuf { 111 | protected: 112 | BYTE *buf; 113 | VBuf *borrowBuf; 114 | int size; 115 | int usedSize; 116 | int maxSize; 117 | void Init(); 118 | 119 | public: 120 | VBuf(int _size=0, int _max_size=0, VBuf *_borrowBuf=NULL); 121 | ~VBuf(); 122 | bool AllocBuf(int _size, int _max_size=0, VBuf *_borrowBuf=NULL); 123 | bool LockBuf(); 124 | void FreeBuf(); 125 | bool Grow(int grow_size); 126 | operator BYTE *() { return buf; } 127 | BYTE *Buf() { return buf; } 128 | WCHAR *WBuf() { return (WCHAR *)buf; } 129 | int Size() { return size; } 130 | int MaxSize() { return maxSize; } 131 | int UsedSize() { return usedSize; } 132 | void SetUsedSize(int _used_size) { usedSize = _used_size; } 133 | int AddUsedSize(int _used_size) { return usedSize += _used_size; } 134 | int RemainSize(void) { return size - usedSize; } 135 | }; 136 | 137 | char* GetLoadStrA(UINT resId); 138 | 139 | // WindowsのLoadString()の代替固定文字列構造体 140 | // LoadStringをだますために使う 141 | struct StringTable { 142 | UINT resId; 143 | QString str; 144 | }; 145 | 146 | int MakePath(char *dest, const char *dir, const char *file); 147 | WCHAR lGetCharIncA(const char **str); 148 | int bin2hexstr(const BYTE *bindata, int len, char *buf); 149 | 150 | #endif 151 | 152 | -------------------------------------------------------------------------------- /utility.cpp: -------------------------------------------------------------------------------- 1 | static char *utility_id = 2 | "@(#)Copyright (C) 2004-2012 H.Shirouzu utility.cpp ver2.10"; 3 | /* ======================================================================== 4 | Project Name : general routine 5 | Create : 2004-09-15(Wed) 6 | Update : 2012-06-17(Sun) 7 | ported update : 2016-02-28 8 | Copyright : H.Shirouzu,Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #include "utility.h" 13 | #include 14 | 15 | /*========================================================================= 16 | PathArray 17 | =========================================================================*/ 18 | PathArray::PathArray(void) : THashTbl(1000) 19 | { 20 | num = 0; 21 | pathArray = NULL; 22 | flags = 0; 23 | } 24 | 25 | PathArray::PathArray(const PathArray &src) : THashTbl(1000) 26 | { 27 | num = 0; 28 | pathArray = NULL; 29 | *this = src; 30 | flags = 0; 31 | } 32 | 33 | PathArray::~PathArray() 34 | { 35 | Init(); 36 | } 37 | 38 | void PathArray::Init(void) 39 | { 40 | while(--num >= 0){ 41 | delete pathArray[num]; 42 | } 43 | free(pathArray); 44 | num = 0; 45 | pathArray = NULL; 46 | } 47 | 48 | BOOL PathArray::PathObj::Set(const void *_path, int _len) 49 | { 50 | path = NULL; 51 | len = 0; 52 | 53 | if(_path){ 54 | if (_len < 0) _len = strlenV(_path); 55 | len = _len; 56 | int alloc_len = len + 1; 57 | path = malloc(alloc_len * CHAR_LEN_V); 58 | memcpy(path, _path, alloc_len * CHAR_LEN_V); 59 | } 60 | return TRUE; 61 | } 62 | 63 | int PathArray::RegisterMultiPath(const void *_multi_path,void *separator) 64 | { 65 | //Windowsでは";"や\"自体をファイル名に設定できないので、strtok_pathVのような特殊関数が必要だったけど 66 | //HFSPlusでは";"や\"," "は普通にファイル名やフォルダ名として使用可能なので、こりゃもうだめぽ。 67 | //思い切ってQt使う仕様に変える 68 | int cnt = 0; 69 | QString multi_path =(char*)_multi_path; 70 | QString splitstr = (char*)separator; 71 | //1バイト文字、マルチバイト文字等の区切り文字に関係なくパス区切りする 72 | QStringList pathlist = multi_path.split(splitstr); 73 | for(int i=0; ipath, escape_val); 93 | int need_len = pathArray[i]->len + 1 + (is_escape ? 2 : 0) + (i ? sep_len : 0); 94 | 95 | if(max_len - total_len < need_len){ 96 | SetChar(multi_path, total_len, 0); 97 | return -1; 98 | } 99 | if(i){ 100 | memcpy(MakeAddr(buf, total_len), separator, sep_len * CHAR_LEN_V); 101 | total_len += sep_len; 102 | } 103 | if(is_escape){ 104 | SetChar(buf, total_len, '"'); 105 | total_len++; 106 | } 107 | memcpy(MakeAddr(buf, total_len), pathArray[i]->path, pathArray[i]->len * CHAR_LEN_V); 108 | total_len += pathArray[i]->len; 109 | if(is_escape){ 110 | SetChar(buf, total_len, '"'); 111 | total_len++; 112 | } 113 | } 114 | SetChar(multi_path, total_len, 0); 115 | return total_len; 116 | } 117 | 118 | int PathArray::GetMultiPathLen(const void *separator, const void *escape_char) 119 | { 120 | int total_len = 0; 121 | int sep_len = strlenV(separator); 122 | int escape_val = escape_char ? GetChar(escape_char, 0) : 0; 123 | 124 | for (int i=0; i < num; i++) { 125 | BOOL is_escape = escape_val && strchrV(pathArray[i]->path, escape_val); 126 | total_len += pathArray[i]->len + (is_escape ? 2 : 0) + (i ? sep_len : 0); 127 | } 128 | 129 | return total_len + 1; 130 | } 131 | 132 | BOOL PathArray::SetPath(int idx, const void *path, int len) 133 | { 134 | if(len < 0) len = strlenV(path); 135 | pathArray[idx] = new PathObj(path, len); 136 | Register(pathArray[idx], MakeHashId(pathArray[idx])); 137 | return TRUE; 138 | } 139 | 140 | BOOL PathArray::RegisterPath(const void *path) 141 | { 142 | if(!path || !GetChar(path, 0))return FALSE; 143 | 144 | int len = strlenV(path); 145 | 146 | if((flags & ALLOW_SAME) == 0 && Search(path, MakeHashId(path, len)))return FALSE; 147 | 148 | #define MAX_ALLOC 100 149 | if((num % MAX_ALLOC) == 0){ 150 | pathArray = (PathObj **)realloc(pathArray, (num + MAX_ALLOC) * sizeof(void *)); 151 | } 152 | SetPath(num++,path,len); 153 | return TRUE; 154 | } 155 | 156 | BOOL PathArray::ReplacePath(int idx, void *new_path) 157 | { 158 | if(idx >= num) 159 | return FALSE; 160 | 161 | if(pathArray[idx]){ 162 | free(pathArray[idx]); 163 | } 164 | SetPath(idx, new_path); 165 | return TRUE; 166 | } 167 | 168 | PathArray& PathArray::operator=(const PathArray& init) 169 | { 170 | Init(); 171 | 172 | pathArray = (PathObj **)malloc(((((num = init.num) / MAX_ALLOC) + 1) * MAX_ALLOC) 173 | * sizeof(void *)); 174 | 175 | for(int i=0; i < init.num; i++){ 176 | SetPath(i, init.pathArray[i]->path, init.pathArray[i]->len); 177 | } 178 | 179 | return *this; 180 | } 181 | 182 | DataList::DataList(int size, int max_size, int _grow_size, VBuf *_borrowBuf, int _min_margin) 183 | { 184 | num = 0; 185 | top = end = NULL; 186 | 187 | if (size) Init(size, max_size, _grow_size, _borrowBuf, _min_margin); 188 | } 189 | 190 | DataList::~DataList() 191 | { 192 | UnInit(); 193 | } 194 | 195 | BOOL DataList::Init(int size, int max_size, int _grow_size, VBuf *_borrowBuf, int _min_margin) 196 | { 197 | grow_size = _grow_size; 198 | min_margin = _min_margin; 199 | cv.Initialize(2); 200 | 201 | BOOL ret = buf.AllocBuf(size, max_size, _borrowBuf); 202 | Clear(); 203 | return ret; 204 | } 205 | 206 | void DataList::UnInit() 207 | { 208 | top = end = NULL; 209 | buf.FreeBuf(); 210 | cv.UnInitialize(); 211 | } 212 | 213 | void DataList::Clear() 214 | { 215 | top = end = NULL; 216 | buf.SetUsedSize(0); 217 | num = 0; 218 | } 219 | 220 | DataList::Head *DataList::Alloc(void *data, int data_size, int need_size) 221 | { 222 | Head *cur = NULL; 223 | int alloc_size = need_size + sizeof(Head); 224 | 225 | alloc_size = ALIGN_SIZE(alloc_size, 8); 226 | 227 | if (!top) { 228 | cur = top = end = (Head *)buf.Buf(); 229 | cur->next = cur->prior = NULL; 230 | } 231 | else { 232 | if (top >= end) { 233 | cur = (Head *)((BYTE *)top + top->alloc_size); 234 | if ((BYTE *)cur + alloc_size < buf.Buf() + buf.MaxSize()) { 235 | int need_grow = (int)(((BYTE *)cur + alloc_size) - (buf.Buf() + buf.Size())); 236 | if (need_grow > 0) { 237 | if (!buf.Grow(ALIGN_SIZE(need_grow, PAGE_SIZE))) { 238 | //MessageBox(0, "can't alloc mem", "", MB_OK); 239 | goto END; 240 | } 241 | } 242 | } 243 | else { 244 | if((BYTE *)end < buf.Buf() + alloc_size){ 245 | //MessageBox(0, "buf is too small", "", MB_OK); 246 | goto END; 247 | } 248 | cur = (Head *)buf.Buf(); 249 | } 250 | } 251 | else{ 252 | if((BYTE *)end < (BYTE *)top + top->alloc_size + alloc_size){ // for debug 253 | //MessageBox(0, "buf is too small2", "", MB_OK); 254 | goto END; 255 | } 256 | cur = (Head *)((BYTE *)top + top->alloc_size); 257 | } 258 | top->next = cur; 259 | cur->prior = top; 260 | cur->next = NULL; 261 | top = cur; 262 | } 263 | cur->alloc_size = alloc_size; 264 | cur->data_size = data_size; 265 | if(data){ 266 | memcpy(cur->data, data, data_size); 267 | } 268 | buf.AddUsedSize(alloc_size); 269 | num++; 270 | 271 | END: 272 | return cur; 273 | } 274 | 275 | DataList::Head *DataList::Get() 276 | { 277 | Head *cur = end; 278 | 279 | if (!cur) goto END; 280 | 281 | if (cur->next) { 282 | cur->next->prior = cur->prior; 283 | } 284 | else { 285 | top = cur->prior; 286 | } 287 | end = cur->next; 288 | 289 | num--; 290 | 291 | END: 292 | return cur; 293 | } 294 | 295 | DataList::Head *DataList::Fetch(Head *prior) 296 | { 297 | Head *cur = prior ? prior->next : end; 298 | 299 | return cur; 300 | } 301 | 302 | int DataList::RemainSize() 303 | { 304 | int ret = 0; 305 | 306 | if(top){ 307 | BYTE *top_end = (BYTE *)top + top->alloc_size; 308 | 309 | if(top >= end){ 310 | int size1 = (int)(buf.MaxSize() - (top_end - buf.Buf())); 311 | int size2 = (int)((BYTE *)end - buf.Buf()); 312 | ret = std::max(size1, size2); 313 | } 314 | else{ 315 | ret = (int)((BYTE *)end - top_end); 316 | } 317 | } 318 | else{ 319 | ret = buf.MaxSize(); 320 | } 321 | 322 | if(ret > 0)ret -= sizeof(Head); 323 | 324 | return ret; 325 | } 326 | 327 | 328 | -------------------------------------------------------------------------------- /utility.h: -------------------------------------------------------------------------------- 1 | /* static char *utility_id = 2 | "@(#)Copyright (C) 2004-2012 H.Shirouzu utility.h Ver2.10"; */ 3 | /* ======================================================================== 4 | Project Name : Utility 5 | Create : 2004-09-15(Wed) 6 | Update : 2012-06-17(Sun) 7 | port update : 2016-02-28 8 | Copyright : H.Shirouzu, Kengo Sawatsu 9 | Reference : 10 | ======================================================================== */ 11 | 12 | #ifndef UTILITY_H 13 | #define UTILITY_H 14 | 15 | #include "tlib.h" 16 | #include "osl.h" 17 | 18 | class PathArray : public THashTbl { 19 | protected: 20 | struct PathObj : THashObj { 21 | void *path; 22 | int len; 23 | PathObj(const void *_path, int len=-1) { Set(_path, len); } 24 | ~PathObj() { if (path) free(path); } 25 | BOOL Set(const void *_path, int len=-1); 26 | }; 27 | int num; 28 | PathObj **pathArray; 29 | DWORD flags; 30 | BOOL SetPath(int idx, const void *path, int len=-1); 31 | 32 | virtual BOOL IsSameVal(THashObj *obj, const void *val) { 33 | return lstrcmpiV(((PathObj *)obj)->path, val) == 0; 34 | } 35 | 36 | public: 37 | enum { ALLOW_SAME=1, NO_REMOVE_QUOTE=2 }; 38 | PathArray(void); 39 | PathArray(const PathArray &); 40 | ~PathArray(); 41 | void Init(void); 42 | void SetMode(DWORD _flags) { flags = _flags; } 43 | int RegisterMultiPath(const void *_multi_path, void *separator=UNICODE_PARAGRAPH); 44 | int GetMultiPath(void *multi_path, int max_len, const void *separator=UNICODE_PARAGRAPH, 45 | const void *escape_char=NULL); 46 | int GetMultiPathLen(const void *separator=UNICODE_PARAGRAPH, 47 | const void *escape_char=NULL); 48 | 49 | PathArray& operator=(const PathArray& init); 50 | 51 | void *Path(int idx) const { return idx < num ? pathArray[idx]->path : NULL; } 52 | int Num(void) const { return num; } 53 | BOOL RegisterPath(const void *path); 54 | BOOL ReplacePath(int idx, void *new_path); 55 | 56 | u_int MakeHashId(const void *data, int len=-1) { 57 | return MakeHash(data, (len >= 0 ? len : strlenV(data)) * CHAR_LEN_V); 58 | } 59 | u_int MakeHashId(const PathObj *obj) { return MakeHash(obj->path, obj->len * CHAR_LEN_V); } 60 | }; 61 | 62 | class DataList { 63 | public: 64 | struct Head { 65 | Head *prior; 66 | Head *next; 67 | int alloc_size; 68 | int data_size; 69 | BYTE data[1]; // opaque 70 | }; 71 | 72 | protected: 73 | VBuf buf; 74 | Head *top; 75 | Head *end; 76 | int num; 77 | int grow_size; 78 | int min_margin; 79 | Condition cv; 80 | 81 | public: 82 | DataList(int size=0, int max_size=0, int _grow_size=0, VBuf *_borrowBuf=NULL, int _min_margin=65536); 83 | ~DataList(); 84 | 85 | BOOL Init(int size, int max_size, int _grow_size, VBuf *_borrowBuf=NULL, int _min_margin=65536); 86 | void UnInit(); 87 | 88 | void Lock() { cv.Lock(); } 89 | void UnLock() { cv.UnLock(); } 90 | BOOL Wait(DWORD timeout=-1) { return cv.Wait(timeout); } 91 | BOOL IsWait() { return cv.WaitThreads() ? TRUE : FALSE; } 92 | void Notify() { cv.Notify(); } 93 | 94 | Head *Alloc(void *data, int copy_size, int need_size); 95 | Head *Get(); 96 | Head *Fetch(Head *prior=NULL); 97 | void Clear(); 98 | int Num() { return num; } 99 | int RemainSize(); 100 | int MaxSize() { return buf.MaxSize(); } 101 | int Size() { return buf.Size(); } 102 | int Grow(int grow_size) { return buf.Grow(grow_size); } 103 | int MinMargin() { return min_margin; } 104 | }; 105 | 106 | #endif 107 | 108 | -------------------------------------------------------------------------------- /version.cpp: -------------------------------------------------------------------------------- 1 | static char *version_id = 2 | "@(#)Copyright (C) 2004-2012 H.Shirouzu Version.cpp ver1.0.0"; 3 | static char *organize_str = 4 | "L'espace Vision"; 5 | 6 | static char *version_id_2 = 7 | "Copyright (C) 2016 Kengo Sawatsu"; 8 | 9 | /* ======================================================================== 10 | Project Name : Fast/Force copy file and directory 11 | Module Name : Version 12 | Create : 2010-06-13(Sun) 13 | Update : 2014-04-16(Wed) 14 | ported update : 2019-01-22 15 | Copyright : H.Shirouzu,Kengo Sawatsu 16 | Reference : 17 | ======================================================================== */ 18 | #include 19 | #include 20 | #include "version.h" 21 | 22 | static char version_str[32]; 23 | static char copyright_str[128]; 24 | static char admin_str[32]; 25 | 26 | void SetVersionStr(BOOL is_admin) 27 | { 28 | char *versionstr = "1.3.0"; 29 | sprintf(version_str,"v%s",versionstr); 30 | } 31 | 32 | const char *GetVersionStr() 33 | { 34 | if(version_str[0] == 0) 35 | SetVersionStr(); 36 | return version_str; 37 | } 38 | 39 | const char *GetVerAdminStr() 40 | { 41 | return admin_str; 42 | } 43 | 44 | const char *GetCopyrightStr(void) 45 | { 46 | if(copyright_str[0] == 0){ 47 | char *s = strchr(version_id, 'C'); 48 | char *e = strchr(version_id, '\t'); 49 | if(s && e && s < e){ 50 | sprintf(copyright_str, "%.*s", e-s, s); 51 | } 52 | } 53 | return copyright_str; 54 | } 55 | 56 | const char *GetVersionStr2(void){ 57 | return version_id_2; 58 | } 59 | 60 | const char *GetOrganizeStr(void) 61 | { 62 | return organize_str; 63 | } 64 | 65 | 66 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | /*static char *version_id = 2 | "@(#)Copyright (C) 20004-2012 H.Shirouzu version.cpp ver2.10"; */ 3 | /* ======================================================================== 4 | Project Name : Fast/Force copy file and directory 5 | Module Name : Version 6 | Create : 2010-06-13(Sun) 7 | Update : 2014-04-16(Wed) 8 | port update : 2016-02-28 9 | Copyright : H.Shirouzu, Kengo Sawatsu 10 | Reference : 11 | ======================================================================== */ 12 | #include "osl.h" 13 | 14 | #ifndef VERSION_H 15 | #define VERSION_H 16 | 17 | #define RAPIDCOPY_VER_DEFINE_NUM 3 //x.x.x 18 | #define RAPIDCOPY_VER_MAJOR 0 //?.x.x 19 | #define RAPIDCOPY_VER_MINOR 1 //x.?.x 20 | #define RAPIDCOPY_VER_PATCH 2 //x.x.? 21 | 22 | void SetVersionStr(BOOL is_admin=FALSE); 23 | const char *GetVersionStr(); 24 | const char *GetVerAdminStr(); 25 | const char *GetCopyrightStr(void); 26 | const char *GetOrganizeStr(); 27 | const char *GetVersionStr2(); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /xxhash.h: -------------------------------------------------------------------------------- 1 | /* 2 | xxHash - Extremely Fast Hash algorithm 3 | Header File 4 | Copyright (C) 2012-2014, Yann Collet. 5 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | You can contact the author at : 31 | - xxHash source repository : http://code.google.com/p/xxhash/ 32 | */ 33 | 34 | #pragma once 35 | 36 | #if defined (__cplusplus) 37 | extern "C" { 38 | #endif 39 | 40 | 41 | /***************************** 42 | Includes 43 | *****************************/ 44 | #include /* size_t */ 45 | 46 | 47 | /***************************** 48 | Type 49 | *****************************/ 50 | typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; 51 | 52 | 53 | 54 | /***************************** 55 | Simple Hash Functions 56 | *****************************/ 57 | 58 | unsigned int XXH32 (const void* input, size_t length, unsigned seed); 59 | unsigned long long XXH64 (const void* input, size_t length, unsigned long long seed); 60 | 61 | /* 62 | XXH32() : 63 | Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". 64 | The memory between input & input+length must be valid (allocated and read-accessible). 65 | "seed" can be used to alter the result predictably. 66 | This function successfully passes all SMHasher tests. 67 | Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s 68 | XXH64() : 69 | Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". 70 | */ 71 | 72 | 73 | 74 | /***************************** 75 | Advanced Hash Functions 76 | *****************************/ 77 | typedef struct { long long ll[ 6]; } XXH32_state_t; 78 | typedef struct { long long ll[11]; } XXH64_state_t; 79 | 80 | /* 81 | These structures allow static allocation of XXH states. 82 | States must then be initialized using XXHnn_reset() before first use. 83 | 84 | If you prefer dynamic allocation, please refer to functions below. 85 | */ 86 | 87 | XXH32_state_t* XXH32_createState(void); 88 | XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); 89 | 90 | XXH64_state_t* XXH64_createState(void); 91 | XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); 92 | 93 | /* 94 | These functions create and release memory for XXH state. 95 | States must then be initialized using XXHnn_reset() before first use. 96 | */ 97 | 98 | 99 | XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned seed); 100 | XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); 101 | unsigned int XXH32_digest (const XXH32_state_t* statePtr); 102 | 103 | XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); 104 | XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); 105 | unsigned long long XXH64_digest (const XXH64_state_t* statePtr); 106 | 107 | /* 108 | These functions calculate the xxHash of an input provided in multiple smaller packets, 109 | as opposed to an input provided as a single block. 110 | 111 | XXH state space must first be allocated, using either static or dynamic method provided above. 112 | 113 | Start a new hash by initializing state with a seed, using XXHnn_reset(). 114 | 115 | Then, feed the hash state by calling XXHnn_update() as many times as necessary. 116 | Obviously, input must be valid, meaning allocated and read accessible. 117 | The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. 118 | 119 | Finally, you can produce a hash anytime, by using XXHnn_digest(). 120 | This function returns the final nn-bits hash. 121 | You can nonetheless continue feeding the hash state with more input, 122 | and therefore get some new hashes, by calling again XXHnn_digest(). 123 | 124 | When you are done, don't forget to free XXH state space, using typically XXHnn_freeState(). 125 | */ 126 | 127 | 128 | #if defined (__cplusplus) 129 | } 130 | #endif 131 | --------------------------------------------------------------------------------