-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugs fixed. Menu option added. Licensing info added. Filenames and content format changed. COPYING and README added.
- Loading branch information
1 parent
58fd61d
commit 0ec07b5
Showing
54 changed files
with
7,597 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
====================== RamseyX Client ====================== | ||
|
||
README | ||
|
||
RamseyX Client is the client program of distributed computing | ||
project RamseyX. It is designed to help DC volunteers contribute | ||
their computing power to the project more easily. | ||
|
||
COPYING | ||
|
||
Copyright (C) 2013-2014 Zizheng Tai <zizheng.tai@gmail.com> | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
CONTACT | ||
|
||
If you have problems, questions, ideas or suggestions, please | ||
contact us by posting an email to a suitable email address | ||
listed in the "About RamseyX Client" part in the program. | ||
|
||
WEBSITE | ||
|
||
Visit our website for the latest news and downloads: | ||
|
||
<http://www.ramseyx.org/> | ||
|
||
GIT | ||
|
||
To download the very latest source off the GIT server do this: | ||
|
||
git clone https://github.com/ZizhengTai/RamseyX.git | ||
|
||
(you'll get a directory named RamseyX created, filled with the source code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2014-01-27T16:06:59 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui network #sql | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = ramseyx | ||
TEMPLATE = app | ||
|
||
SOURCES += main.cpp \ | ||
mainwindow.cpp \ | ||
dhry_2.c \ | ||
dhry_1.c \ | ||
accountdialog.cpp \ | ||
signupdialog.cpp \ | ||
graph.cpp \ | ||
ramseyxcontroller.cpp \ | ||
ramseyxcurlwrapper.cpp \ | ||
ramseyxtask.cpp | ||
HEADERS += mainwindow.h \ | ||
dhry.h \ | ||
accountdialog.h \ | ||
signupdialog.h \ | ||
checkforupdateworker.h \ | ||
whatsupworker.h \ | ||
refresh20worker.h \ | ||
refreshoverallworker.h \ | ||
validateaccountworker.h \ | ||
signupworker.h \ | ||
bitsetiterator.h \ | ||
graph.h \ | ||
ramseyxcontroller.h \ | ||
ramseyxcurlwrapper.h \ | ||
ramseyxutils.h \ | ||
ramseyxtask.h \ | ||
ramseyxdefs.h | ||
FORMS += mainwindow.ui \ | ||
accountdialog.ui \ | ||
signupdialog.ui | ||
RESOURCES += resource.qrc | ||
OTHER_FILES += ramseyx.rc \ | ||
COPYING \ | ||
README | ||
|
||
VERSION = 5.0.3 | ||
QMAKE_TARGET_PRODUCT = RamseyX Client | ||
QMAKE_TARGET_DESCRIPTION = RamseyX Client | ||
DEFINES += RX_QT APP_VERSION=\\\"$$VERSION\\\" | ||
|
||
CONFIG(debug, debug|release) { | ||
CURL_DIR = "C:/Dev/Libraries/curl-7.35.0_msvc2013_x86/builds/libcurl-vc12-x86-debug-dll-ipv6-sspi-spnego-winssl" | ||
BOOST_DIR = "C:/Dev/Libraries/boost_1_55_0" | ||
} | ||
CONFIG(release, debug|release) { | ||
CURL_DIR = "C:/Dev/Libraries/curl-7.35.0_msvc2013_x86/builds/libcurl-vc12-x86-release-dll-ipv6-sspi-spnego-winssl" | ||
BOOST_DIR = "C:/Dev/Libraries/boost_1_55_0" | ||
} | ||
|
||
win32 { | ||
DEFINES += NOMINMAX | ||
RC_FILE += ramseyx.rc | ||
} | ||
|
||
msvc { | ||
DEFINES += _CRT_SECURE_NO_WARNINGS | ||
|
||
INCLUDEPATH += "%ProgramFiles(x86)%/Microsoft SDKs/Windows/v7.1A/Include" | ||
LIBS += -L"%ProgramFiles(x86)%/Microsoft SDKs/Windows/v7.1A/Lib" -lshell32 | ||
|
||
CONFIG(debug, debug|release) { | ||
INCLUDEPATH += "$$CURL_DIR/include" | ||
LIBS += -L"$$CURL_DIR/lib" -llibcurl_debug | ||
} | ||
CONFIG(release, debug|release) { | ||
INCLUDEPATH += "$$CURL_DIR/include" | ||
LIBS += -L"$$CURL_DIR/lib" -llibcurl | ||
} | ||
|
||
QMAKE_CXXFLAGS += /EHsc /W4 /WX | ||
QMAKE_CXXFLAGS_RELEASE += /O2 /GL | ||
|
||
QMAKE_LFLAGS = /WX | ||
QMAKE_LFLAGS_RELEASE += /LTCG | ||
} | ||
|
||
gcc { | ||
INCLUDEPATH += "$$CURL_DIR/include" \ | ||
"$$BOOST_DIR" \ | ||
"/usr/local/include" | ||
LIBS += -L"$$CURL_DIR/lib" -L"/usr/local/lib" -lcurl | ||
|
||
CONFIG(debug, debug|release) { | ||
LIBS += -L"$$BOOST_DIR/stage/lib" -lboost_atomic-mt-d | ||
} | ||
CONFIG(release, debug|release) { | ||
LIBS += -L"$$BOOST_DIR/stage/lib" -lboost_atomic-mt | ||
} | ||
|
||
QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -pedantic | ||
win32: QMAKE_CXXFLAGS_DEBUG += -static -ggdb # For memory check | ||
QMAKE_CXXFLAGS_RELEASE -= -O -O1 -O2 | ||
QMAKE_CXXFLAGS_RELEASE += -O3 -flto | ||
|
||
win32: QMAKE_LFLAGS_DEBUG += -static -ggdb # For memory check | ||
QMAKE_LFLAGS_RELEASE += -flto | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
/*************************************************************************** | ||
* | ||
* RamseyX Client: client program of distributed computing project RamseyX | ||
* | ||
* Copyright (C) 2013-2014 Zizheng Tai <zizheng.tai@gmail.com> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
***************************************************************************/ | ||
#include "accountdialog.h" | ||
#include "ui_accountdialog.h" | ||
#include "signupdialog.h" | ||
#include <QMessageBox> | ||
#include <QKeyEvent> | ||
#include <QRegExp> | ||
#include <QToolTip> | ||
|
||
AccountDialog::AccountDialog( | ||
QWidget *parent, | ||
bool isAccountLocked, | ||
const QString &username, | ||
const QString &password) : | ||
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), | ||
ui(new Ui::AccountDialog), | ||
isLocked(isAccountLocked), | ||
validateAccountThread(new QThread(this)), | ||
validateAccountWorker(new ValidateAccountWorker) | ||
{ | ||
ui->setupUi(this); | ||
|
||
setFixedSize(size()); | ||
|
||
connect(ui->logInButton, SIGNAL(clicked()), this, SLOT(onLogInButtonClicked())); | ||
connect(ui->signUpButton, SIGNAL(clicked()), this, SLOT(onSignUpButtonClicked())); | ||
|
||
validateAccountWorker->moveToThread(validateAccountThread); | ||
connect(this, SIGNAL(validateAccount(QString, QString)), validateAccountWorker, SLOT(doWork(QString, QString))); | ||
connect(validateAccountWorker, SIGNAL(send(int)), this, SLOT(onValidateAccountThreadFinished(int))); | ||
connect(validateAccountThread, SIGNAL(finished()), validateAccountWorker, SLOT(deleteLater())); | ||
validateAccountThread->start(); | ||
|
||
if (isLocked) | ||
{ | ||
ui->usernameEdit->setText(username); | ||
ui->passwordEdit->setText(password); | ||
ui->usernameEdit->setDisabled(true); | ||
ui->passwordEdit->setDisabled(true); | ||
ui->logInButton->setText(tr("&Log Out")); | ||
} | ||
} | ||
|
||
AccountDialog::~AccountDialog() | ||
{ | ||
validateAccountThread->quit(); | ||
validateAccountThread->wait(); | ||
|
||
delete ui; | ||
} | ||
|
||
void AccountDialog::keyPressEvent(QKeyEvent *event) | ||
{ | ||
if (event->key() != Qt::Key_Escape) | ||
QDialog::keyPressEvent(event); | ||
} | ||
|
||
void AccountDialog::onLogInButtonClicked() | ||
{ | ||
if (isLocked) | ||
{ | ||
// Warn user | ||
if (!theController().allListsEmpty() && QMessageBox::Cancel == | ||
QMessageBox::warning( | ||
this, | ||
tr("RamseyX Client"), | ||
tr("WARNING: You have task(s) to be completed or uploaded.") + "\t\t\n" + | ||
tr("Switching to another account will invalidate current task(s).") + "\t\t\n", | ||
QMessageBox::Ok, QMessageBox::Cancel)) | ||
return; | ||
|
||
// Change UI status | ||
ui->usernameEdit->setEnabled(true); | ||
ui->passwordEdit->setEnabled(true); | ||
ui->logInButton->setText(tr("&Log In")); | ||
|
||
// Notify MainWindow | ||
emit lock(isLocked = false, QString(), QString()); | ||
} | ||
else | ||
{ | ||
QString username(ui->usernameEdit->text()); | ||
QString password(ui->passwordEdit->text()); | ||
|
||
// Validate account format | ||
if (!QRegExp("[a-zA-Z0-9_]{1,16}").exactMatch(username)) | ||
{ | ||
QToolTip::showText( | ||
ui->usernameEdit->mapToGlobal(QPoint()), | ||
tr("Username should only contain letters, numbers and underscores,") + | ||
"\n" + tr("and should have a length of 1-16 characters."), | ||
this); | ||
return; | ||
} | ||
if (!QRegExp("[a-zA-Z0-9_]{4,16}").exactMatch(password)) | ||
{ | ||
QToolTip::showText( | ||
ui->passwordEdit->mapToGlobal(QPoint()), | ||
tr("Password should only contain letters, numbers and underscores,") + | ||
"\n" + tr("and should have a length of 4-16 characters."), | ||
this); | ||
return; | ||
} | ||
|
||
// Change UI status | ||
ui->usernameEdit->setDisabled(true); | ||
ui->passwordEdit->setDisabled(true); | ||
ui->logInButton->setDisabled(true); | ||
ui->logInButton->setText(tr("Logging In...")); | ||
|
||
// Create thread | ||
emit validateAccount(username, password); | ||
} | ||
} | ||
|
||
void AccountDialog::onSignUpButtonClicked() | ||
{ | ||
SignUpDialog dlg(this); | ||
dlg.exec(); | ||
} | ||
|
||
void AccountDialog::onValidateAccountThreadFinished(int errorCode) | ||
{ | ||
switch (errorCode) | ||
{ | ||
case RX_ERR_SUCCESS: | ||
QMessageBox::information( | ||
this, | ||
tr("RamseyX Client"), | ||
tr("Login succeeded!") + "\t\t\n", | ||
QMessageBox::Ok); | ||
break; | ||
case RX_ERR_CONNECTION_FAILED: | ||
QMessageBox::critical( | ||
this, | ||
tr("RamseyX Client"), | ||
tr("Failed to connect to server.") + "\t\t\n" + | ||
tr("Please try again later.") + "\t\t\n", | ||
QMessageBox::Ok); | ||
ui->logInButton->setText(tr("&Log In")); | ||
ui->logInButton->setEnabled(true); | ||
ui->usernameEdit->setEnabled(true); | ||
ui->passwordEdit->setEnabled(true); | ||
return; | ||
case RX_ERR_WRONG_USR_PWD: | ||
QMessageBox::critical( | ||
this, | ||
tr("RamseyX Client"), | ||
tr("Username or password incorrect.") + "\t\t\n", | ||
QMessageBox::Ok); | ||
ui->logInButton->setText(tr("&Log In")); | ||
ui->logInButton->setEnabled(true); | ||
ui->usernameEdit->setEnabled(true); | ||
ui->passwordEdit->setEnabled(true); | ||
ui->usernameEdit->setFocus(); | ||
return; | ||
default: | ||
QMessageBox::critical( | ||
this, | ||
tr("RamseyX Client"), | ||
tr("Validation failed.") + "\t\t\n" + | ||
tr("Please try again later.") + "\t\t\n", | ||
QMessageBox::Ok); | ||
ui->logInButton->setText(tr("&Log In")); | ||
ui->logInButton->setEnabled(true); | ||
ui->usernameEdit->setEnabled(true); | ||
ui->passwordEdit->setEnabled(true); | ||
return; | ||
} | ||
|
||
// Notify MainWindow | ||
emit lock(isLocked = true, ui->usernameEdit->text(), ui->passwordEdit->text()); | ||
|
||
// Change UI status | ||
ui->logInButton->setText(tr("&Log Out")); | ||
ui->logInButton->setEnabled(true); | ||
} | ||
|
Oops, something went wrong.