Skip to content

Commit 5aa85dc

Browse files
committed
done
1 parent 8250831 commit 5aa85dc

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

client/mainwindow.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,10 @@ void MainWindow::slotReadyRead()
7777

7878
int32_t length;
7979
std::memcpy(&length, buf, sizeof(int32_t));
80-
// qDebug() << "len buf: " <<length;
8180

8281
this->msg_length = length - 1;
8382
}
8483

85-
// qDebug() << "slot ready read, bytesAvailable: " << this->socket->bytesAvailable();
86-
8784
if (this->socket->bytesAvailable() >= this->msg_length)
8885
{
8986
this->msg_length = -1;
@@ -97,8 +94,12 @@ void MainWindow::slotError(QAbstractSocket::SocketError)
9794
this->popup->set_title("Произошла ошибка");
9895
this->popup->set_description("Ошибка соединения с сервером");
9996
this->popup->exec();
100-
this->socket->close();
101-
socket->connectToHost(this->host, this->port);
97+
98+
if (this->forward == type_forward::login || this->forward == type_forward::registration)
99+
{
100+
this->socket->close();
101+
socket->connectToHost(this->host, this->port);
102+
}
102103
}
103104

104105
void MainWindow::slotConnected()
@@ -578,7 +579,8 @@ void MainWindow::fill_db_patterns(tinyxml2::XMLElement *body)
578579
QString img_64 {pattern->FirstChildElement("img")->GetText()};
579580
QString img_type {pattern->FirstChildElement("img_type")->GetText()};
580581

581-
QSqlQuery insert("INSERT INTO Pattern (name, description, code, path_to_image)"
582+
QSqlQuery insert;
583+
insert.exec("INSERT INTO Pattern (name, description, code, path_to_image)"
582584
" VALUES ('" + name + "', '" + description + "', '" + code + "', 'temp')");
583585

584586
QSqlQuery id_query("SELECT id FROM Pattern ORDER BY id DESC");

client/mainwindow.ui

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<item>
2929
<widget class="QStackedWidget" name="screen_stacked">
3030
<property name="currentIndex">
31-
<number>1</number>
31+
<number>4</number>
3232
</property>
3333
<widget class="QWidget" name="login">
3434
<layout class="QHBoxLayout" name="horizontalLayout_2">
@@ -594,13 +594,39 @@
594594
<property name="sizeConstraint">
595595
<enum>QLayout::SetMinimumSize</enum>
596596
</property>
597+
<item>
598+
<spacer name="verticalSpacer_14">
599+
<property name="orientation">
600+
<enum>Qt::Vertical</enum>
601+
</property>
602+
<property name="sizeHint" stdset="0">
603+
<size>
604+
<width>20</width>
605+
<height>40</height>
606+
</size>
607+
</property>
608+
</spacer>
609+
</item>
597610
<item>
598611
<layout class="QVBoxLayout" name="result_layout">
599612
<property name="sizeConstraint">
600613
<enum>QLayout::SetDefaultConstraint</enum>
601614
</property>
602615
</layout>
603616
</item>
617+
<item>
618+
<spacer name="verticalSpacer_13">
619+
<property name="orientation">
620+
<enum>Qt::Vertical</enum>
621+
</property>
622+
<property name="sizeHint" stdset="0">
623+
<size>
624+
<width>20</width>
625+
<height>40</height>
626+
</size>
627+
</property>
628+
</spacer>
629+
</item>
604630
</layout>
605631
</widget>
606632
</widget>
@@ -702,7 +728,7 @@
702728
<rect>
703729
<x>0</x>
704730
<y>0</y>
705-
<width>655</width>
731+
<width>512</width>
706732
<height>594</height>
707733
</rect>
708734
</property>

server/handler_server.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ std::string Handler_server::patterns() const
263263

264264
tinyxml2::XMLPrinter printer;
265265
doc.Print(&printer);
266-
267-
std::cout << std::strlen(printer.CStr()) << std::endl;
268266

269267
return printer.CStr();
270268
}
12.9 KB
Loading
15.5 KB
Loading

server/main.db

16 KB
Binary file not shown.

0 commit comments

Comments
 (0)