-
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.
- Loading branch information
0 parents
commit 50b29f0
Showing
34 changed files
with
51,811 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,48 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2017-05-14T12:53:20 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui svg xml | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = Project | ||
TEMPLATE = app | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which as been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
|
||
SOURCES += main.cpp \ | ||
authorization.cpp \ | ||
graphics_view_zoom.cpp \ | ||
mainwindow.cpp \ | ||
registration.cpp \ | ||
roomlabel.cpp \ | ||
svgreader.cpp | ||
|
||
HEADERS += \ | ||
authorization.h \ | ||
graphics_view_zoom.h \ | ||
mainwindow.h \ | ||
registration.h \ | ||
roomlabel.h \ | ||
svgreader.h | ||
|
||
FORMS += \ | ||
authorization.ui \ | ||
mainwindow.ui \ | ||
registration.ui | ||
|
||
RESOURCES += \ | ||
sources.qrc |
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
# CoursWork |
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,73 @@ | ||
#include "authorization.h" | ||
#include "ui_authorization.h" | ||
#include "mainwindow.h" | ||
#include <QString> | ||
#include <QFile> | ||
#include <QDebug> | ||
|
||
Authorization::Authorization(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::Authorization) | ||
{ | ||
ui->setupUi(this); | ||
setWindowIcon(QIcon(":/fill/ICON.png")); | ||
|
||
ui->buttonEnt->setEnabled(false); | ||
QRegExp exp("[a-zA-Z]{3,15}[0-9]{0,15}[.,_]{0,5}"); | ||
ui->login->setValidator(new QRegExpValidator(exp, this)); | ||
ui->password->setValidator(new QRegExpValidator(exp, this)); | ||
connect(ui->login, SIGNAL(textChanged(QString)),this, SLOT(VhodEnabled())); | ||
connect(ui->password, SIGNAL(textChanged(QString)),this, SLOT(VhodEnabled())); | ||
setWindowTitle("DUBKI"); | ||
} | ||
|
||
bool Authorization::CheckValid(){ | ||
if (ui->login->hasAcceptableInput() && ui->password->hasAcceptableInput()){ | ||
return true; | ||
} else return false; | ||
} | ||
|
||
Authorization::~Authorization() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void Authorization::on_buttonEnt_clicked() | ||
{ | ||
QFile f("./pasw_log.txt"); | ||
if (!f.exists()){ | ||
f.open(QFile::WriteOnly); | ||
} | ||
f.close(); | ||
QFile mFile("./pasw_log.txt"); | ||
if(!mFile.open(QFile::ReadOnly | QFile::Text)){ | ||
ui->info->setText("<font color=red>Error, try again later.</font>"); | ||
return; | ||
} | ||
while (!mFile.atEnd()){ | ||
QString s = mFile.readLine(); | ||
if (s.contains(':' + ui->login->text()) && s.contains('*' + ui->password->text())){ | ||
mFile.close(); | ||
QString student = s.split(" ").at(1).trimmed() + " " + s.split(" ").at(2).trimmed(); | ||
qDebug() << student; | ||
window = new MainWindow(student); | ||
window->show(); | ||
this->close(); | ||
return; | ||
} | ||
} | ||
ui->info->setText("<font color=red>Incorrect login or password.</font>"); | ||
mFile.close(); | ||
return; | ||
} | ||
|
||
void Authorization::VhodEnabled(){ | ||
ui->buttonEnt->setEnabled(CheckValid()); | ||
} | ||
|
||
void Authorization::on_buttonReg_clicked() | ||
{ | ||
Registration w; | ||
w.show(); | ||
w.exec(); | ||
} |
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,33 @@ | ||
#ifndef AUTHORIZATION_H | ||
#define AUTHORIZATION_H | ||
|
||
#include <QMainWindow> | ||
#include "registration.h" | ||
#include "mainwindow.h" | ||
namespace Ui { | ||
class Authorization; | ||
} | ||
|
||
class Authorization : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit Authorization(QWidget *parent = 0); | ||
~Authorization(); | ||
bool CheckValid(); | ||
|
||
private slots: | ||
void on_buttonEnt_clicked(); | ||
|
||
void on_buttonReg_clicked(); | ||
|
||
void VhodEnabled(); | ||
|
||
private: | ||
Ui::Authorization *ui; | ||
MainWindow * window; | ||
|
||
}; | ||
|
||
#endif // AUTHORIZATION_H |
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,106 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Authorization</class> | ||
<widget class="QMainWindow" name="Authorization"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>250</width> | ||
<height>195</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>MainWindow</string> | ||
</property> | ||
<widget class="QWidget" name="centralwidget"> | ||
<layout class="QGridLayout" name="gridLayout_3"> | ||
<property name="sizeConstraint"> | ||
<enum>QLayout::SetDefaultConstraint</enum> | ||
</property> | ||
<item row="0" column="0"> | ||
<widget class="QGroupBox" name="groupBox_3"> | ||
<property name="title"> | ||
<string>Authorization</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout_2"> | ||
<item row="0" column="0"> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label_3"> | ||
<property name="text"> | ||
<string>Username</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1" rowspan="2"> | ||
<widget class="QLineEdit" name="login"/> | ||
</item> | ||
<item row="2" column="1"> | ||
<widget class="QLineEdit" name="password"/> | ||
</item> | ||
<item row="3" column="0"> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item row="1" column="0" rowspan="2"> | ||
<widget class="QLabel" name="label_4"> | ||
<property name="text"> | ||
<string>Password</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="4" column="0"> | ||
<spacer name="horizontalSpacer_3"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>46</width> | ||
<height>13</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item row="3" column="1"> | ||
<widget class="QPushButton" name="buttonEnt"> | ||
<property name="text"> | ||
<string>Enter</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QPushButton" name="buttonReg"> | ||
<property name="text"> | ||
<string>Registration</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="0"> | ||
<widget class="QLabel" name="info"> | ||
<property name="text"> | ||
<string/> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.