jcestatusbar widget
This commit is contained in:
parent
7980382db7
commit
1032c32013
|
@ -58,7 +58,8 @@ HEADERS += \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarDialog.h \
|
src/jceData/Calendar/coursesSchedule/calendarDialog.h \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarPage.h \
|
src/jceData/Calendar/coursesSchedule/calendarPage.h \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarPageCourse.h \
|
src/jceData/Calendar/coursesSchedule/calendarPageCourse.h \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarSchedule.h
|
src/jceData/Calendar/coursesSchedule/calendarSchedule.h \
|
||||||
|
main/jceWidgets/jcestatusbar.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main/CalendarTab/CalendarManager.cpp \
|
main/CalendarTab/CalendarManager.cpp \
|
||||||
|
@ -84,4 +85,5 @@ SOURCES += \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarDialog.cpp \
|
src/jceData/Calendar/coursesSchedule/calendarDialog.cpp \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarPage.cpp \
|
src/jceData/Calendar/coursesSchedule/calendarPage.cpp \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp \
|
src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp \
|
||||||
src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp
|
src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp \
|
||||||
|
main/jceWidgets/jcestatusbar.cpp
|
||||||
|
|
|
@ -1,24 +1,17 @@
|
||||||
#include "loginhandler.h"
|
#include "loginhandler.h"
|
||||||
|
|
||||||
loginHandler::loginHandler(user *ptr, QStatusBar *statusBarPtr,QPushButton *loginButtonPtr,QProgressBar *progressbarPtr): logggedInFlag(false)
|
loginHandler::loginHandler(user *ptr, QPushButton *loginButtonPtr, jceStatusBar *progressbarPtr): logggedInFlag(false)
|
||||||
{
|
{
|
||||||
this->loginButtonPtr = loginButtonPtr;
|
this->loginButtonPtr = loginButtonPtr;
|
||||||
this->progressBar = progressbarPtr;
|
this->statusBar = progressbarPtr;
|
||||||
|
|
||||||
//statusBar
|
|
||||||
statusBar = statusBarPtr;
|
|
||||||
iconButtomStatusLabel = new QLabel(statusBarPtr);
|
|
||||||
iconButtomStatusLabel->setAlignment(Qt::AlignHCenter);
|
|
||||||
|
|
||||||
//display progressbar and then ball icon.
|
|
||||||
statusBar->addPermanentWidget(progressBar,0);
|
|
||||||
statusBar->addPermanentWidget(iconButtomStatusLabel,0);
|
|
||||||
|
|
||||||
setIconConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
|
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
|
||||||
|
|
||||||
//user settings
|
//user settings
|
||||||
userPtr = ptr;
|
userPtr = ptr;
|
||||||
this->jceLog = new jceLogin(userPtr,progressBar);
|
this->jceLog = new jceLogin(userPtr,statusBar);
|
||||||
QObject::connect(this->jceLog,SIGNAL(connectionReadyAfterDisconnection()),this,SLOT(readyAfterConnectionLost()));
|
QObject::connect(this->jceLog,SIGNAL(connectionReadyAfterDisconnection()),this,SLOT(readyAfterConnectionLost()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,14 +24,14 @@ bool loginHandler::login(QString username,QString password)
|
||||||
logout();
|
logout();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setIconConnectionStatus(jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS);
|
statusBar->setIconConnectionStatus(jceStatusBar::Connecting);
|
||||||
|
|
||||||
userPtr->setUsername(username);
|
userPtr->setUsername(username);
|
||||||
userPtr->setPassword(password);
|
userPtr->setPassword(password);
|
||||||
|
|
||||||
if (makeConnection() == true)
|
if (makeConnection() == true)
|
||||||
{
|
{
|
||||||
setIconConnectionStatus(jceLogin::jceStatus::JCE_YOU_ARE_IN);
|
statusBar->setIconConnectionStatus(jceStatusBar::LoggedIn);
|
||||||
loginButtonPtr->setText(QObject::tr("Logout"));
|
loginButtonPtr->setText(QObject::tr("Logout"));
|
||||||
return isLoggedInFlag();
|
return isLoggedInFlag();
|
||||||
}
|
}
|
||||||
|
@ -52,7 +45,7 @@ bool loginHandler::login(QString username,QString password)
|
||||||
void loginHandler::logout()
|
void loginHandler::logout()
|
||||||
{
|
{
|
||||||
loginButtonPtr->setText(QObject::tr("Login"));
|
loginButtonPtr->setText(QObject::tr("Login"));
|
||||||
setIconConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
|
statusBar->setIconConnectionStatus(jceStatusBar::Disconnected);
|
||||||
jceLog->closeAll();
|
jceLog->closeAll();
|
||||||
logggedInFlag = false;
|
logggedInFlag = false;
|
||||||
}
|
}
|
||||||
|
@ -154,32 +147,7 @@ int loginHandler::makeExamsScheduleRequest(int year, int semester)
|
||||||
else
|
else
|
||||||
return jceLogin::JCE_NOT_CONNECTED;
|
return jceLogin::JCE_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
void loginHandler::setIconConnectionStatus(jceLogin::jceStatus statusDescription)
|
|
||||||
{
|
|
||||||
QPixmap iconPix;
|
|
||||||
switch (statusDescription)
|
|
||||||
{
|
|
||||||
case jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS:
|
|
||||||
iconPix.load(":/icons/blueStatusIcon.png");
|
|
||||||
statusBar->showMessage(tr("Connecting..."));
|
|
||||||
break;
|
|
||||||
case jceLogin::jceStatus::JCE_YOU_ARE_IN:
|
|
||||||
iconPix.load(":/icons/greenStatusIcon.png");
|
|
||||||
statusBar->showMessage(tr("Connected"));
|
|
||||||
break;
|
|
||||||
case jceLogin::jceStatus::JCE_NOT_CONNECTED:
|
|
||||||
iconPix.load(":/icons/redStatusIcon.png");
|
|
||||||
statusBar->showMessage(tr("Disconnected"));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iconPix.load(":/icons/redStatusIcon.png");
|
|
||||||
statusBar->showMessage(tr("Ready."));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
iconButtomStatusLabel->setPixmap(iconPix);
|
|
||||||
|
|
||||||
this->statusBar->repaint();
|
|
||||||
}
|
|
||||||
void loginHandler::popMessage(QString message,bool addInfo)
|
void loginHandler::popMessage(QString message,bool addInfo)
|
||||||
{
|
{
|
||||||
if (addInfo)
|
if (addInfo)
|
||||||
|
|
|
@ -6,28 +6,25 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QStatusBar>
|
|
||||||
#include <QProgressBar>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "./src/jceSettings/jcelogin.h"
|
#include "./src/jceSettings/jcelogin.h"
|
||||||
#include "./src/appDatabase/savedata.h"
|
#include "./src/appDatabase/savedata.h"
|
||||||
|
#include "./main/jceWidgets/jcestatusbar.h"
|
||||||
|
|
||||||
|
|
||||||
class loginHandler : public QObject
|
class loginHandler : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
loginHandler(user *ptr, QStatusBar *statusBarPtr, QPushButton *loginButtonPtr, QProgressBar *progressbarPtr);
|
loginHandler(user *ptr, QPushButton *loginButtonPtr, jceStatusBar *progressbarPtr);
|
||||||
~loginHandler()
|
~loginHandler()
|
||||||
{
|
{
|
||||||
delete iconButtomStatusLabel;
|
|
||||||
delete jceLog;
|
delete jceLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool login(QString username,QString password);
|
bool login(QString username,QString password);
|
||||||
void logout();
|
void logout();
|
||||||
void setIconConnectionStatus(jceLogin::jceStatus statusDescription);
|
|
||||||
|
|
||||||
bool makeConnection();
|
bool makeConnection();
|
||||||
|
|
||||||
|
@ -50,10 +47,9 @@ private:
|
||||||
jceLogin * jceLog;
|
jceLogin * jceLog;
|
||||||
user * userPtr;
|
user * userPtr;
|
||||||
|
|
||||||
QStatusBar *statusBar;
|
jceStatusBar *statusBar;
|
||||||
QLabel *iconButtomStatusLabel;
|
|
||||||
QPushButton *loginButtonPtr;
|
QPushButton *loginButtonPtr;
|
||||||
QProgressBar *progressBar;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
118
main/jceWidgets/jcestatusbar.cpp
Normal file
118
main/jceWidgets/jcestatusbar.cpp
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
#include "jcestatusbar.h"
|
||||||
|
|
||||||
|
jceStatusBar::jceStatusBar(QWidget *parent) :
|
||||||
|
QStatusBar(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
this->setStyleSheet("QStatusBar::item { border: 0px solid black };");
|
||||||
|
this->setFixedHeight(STATUS_ICON_HEIGH+5);
|
||||||
|
this->showMessage(tr("Ready"));
|
||||||
|
|
||||||
|
|
||||||
|
//Icon
|
||||||
|
iconButtomStatusLabel = new QLabel(this);
|
||||||
|
iconButtomStatusLabel->setAlignment(Qt::AlignHCenter);
|
||||||
|
|
||||||
|
//ProgressBar
|
||||||
|
progressBar = new QProgressBar(this);
|
||||||
|
connect(progressBar,SIGNAL(valueChanged(int)),this,SLOT(setProgressValue(int)));
|
||||||
|
connect(this,SIGNAL(progressHasPacket(int)),this,SLOT(addValueToProgressBar(int)));
|
||||||
|
|
||||||
|
progressBar->setFixedWidth(120);
|
||||||
|
progressBar->setFixedHeight(STATUS_ICON_HEIGH);
|
||||||
|
progressBar->setStyleSheet("#progressBar::horizontal {"
|
||||||
|
"border: 1px solid gray;"
|
||||||
|
"border-radius: 3px;"
|
||||||
|
"background: transparent;"
|
||||||
|
"padding: 1px;"
|
||||||
|
"}"
|
||||||
|
"#progressBar::chunk:horizontal {"
|
||||||
|
"background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop: 1 white);"
|
||||||
|
"}");
|
||||||
|
progressBar->setRange(0,100);
|
||||||
|
progressBar->setValue(0);
|
||||||
|
progressBar->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
progressBar->setTextVisible(true);
|
||||||
|
progressBar->setFormat("%p%");
|
||||||
|
|
||||||
|
|
||||||
|
addPermanentWidget(progressBar,0);
|
||||||
|
addPermanentWidget(iconButtomStatusLabel,0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void jceStatusBar::setIconConnectionStatus(jceProgressStatus update)
|
||||||
|
{
|
||||||
|
QPixmap iconPix;
|
||||||
|
switch (update)
|
||||||
|
{
|
||||||
|
case jceProgressStatus::Disconnected:
|
||||||
|
iconPix.load(":/icons/redStatusIcon.png");
|
||||||
|
showMessage(tr("Disconnected"));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Ready:
|
||||||
|
iconPix.load(":/icons/redStatusIcon.png");
|
||||||
|
showMessage(tr("Ready."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Connecting:
|
||||||
|
iconPix.load(":/icons/blueStatusIcon.png");
|
||||||
|
showMessage(tr("Connecting..."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Sending:
|
||||||
|
iconPix.load(":/icons/blueStatusIcon.png");
|
||||||
|
showMessage(tr("Sending."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Recieving:
|
||||||
|
iconPix.load(":/icons/blueStatusIcon.png");
|
||||||
|
showMessage(tr("Recieving."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Inserting:
|
||||||
|
iconPix.load(":/icons/blueStatusIcon.png");
|
||||||
|
showMessage(tr("Inserting."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::LoggedIn:
|
||||||
|
setProgressValue(100);
|
||||||
|
iconPix.load(":/icons/greenStatusIcon.png");
|
||||||
|
showMessage(tr("LoggedIn."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Done:
|
||||||
|
setProgressValue(100);
|
||||||
|
iconPix.load(":/icons/greenStatusIcon.png");
|
||||||
|
showMessage(tr("Done."));
|
||||||
|
break;
|
||||||
|
case jceProgressStatus::Connected:
|
||||||
|
setProgressValue(100);
|
||||||
|
iconPix.load(":/icons/greenStatusIcon.png");
|
||||||
|
showMessage(tr("Connected"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
iconButtomStatusLabel->setPixmap(iconPix);
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @brief Every time the value changes this method will be called
|
||||||
|
* @param value = the value of the progress Bar
|
||||||
|
*/
|
||||||
|
void jceStatusBar::setProgressValue(int value)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (value == 0)
|
||||||
|
{
|
||||||
|
progressBar->setVisible(false);
|
||||||
|
progressBar->setValue(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
progressBar->setValue(value);
|
||||||
|
progressBar->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void jceStatusBar::addValueToProgressBar(int value)
|
||||||
|
{
|
||||||
|
progressBar->setValue(progressBar->value() + value);
|
||||||
|
|
||||||
|
}
|
51
main/jceWidgets/jcestatusbar.h
Normal file
51
main/jceWidgets/jcestatusbar.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#ifndef JCESTATUSBAR_H
|
||||||
|
#define JCESTATUSBAR_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QProgressBar>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
#define STATUS_ICON_HEIGH 35
|
||||||
|
|
||||||
|
class jceStatusBar : public QStatusBar
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
|
||||||
|
enum jceProgressStatus
|
||||||
|
{
|
||||||
|
Ready,
|
||||||
|
Disconnected,
|
||||||
|
Connecting,
|
||||||
|
Connected,
|
||||||
|
LoggedIn,
|
||||||
|
Sending,
|
||||||
|
Recieving,
|
||||||
|
Inserting,
|
||||||
|
Done
|
||||||
|
};
|
||||||
|
|
||||||
|
jceStatusBar(QWidget *parent = 0);
|
||||||
|
|
||||||
|
void setIconConnectionStatus(jceProgressStatus update);
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void progressHasPacket(int num);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setProgressValue(int val);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void addValueToProgressBar(int value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
QProgressBar * progressBar;
|
||||||
|
QLabel *iconButtomStatusLabel;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // JCESTATUSBAR_H
|
|
@ -6,6 +6,8 @@ MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainSc
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ui->labelMadeBy->setOpenExternalLinks(true);
|
ui->labelMadeBy->setOpenExternalLinks(true);
|
||||||
|
|
||||||
//Login Tab
|
//Login Tab
|
||||||
|
@ -16,12 +18,9 @@ MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainSc
|
||||||
ui->labelUsrInputStatus->setPixmap(iconPix);
|
ui->labelUsrInputStatus->setPixmap(iconPix);
|
||||||
ui->labelPswInputStatus->setPixmap(iconPix);
|
ui->labelPswInputStatus->setPixmap(iconPix);
|
||||||
|
|
||||||
|
//StatusBar
|
||||||
//StatusBar & progressbar
|
statusBar = new jceStatusBar(this);
|
||||||
ui->progressBar->setFixedHeight(STATUS_ICON_HEIGH);
|
this->setStatusBar(statusBar);
|
||||||
ui->statusBar->setStyleSheet("QStatusBar::item { border: 0px solid black };");
|
|
||||||
ui->statusBar->setFixedHeight(STATUS_ICON_HEIGH+5);
|
|
||||||
ui->statusBar->showMessage(tr("Ready"));
|
|
||||||
|
|
||||||
//GPA Tab
|
//GPA Tab
|
||||||
ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue));
|
ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue));
|
||||||
|
@ -30,7 +29,7 @@ MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainSc
|
||||||
qDebug() << Q_FUNC_INFO << "Allocating pointers";
|
qDebug() << Q_FUNC_INFO << "Allocating pointers";
|
||||||
this->userLoginSetting = new user("","");
|
this->userLoginSetting = new user("","");
|
||||||
this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting);
|
this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting);
|
||||||
this->loginHandel = new loginHandler(userLoginSetting,ui->statusBar,ui->loginButton,ui->progressBar);
|
this->loginHandel = new loginHandler(userLoginSetting, ui->loginButton, statusBar);
|
||||||
this->calendar = new CalendarManager(this,ui->calendarGridLayoutMain);
|
this->calendar = new CalendarManager(this,ui->calendarGridLayoutMain);
|
||||||
this->data = new SaveData();
|
this->data = new SaveData();
|
||||||
|
|
||||||
|
@ -46,12 +45,8 @@ MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainSc
|
||||||
//language
|
//language
|
||||||
qDebug() << Q_FUNC_INFO << "Checking locale";
|
qDebug() << Q_FUNC_INFO << "Checking locale";
|
||||||
checkLocale();
|
checkLocale();
|
||||||
ui->statusBar->repaint();
|
|
||||||
qDebug() << Q_FUNC_INFO << "Ready.";
|
qDebug() << Q_FUNC_INFO << "Ready.";
|
||||||
|
|
||||||
//set the progress bar to be invisible (It will show only if value !=0 or !=100)
|
|
||||||
ui->progressBar->setVisible(false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
MainScreen::~MainScreen()
|
MainScreen::~MainScreen()
|
||||||
{
|
{
|
||||||
|
@ -66,7 +61,6 @@ MainScreen::~MainScreen()
|
||||||
//EVENTS ON LOGIN TAB
|
//EVENTS ON LOGIN TAB
|
||||||
void MainScreen::on_loginButton_clicked()
|
void MainScreen::on_loginButton_clicked()
|
||||||
{
|
{
|
||||||
ui->progressBar->setValue(0);
|
|
||||||
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
|
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
|
||||||
if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
|
if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
|
||||||
{
|
{
|
||||||
|
@ -95,7 +89,6 @@ void MainScreen::on_loginButton_clicked()
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
if (this->loginHandel->login(ui->usrnmLineEdit->text(),ui->pswdLineEdit->text()) == true)
|
if (this->loginHandel->login(ui->usrnmLineEdit->text(),ui->pswdLineEdit->text()) == true)
|
||||||
{
|
{
|
||||||
ui->progressBar->setValue(100);
|
|
||||||
qDebug() << Q_FUNC_INFO << "login session end with true";
|
qDebug() << Q_FUNC_INFO << "login session end with true";
|
||||||
ui->pswdLineEdit->setDisabled(true);
|
ui->pswdLineEdit->setDisabled(true);
|
||||||
ui->usrnmLineEdit->setDisabled(true);
|
ui->usrnmLineEdit->setDisabled(true);
|
||||||
|
@ -137,7 +130,7 @@ void MainScreen::on_usrnmLineEdit_editingFinished()
|
||||||
void MainScreen::on_ratesButton_clicked()
|
void MainScreen::on_ratesButton_clicked()
|
||||||
{
|
{
|
||||||
|
|
||||||
ui->progressBar->setValue(0);
|
// ui->progressBar->setValue(0);
|
||||||
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
|
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
|
||||||
if (!checkIfValidDates())
|
if (!checkIfValidDates())
|
||||||
{
|
{
|
||||||
|
@ -150,18 +143,18 @@ void MainScreen::on_ratesButton_clicked()
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
if (loginHandel->isLoggedInFlag())
|
if (loginHandel->isLoggedInFlag())
|
||||||
{
|
{
|
||||||
ui->statusBar->showMessage(tr("Getting grades..."));
|
// ui->statusBar->showMessage(tr("Getting grades..."));
|
||||||
if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),
|
if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),
|
||||||
ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),
|
ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),
|
||||||
ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_PAGE_PASSED)
|
ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_PAGE_PASSED)
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "grade page is ready";
|
qDebug() << Q_FUNC_INFO << "grade page is ready";
|
||||||
ui->statusBar->showMessage(tr("Done. Inserting data into table..."),1000);
|
// ui->statusBar->showMessage(tr("Done. Inserting data into table..."),1000);
|
||||||
pageString = loginHandel->getCurrentPageContect();
|
pageString = loginHandel->getCurrentPageContect();
|
||||||
courseTableMgr->setCoursesList(pageString);
|
courseTableMgr->setCoursesList(pageString);
|
||||||
courseTableMgr->insertJceCoursesIntoTable();
|
courseTableMgr->insertJceCoursesIntoTable();
|
||||||
ui->progressBar->setValue(100);
|
// ui->progressBar->setValue(100);
|
||||||
ui->statusBar->showMessage(tr("Done"));
|
// ui->statusBar->showMessage(tr("Done"));
|
||||||
}
|
}
|
||||||
else if (status == jceLogin::JCE_NOT_CONNECTED)
|
else if (status == jceLogin::JCE_NOT_CONNECTED)
|
||||||
{
|
{
|
||||||
|
@ -248,18 +241,18 @@ void MainScreen::on_examsBtn_clicked()
|
||||||
}
|
}
|
||||||
void MainScreen::on_getCalendarBtn_clicked()
|
void MainScreen::on_getCalendarBtn_clicked()
|
||||||
{
|
{
|
||||||
ui->progressBar->setValue(0);
|
// ui->progressBar->setValue(0);
|
||||||
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
|
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
QString page;
|
QString page;
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
if (loginHandel->isLoggedInFlag())
|
if (loginHandel->isLoggedInFlag())
|
||||||
{
|
{
|
||||||
ui->statusBar->showMessage(tr("Getting schedule..."));
|
// ui->statusBar->showMessage(tr("Getting schedule..."));
|
||||||
if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
|
if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
|
||||||
{
|
{
|
||||||
calendar->resetTable();
|
calendar->resetTable();
|
||||||
ui->statusBar->showMessage(tr("Done. Inserting schdule into table..."),1000);
|
// ui->statusBar->showMessage(tr("Done. Inserting schdule into table..."),1000);
|
||||||
page = loginHandel->getCurrentPageContect();
|
page = loginHandel->getCurrentPageContect();
|
||||||
calendar->setCalendar(page);
|
calendar->setCalendar(page);
|
||||||
|
|
||||||
|
@ -268,10 +261,10 @@ void MainScreen::on_getCalendarBtn_clicked()
|
||||||
//auto getting exam
|
//auto getting exam
|
||||||
if (loginHandel->isLoggedInFlag())
|
if (loginHandel->isLoggedInFlag())
|
||||||
{
|
{
|
||||||
ui->statusBar->showMessage(tr("Getting exams..."));
|
// ui->statusBar->showMessage(tr("Getting exams..."));
|
||||||
if ((status = loginHandel->makeExamsScheduleRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
|
if ((status = loginHandel->makeExamsScheduleRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_PAGE_PASSED)
|
||||||
{
|
{
|
||||||
ui->statusBar->showMessage(tr("Done."),1000);
|
// ui->statusBar->showMessage(tr("Done."),1000);
|
||||||
page = loginHandel->getCurrentPageContect();
|
page = loginHandel->getCurrentPageContect();
|
||||||
calendar->setExamsSchedule(page);
|
calendar->setExamsSchedule(page);
|
||||||
qDebug() << Q_FUNC_INFO << "exams schedule is loaded";
|
qDebug() << Q_FUNC_INFO << "exams schedule is loaded";
|
||||||
|
@ -286,8 +279,8 @@ void MainScreen::on_getCalendarBtn_clicked()
|
||||||
qCritical() << Q_FUNC_INFO << "exams request get ended with" << status;
|
qCritical() << Q_FUNC_INFO << "exams request get ended with" << status;
|
||||||
|
|
||||||
|
|
||||||
ui->progressBar->setValue(100);
|
// ui->progressBar->setValue(100);
|
||||||
ui->statusBar->showMessage(tr("Done"));
|
// ui->statusBar->showMessage(tr("Done"));
|
||||||
}
|
}
|
||||||
else if (status == jceLogin::JCE_NOT_CONNECTED)
|
else if (status == jceLogin::JCE_NOT_CONNECTED)
|
||||||
{
|
{
|
||||||
|
@ -416,16 +409,4 @@ void MainScreen::on_labelMadeBy_linkActivated(const QString &link)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Every time the value changes this method will be called
|
|
||||||
* @param value = the value of the progress Bar
|
|
||||||
*/
|
|
||||||
void MainScreen::on_progressBar_valueChanged(int value)
|
|
||||||
{
|
|
||||||
if(value == 0 || value == 100)
|
|
||||||
ui->progressBar->setVisible(false);
|
|
||||||
else
|
|
||||||
ui->progressBar->setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,10 @@
|
||||||
#include "./CourseTab/coursestablemanager.h"
|
#include "./CourseTab/coursestablemanager.h"
|
||||||
#include "./LoginTab/loginhandler.h"
|
#include "./LoginTab/loginhandler.h"
|
||||||
#include "./CalendarTab/CalendarManager.h"
|
#include "./CalendarTab/CalendarManager.h"
|
||||||
|
#include "./jceWidgets/jceStatusBar.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define STATUS_ICON_HEIGH 35
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainScreen;
|
class MainScreen;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +59,7 @@ private slots:
|
||||||
void on_spinBoxCoursesToYear_valueChanged(int arg1);
|
void on_spinBoxCoursesToYear_valueChanged(int arg1);
|
||||||
void on_spinBoxCoursesToSemester_valueChanged(int arg1);
|
void on_spinBoxCoursesToSemester_valueChanged(int arg1);
|
||||||
void on_labelMadeBy_linkActivated(const QString &link);
|
void on_labelMadeBy_linkActivated(const QString &link);
|
||||||
void on_progressBar_valueChanged(int value);
|
// void on_progressBar_valueChanged(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -75,6 +76,8 @@ private:
|
||||||
coursesTableManager *courseTableMgr;
|
coursesTableManager *courseTableMgr;
|
||||||
loginHandler *loginHandel;
|
loginHandler *loginHandel;
|
||||||
|
|
||||||
|
jceStatusBar *statusBar;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINSCREEN_H
|
#endif // MAINSCREEN_H
|
||||||
|
|
|
@ -899,45 +899,6 @@ font-size: 15px;
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QProgressBar" name="progressBar">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">#progressBar::horizontal {
|
|
||||||
border: 1px solid gray;
|
|
||||||
border-radius: 3px;
|
|
||||||
background: transparent;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
#progressBar::chunk:horizontal {
|
|
||||||
background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop: 1 white);
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="textVisible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="invertedAppearance">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textDirection">
|
|
||||||
<enum>QProgressBar::TopToBottom</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="labelMadeBy">
|
<widget class="QLabel" name="labelMadeBy">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -975,20 +936,6 @@ background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 green, stop:
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuA_about"/>
|
<addaction name="menuA_about"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>50</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<action name="actionCredits">
|
<action name="actionCredits">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Credits</string>
|
<string>Credits</string>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief jceSSLClient::jceSSLClient Constructer, setting the signals
|
* @brief jceSSLClient::jceSSLClient Constructer, setting the signals
|
||||||
*/
|
*/
|
||||||
jceSSLClient::jceSSLClient(QProgressBar *progressbarPtr) : loggedIAndConnectedFlag(false), readingFlag(false),
|
jceSSLClient::jceSSLClient(jceStatusBar *progressbarPtr) : loggedIAndConnectedFlag(false), readingFlag(false),
|
||||||
reConnectionFlag(false), networkConf(), packet(""), recieveLastPacket(false), packetSizeRecieved(0)
|
reConnectionFlag(false), networkConf(), packet(""), recieveLastPacket(false), packetSizeRecieved(0)
|
||||||
{
|
{
|
||||||
this->progressBar = progressbarPtr;
|
this->progressBar = progressbarPtr;
|
||||||
|
@ -208,7 +208,7 @@ void jceSSLClient::readIt()
|
||||||
packet.append("\0");
|
packet.append("\0");
|
||||||
readerAppendingLocker.unlock();
|
readerAppendingLocker.unlock();
|
||||||
|
|
||||||
progressBar->setValue(this->progressBar->value() + 6);
|
emit progressBar->progressHasPacket(6);
|
||||||
|
|
||||||
if (tempPacket.contains("Go_To_system_After_Login.htm") || tempPacket.contains("</html>"))
|
if (tempPacket.contains("Go_To_system_After_Login.htm") || tempPacket.contains("</html>"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <QNetworkConfigurationManager>
|
#include <QNetworkConfigurationManager>
|
||||||
#include <QtNetwork/QNetworkInterface>
|
#include <QtNetwork/QNetworkInterface>
|
||||||
|
|
||||||
#include <QProgressBar>
|
#include "./main/jceWidgets/jcestatusbar.h"
|
||||||
|
|
||||||
#define packetSize 4096 //4k
|
#define packetSize 4096 //4k
|
||||||
#define milisTimeOut 5000 //4 seconds
|
#define milisTimeOut 5000 //4 seconds
|
||||||
|
@ -20,7 +20,7 @@ class jceSSLClient : public QSslSocket
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
jceSSLClient(QProgressBar *progressbarPtr);
|
jceSSLClient(jceStatusBar *progressbarPtr);
|
||||||
|
|
||||||
bool makeConnect(QString server = "yedion.jce.ac.il", int port = 443);
|
bool makeConnect(QString server = "yedion.jce.ac.il", int port = 443);
|
||||||
bool makeDiconnect();
|
bool makeDiconnect();
|
||||||
|
@ -64,7 +64,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QProgressBar *progressBar; //progressbar pointer
|
jceStatusBar *progressBar; //progressbar pointer
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* @brief jceLogin::jceLogin
|
* @brief jceLogin::jceLogin
|
||||||
* @param username pointer to allocated user settings
|
* @param username pointer to allocated user settings
|
||||||
*/
|
*/
|
||||||
jceLogin::jceLogin(user* username, QProgressBar *progressbarPtr)
|
jceLogin::jceLogin(user* username, jceStatusBar *progressbarPtr)
|
||||||
{
|
{
|
||||||
this->progressBar = progressbarPtr;
|
this->progressBar = progressbarPtr;
|
||||||
this->recieverPage = new QString();
|
this->recieverPage = new QString();
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#ifndef JCELOGIN_H
|
#ifndef JCELOGIN_H
|
||||||
#define JCELOGIN_H
|
#define JCELOGIN_H
|
||||||
|
|
||||||
|
|
||||||
#include "./src/jceConnection/jcesslclient.h"
|
#include "./src/jceConnection/jcesslclient.h"
|
||||||
#include "./src/jceSettings/user.h"
|
#include "./src/jceSettings/user.h"
|
||||||
#include "jceLoginHtmlScripts.h"
|
#include "jceLoginHtmlScripts.h"
|
||||||
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QProgressBar>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ class jceLogin : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
jceLogin(user* username,QProgressBar *progressbarPtr);
|
jceLogin(user* username,jceStatusBar *progressbarPtr);
|
||||||
~jceLogin();
|
~jceLogin();
|
||||||
|
|
||||||
enum jceStatus {
|
enum jceStatus {
|
||||||
|
@ -64,7 +65,7 @@ private:
|
||||||
QString * recieverPage;
|
QString * recieverPage;
|
||||||
user * jceA;
|
user * jceA;
|
||||||
jceSSLClient * JceConnector;
|
jceSSLClient * JceConnector;
|
||||||
QProgressBar *progressBar;
|
jceStatusBar *progressBar;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue