Skip to content

Commit daa1a2b

Browse files
committed
Merge branch 'main' of github.com:Taifin/ChitChat into main
2 parents 2480161 + 1951431 commit daa1a2b

File tree

8 files changed

+26
-15
lines changed

8 files changed

+26
-15
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Mikhail Rodionychev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

client/main_window.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ main_window::main_window(QWidget *parent)
1919
scene = new room();
2020
ui->setupUi(this);
2121
this->setWindowTitle("ChitChat");
22+
btn = new QPushButton("Terminate\n server");
23+
ui->verticalLayout_2->addWidget(btn);
24+
connect(btn, SIGNAL(pressed()), this, SLOT(terminate()));
2225
ui->microphone_check->hide();
2326
ui->headphones_check->hide();
2427
move(QGuiApplication::screens().at(0)->geometry().center() -
@@ -68,9 +71,6 @@ void main_window::on_connect_button_clicked() {
6871
if (ui->connect_button->text() == "connect") {
6972
run_send_request(
7073
current_user.serialize(ChitChatMessage::Query_RequestType_CONNECT));
71-
btn = new QPushButton("Terminate");
72-
ui->verticalLayout_2->addWidget(btn);
73-
connect(btn, SIGNAL(pressed()), this, SLOT(terminate()));
7474
ui->change_avatar_button->hide();
7575
ui->connect_button->setText("disconnect");
7676
ui->microphone_check->show();

client/main_window.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ public slots:
5454

5555
void turn_head_off();
5656

57-
void stop_thread();
58-
5957
private slots:
6058
void on_change_avatar_button_clicked();
6159

client/voice_manager.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ client::processor::processor(network::queries_keeper *keeper1,
2020
format = info.nearestFormat(format);
2121
audioOutput = new QAudioOutput(format, this);
2222
outDevice = audioOutput->start();
23-
// timer = new QTimer(this);
2423
}
2524

2625
void client::processor::process() {
@@ -37,14 +36,10 @@ void client::processor::process() {
3736
void client::processor::input_audio_on() {
3837
inDevice = audioInput->start();
3938
connect(inDevice, SIGNAL(readyRead()), this, SLOT(send()));
40-
// connect(timer, SIGNAL(timeout()), this, SLOT(send()));
41-
// timer->start(50);
4239
qDebug() << "Microphone is on";
4340
}
4441

4542
void client::processor::input_audio_off() {
46-
// disconnect(timer, SIGNAL(timeout()), this, SLOT(send()));
47-
// timer->stop();
4843
audioInput->stop();
4944
qDebug() << "Microphone is muted";
5045
}

client/voice_manager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class processor : public network::query_processor {
2626
QIODevice *outDevice;
2727
QIODevice *inDevice;
2828
QTcpSocket *audio_socket;
29-
QTimer *timer;
3029
bool muted;
3130

3231
public slots:

server/server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ void server_processor::get_score() {
217217
auto score = model::database::get_user_score(user_in_process.get_name(), query.game_name() + "_score");
218218
auto q = user_in_process.serialize(Query_FeedbackType_SCORE);
219219
q.set_score(score);
220+
q.set_game_name(query.game_name());
220221
prepare_query(q, to);
221222
}
222223

shared/socket.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ void queries_keeper::push_parsed(const QByteArray &data, QTcpSocket *sender) {
1313
}
1414

1515
void queries_keeper::push_prepared(const QByteArray &q, QTcpSocket *cli) {
16-
// std::unique_lock lock(queries_mutex);
1716
prepared_queries.push({q, cli});
1817
}
1918

@@ -22,14 +21,12 @@ std::pair<QByteArray, QTcpSocket *> queries_keeper::front_parsed() {
2221
}
2322

2423
std::pair<QByteArray, QTcpSocket *> queries_keeper::pop_parsed() {
25-
// std::unique_lock lock(queries_mutex);
2624
auto q = parsed_queries.front();
2725
parsed_queries.pop();
2826
return q;
2927
}
3028

3129
std::pair<QByteArray, QTcpSocket *> queries_keeper::pop_prepared() {
32-
std::unique_lock lock(queries_mutex);
3330
auto q = prepared_queries.front();
3431
prepared_queries.pop();
3532
return q;
@@ -78,7 +75,6 @@ void tcp_socket::send() {
7875
auto q = keeper->pop_prepared();
7976
qDebug() << "Sending msg of size:" << q.first.size();
8077
q.second->write(q.first);
81-
q.second->waitForBytesWritten(100);
8278
}
8379

8480
void tcp_socket::read() {

shared/socket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class query_processor : public QObject {
8686
public slots:
8787

8888
void debug_terminate_me() {
89+
qDebug() << "Aboba";
8990
debug_terminate = true;
9091
};
9192

0 commit comments

Comments
 (0)