mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 23:45:49 -04:00
update i2p messenger plugin to version 0.2.9
changes: add: - Timestamps on Chatmessages - Copy Destination option to userlist - soundEvents(at Unix/linux it need NAS(Network Audio System )) - Tile in chatwindows = Chat with: username (onlinestate) - textColor/textFont are restored, when reopen the Chatwindow (not if you close the Messenger and restart it) changed: - use a better workaround in chatwindow - change paketsize from 32k to 1k (maybe better) - chatwindow press enter so send the message, press shift + enter for a new line - better destination check at addnewUser git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1134 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bb681ae78f
commit
6d65bd0740
41 changed files with 1476 additions and 487 deletions
|
@ -40,4 +40,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,25 +22,7 @@
|
||||||
|
|
||||||
#include "form_Main.h"
|
#include "form_Main.h"
|
||||||
|
|
||||||
/*Icons */
|
|
||||||
#define ICON_QUIT ":/icons/exit.png"
|
|
||||||
#define ICON_MINIMIZE ":/icons/window_nofullscreen.png"
|
|
||||||
#define ICON_MAXIMIZE ":/icons/window_fullscreen.png"
|
|
||||||
#define ICON_QTCHAT ":/icons/userblue24.png"
|
|
||||||
#define ICON_CLOSE ":/icons/exit.png"
|
|
||||||
#define ICON_NEWUSER ":/icons/add_user.png"
|
|
||||||
#define ICON_SETTINGS ":/icons/settings.png"
|
|
||||||
#define ICON_NEWUNREADMESSAGE ":/icons/send.png"
|
|
||||||
#define ICON_USER_TRYTOCONNECT ":/icons/yellow.png"
|
|
||||||
#define ICON_USER_OFFLINE ":/icons/red.png"
|
|
||||||
#define ICON_USER_ONLINE ":/icons/green.png"
|
|
||||||
#define ICON_USER_WANTTOCHAT ":/icons/chatty.png"
|
|
||||||
#define ICON_USER_AWAY ":/icons/xa.png"
|
|
||||||
#define ICON_USER_DONT_DUSTURB ":/icons/dnd.png"
|
|
||||||
#define ICON_USER_INVISIBLE ":/icons/invisible.png"
|
|
||||||
#define ICON_DEBUGMESSAGES ":/icons/status_unknown.png"
|
|
||||||
#define ICON_MYDESTINATION ":/icons/editcopy.png"
|
|
||||||
#define ICON_ABOUT ":/icons/about.png"
|
|
||||||
|
|
||||||
form_MainWindow::form_MainWindow(QWidget* parent)
|
form_MainWindow::form_MainWindow(QWidget* parent)
|
||||||
: QMainWindow(parent){
|
: QMainWindow(parent){
|
||||||
|
@ -60,8 +42,12 @@ void form_MainWindow::init()
|
||||||
|
|
||||||
Core= new cCore();
|
Core= new cCore();
|
||||||
fillComboBox();
|
fillComboBox();
|
||||||
createToolBar();
|
initToolBars();
|
||||||
applicationIsClosing=false;
|
applicationIsClosing=false;
|
||||||
|
|
||||||
|
Mute=false;
|
||||||
|
|
||||||
|
|
||||||
QListWidget* listWidget=this->listWidget;
|
QListWidget* listWidget=this->listWidget;
|
||||||
|
|
||||||
connect (Core,SIGNAL(eventUserChanged()),this,
|
connect (Core,SIGNAL(eventUserChanged()),this,
|
||||||
|
@ -100,6 +86,7 @@ void form_MainWindow::fillComboBox()
|
||||||
|
|
||||||
void form_MainWindow::onlineComboBoxChanged()
|
void form_MainWindow::onlineComboBoxChanged()
|
||||||
{
|
{
|
||||||
|
QComboBox* comboBox= this->comboBox;
|
||||||
QString text=comboBox->currentText();
|
QString text=comboBox->currentText();
|
||||||
|
|
||||||
if(text.contains("Online",Qt::CaseInsensitive)==true){
|
if(text.contains("Online",Qt::CaseInsensitive)==true){
|
||||||
|
@ -136,6 +123,8 @@ void form_MainWindow::onlineComboBoxChanged()
|
||||||
msgBox->setDefaultButton(QMessageBox::Ok);
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox->setWindowModality(Qt::NonModal);
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
msgBox->show();
|
msgBox->show();
|
||||||
|
OnlineStateChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(text.contains("TryToConnect",Qt::CaseInsensitive)==true){
|
else if(text.contains("TryToConnect",Qt::CaseInsensitive)==true){
|
||||||
|
@ -145,7 +134,7 @@ void form_MainWindow::onlineComboBoxChanged()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void form_MainWindow::createToolBar()
|
void form_MainWindow::initToolBars()
|
||||||
{
|
{
|
||||||
//toolBar->setIconSize(QSize(24, 24));
|
//toolBar->setIconSize(QSize(24, 24));
|
||||||
QToolBar* toolBar=this->toolBar;
|
QToolBar* toolBar=this->toolBar;
|
||||||
|
@ -207,7 +196,7 @@ void form_MainWindow::closeApplication(){
|
||||||
emit closeAllWindows();
|
emit closeAllWindows();
|
||||||
|
|
||||||
delete Core;
|
delete Core;
|
||||||
//delete trayIcon;
|
delete trayIcon;
|
||||||
applicationIsClosing=true;
|
applicationIsClosing=true;
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
@ -339,15 +328,13 @@ void form_MainWindow::connecttreeWidgetCostumPopupMenu(QPoint point){
|
||||||
QAction* UserRename = new QAction("Rename",this);
|
QAction* UserRename = new QAction("Rename",this);
|
||||||
connect(UserRename,SIGNAL(triggered()),this, SLOT(userRenameCLicked()));
|
connect(UserRename,SIGNAL(triggered()),this, SLOT(userRenameCLicked()));
|
||||||
|
|
||||||
|
QAction* CopyDestination = new QAction("Copy Destination",this);
|
||||||
|
connect(CopyDestination,SIGNAL(triggered()),this, SLOT(copyDestination()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
contextMnu.clear();
|
contextMnu.clear();
|
||||||
contextMnu.addAction(UserChat);
|
contextMnu.addAction(UserChat);
|
||||||
contextMnu.addAction(UserDelete);
|
|
||||||
contextMnu.addAction(UserRename);
|
|
||||||
|
|
||||||
|
|
||||||
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||||
QString Destination =t->text();
|
QString Destination =t->text();
|
||||||
|
@ -362,6 +349,11 @@ void form_MainWindow::connecttreeWidgetCostumPopupMenu(QPoint point){
|
||||||
contextMnu.addAction(UserSendFile);
|
contextMnu.addAction(UserSendFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
contextMnu.addAction(UserRename);
|
||||||
|
contextMnu.addAction(UserDelete);
|
||||||
|
contextMnu.addAction(CopyDestination);
|
||||||
|
|
||||||
contextMnu.exec( mevent->globalPos());
|
contextMnu.exec( mevent->globalPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,27 +428,38 @@ void form_MainWindow::toggleVisibilitycontextmenu()
|
||||||
show();
|
show();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
void form_MainWindow::OnlineStateChanged()
|
void form_MainWindow::OnlineStateChanged()
|
||||||
{
|
{
|
||||||
QComboBox* comboBox = this->comboBox;
|
QComboBox* comboBox = this->comboBox;
|
||||||
if(Core->getOnlineStatus()==User::USERONLINE)
|
if(Core->getOnlineStatus()==User::USERONLINE)
|
||||||
{
|
{
|
||||||
comboBox->clear();
|
comboBox->clear();
|
||||||
comboBox->addItem(QIcon(ICON_USER_ONLINE) , "Online");
|
comboBox->addItem(QIcon(ICON_USER_ONLINE) , "Online"); //index 0
|
||||||
comboBox->addItem(QIcon(ICON_USER_WANTTOCHAT) , "WantToChat");
|
comboBox->addItem(QIcon(ICON_USER_WANTTOCHAT) , "WantToChat"); //1
|
||||||
comboBox->addItem(QIcon(ICON_USER_AWAY) , "Away");
|
comboBox->addItem(QIcon(ICON_USER_AWAY) , "Away"); //2
|
||||||
comboBox->addItem(QIcon(ICON_USER_DONT_DUSTURB) , "don't disturb");
|
comboBox->addItem(QIcon(ICON_USER_DONT_DUSTURB) , "don't disturb"); //3
|
||||||
comboBox->addItem(QIcon(ICON_USER_INVISIBLE) , "Invisible");
|
comboBox->addItem(QIcon(ICON_USER_INVISIBLE) , "Invisible"); //4
|
||||||
comboBox->addItem(QIcon(ICON_USER_OFFLINE) , "Offline");
|
comboBox->addItem(QIcon(ICON_USER_OFFLINE) , "Offline"); //5
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(Core->getOnlineStatus()==User::USEROFFLINE)
|
else if(Core->getOnlineStatus()==User::USEROFFLINE){
|
||||||
{
|
|
||||||
comboBox->clear();
|
comboBox->clear();
|
||||||
comboBox->addItem(QIcon(ICON_USER_OFFLINE) , "Offline");
|
comboBox->addItem(QIcon(ICON_USER_OFFLINE) , "Offline");
|
||||||
comboBox->addItem(QIcon(ICON_USER_TRYTOCONNECT) , "TryToConnect");
|
comboBox->addItem(QIcon(ICON_USER_TRYTOCONNECT) , "TryToConnect");
|
||||||
|
comboBox->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
else if(Core->getOnlineStatus()==User::USERWANTTOCHAT){
|
||||||
|
comboBox->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
else if(Core->getOnlineStatus()==User::USERAWAY){
|
||||||
|
comboBox->setCurrentIndex(2);
|
||||||
|
}
|
||||||
|
else if(Core->getOnlineStatus()==User::USERDONT_DISTURB){
|
||||||
|
comboBox->setCurrentIndex(3);
|
||||||
|
}
|
||||||
|
else if(Core->getOnlineStatus()==User::USERINVISIBLE){
|
||||||
|
comboBox->setCurrentIndex(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,11 +516,17 @@ void form_MainWindow::initStyle()
|
||||||
QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||||
toggleVisibilityAction =
|
toggleVisibilityAction =
|
||||||
menu->addAction(QIcon(ICON_QTCHAT), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
menu->addAction(QIcon(ICON_QTCHAT), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu()));
|
||||||
|
|
||||||
|
toggleMuteAction=
|
||||||
|
menu->addAction(QIcon(ICON_SOUND_ON), tr("Sound on"),this,SLOT(muteSound()));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
//menu->addAction(QIcon(ICON_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
|
//menu->addAction(QIcon(ICON_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
|
||||||
//menu->addAction(QIcon(ICON_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized()));
|
//menu->addAction(QIcon(ICON_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized()));
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(QIcon(ICON_CLOSE), tr("&Quit"), this, SLOT(closeApplication()));
|
menu->addAction(QIcon(ICON_CLOSE), tr("&Quit"), this, SLOT(closeApplication()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void form_MainWindow::initTryIcon()
|
void form_MainWindow::initTryIcon()
|
||||||
|
@ -541,6 +550,37 @@ void form_MainWindow::SendFile()
|
||||||
QString Destination =t->text();
|
QString Destination =t->text();
|
||||||
|
|
||||||
if(!FilePath.isEmpty())
|
if(!FilePath.isEmpty())
|
||||||
Core->startFileTransfer(FilePath,Destination);
|
Core->addNewFileTransfer(FilePath,Destination);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void form_MainWindow::copyDestination()
|
||||||
|
{
|
||||||
|
QListWidgetItem *t=listWidget->item(listWidget->currentRow()+1);
|
||||||
|
QString Destination =t->text();
|
||||||
|
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
|
||||||
|
clipboard->setText(Destination);
|
||||||
|
QMessageBox::information(this, "",
|
||||||
|
"The Destination is in the clipboard",QMessageBox::Close);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void form_MainWindow::muteSound()
|
||||||
|
{
|
||||||
|
if(this->Mute==false)
|
||||||
|
{
|
||||||
|
toggleMuteAction->setIcon(QIcon(ICON_SOUND_OFF));
|
||||||
|
toggleMuteAction->setText("Sound off");
|
||||||
|
Mute=true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toggleMuteAction->setIcon(QIcon(ICON_SOUND_ON));
|
||||||
|
toggleMuteAction->setText("Sound on");
|
||||||
|
Mute=false;
|
||||||
|
|
||||||
|
}
|
||||||
|
Core->MuteSound(Mute);
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "ui_form_Main.h"
|
#include "ui_form_Main.h"
|
||||||
|
#include "gui_icons.h"
|
||||||
#include "form_settingsgui.h"
|
#include "form_settingsgui.h"
|
||||||
#include "form_newUser.h"
|
#include "form_newUser.h"
|
||||||
#include "form_DebugMessages.h"
|
#include "form_DebugMessages.h"
|
||||||
|
@ -65,10 +66,11 @@ class form_MainWindow : public QMainWindow, private Ui::form_MainWindow
|
||||||
void openChatDialog ();
|
void openChatDialog ();
|
||||||
//Windows end
|
//Windows end
|
||||||
void namingMe();
|
void namingMe();
|
||||||
|
void copyDestination();
|
||||||
void SendFile();
|
void SendFile();
|
||||||
void closeApplication();
|
void closeApplication();
|
||||||
void eventUserChanged();
|
void eventUserChanged();
|
||||||
//void UserDoubleClicked ( QListWidgetItem * item );
|
void muteSound();
|
||||||
|
|
||||||
|
|
||||||
void connecttreeWidgetCostumPopupMenu ( QPoint point );
|
void connecttreeWidgetCostumPopupMenu ( QPoint point );
|
||||||
|
@ -84,19 +86,21 @@ class form_MainWindow : public QMainWindow, private Ui::form_MainWindow
|
||||||
void initStyle();
|
void initStyle();
|
||||||
//void initTryIconMenu();
|
//void initTryIconMenu();
|
||||||
//void initTryIcon();
|
//void initTryIcon();
|
||||||
|
void initToolBars();
|
||||||
|
|
||||||
void fillComboBox();
|
void fillComboBox();
|
||||||
void createToolBar();
|
|
||||||
cCore* Core;
|
cCore* Core;
|
||||||
bool applicationIsClosing;
|
bool applicationIsClosing;
|
||||||
|
|
||||||
cConnectionI2P* I2P;
|
cConnectionI2P* I2P;
|
||||||
form_newUserWindow* newUserWindow;
|
form_newUserWindow* newUserWindow;
|
||||||
|
|
||||||
//QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
//QAction *toggleVisibilityAction, *toolAct;
|
QAction* toggleVisibilityAction, *toolAct;
|
||||||
//QMenu *menu;
|
QAction* toggleMuteAction;
|
||||||
|
QMenu *menu;
|
||||||
|
bool Mute;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,30 @@
|
||||||
#include "form_chatwidget.h"
|
#include "form_chatwidget.h"
|
||||||
#include "src/User.h"
|
#include "src/User.h"
|
||||||
|
|
||||||
|
bool ChatEventEater::eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
if ( event->type() == QEvent::KeyPress )
|
||||||
|
{
|
||||||
|
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
|
if ( obj->objectName() == "message")
|
||||||
|
{
|
||||||
|
if ( keyEvent->key() == Qt::Key_Return && keyEvent->modifiers() == Qt::NoModifier)
|
||||||
|
{
|
||||||
|
emit sendMessage();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (keyEvent->key() == Qt::Key_Return
|
||||||
|
&& keyEvent->modifiers() == Qt::ControlModifier)
|
||||||
|
{
|
||||||
|
emit sendMessage();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QObject::eventFilter(obj, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
form_ChatWidget::form_ChatWidget(cUser* user,QWidget* parent /* = 0 */)
|
form_ChatWidget::form_ChatWidget(cUser* user,QWidget* parent /* = 0 */)
|
||||||
|
@ -11,42 +35,54 @@ form_ChatWidget::form_ChatWidget(cUser* user,QWidget* parent /* = 0 */)
|
||||||
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
this->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||||
|
|
||||||
this->user=user;
|
this->user=user;
|
||||||
|
|
||||||
user->set_HaveAllreadyOneChatWindow(true);
|
user->set_HaveAllreadyOneChatWindow(true);
|
||||||
|
|
||||||
|
QTextEdit *message=this->message;
|
||||||
|
|
||||||
|
m_event_eater = new ChatEventEater(this);
|
||||||
|
connect(m_event_eater, SIGNAL(sendMessage()),
|
||||||
|
send, SLOT(click()));
|
||||||
|
|
||||||
|
message->installEventFilter(m_event_eater);
|
||||||
|
|
||||||
connect(user,SIGNAL(newMessageRecived()),this,
|
connect(user,SIGNAL(newMessageRecived()),this,
|
||||||
SLOT(newMessageRecived()));
|
SLOT(newMessageRecived()));
|
||||||
|
|
||||||
|
connect(user,SIGNAL(OnlineStateChanged()),this,
|
||||||
|
SLOT(changeWindowsTitle()));
|
||||||
|
|
||||||
connect(this,SIGNAL(sendChatMessage(QString)),user,
|
connect(this,SIGNAL(sendChatMessage(QString)),user,
|
||||||
SLOT(sendChatMessage(QString)));
|
SLOT(sendChatMessage(QString)));
|
||||||
|
|
||||||
|
connect(message,SIGNAL(cursorPositionChanged()),this,
|
||||||
|
SLOT(WorkAround()));
|
||||||
|
|
||||||
|
|
||||||
mCurrentFont = QFont("Comic Sans MS", 10);
|
mCurrentFont = user->get_textFont();
|
||||||
|
textColor = user->get_textColor();
|
||||||
|
|
||||||
|
|
||||||
textColor = Qt::black;
|
|
||||||
QPixmap pxm(24,24);
|
QPixmap pxm(24,24);
|
||||||
pxm.fill(textColor);
|
pxm.fill(textColor);
|
||||||
txtColor->setIcon(pxm);
|
txtColor->setIcon(pxm);
|
||||||
|
|
||||||
|
|
||||||
connect(send, SIGNAL(clicked()), SLOT(sendMessageSignal()));
|
connect(send, SIGNAL(clicked()), SLOT(sendMessageSignal()));
|
||||||
connect(txtColor, SIGNAL(clicked()), SLOT(setTextColor()));
|
connect(txtColor, SIGNAL(clicked()), SLOT(setTextColor()));
|
||||||
connect(txtBold, SIGNAL(clicked(bool)),SLOT(setBold(bool)));
|
connect(txtBold, SIGNAL(clicked(bool)),SLOT(setBold(bool)));
|
||||||
connect(txtFont, SIGNAL(clicked()), SLOT(setFont()));
|
connect(txtFont, SIGNAL(clicked()), SLOT(setFont()));
|
||||||
|
|
||||||
/*
|
message->setTextColor(textColor);
|
||||||
message->setStyleSheet(
|
message->setCurrentFont(mCurrentFont);
|
||||||
"QTextEdit {"
|
|
||||||
" selection-color: white;"
|
|
||||||
" selection-background-color: black;"
|
|
||||||
" color: red" // text color
|
|
||||||
"}"
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
resize(450,400);
|
resize(450,400);
|
||||||
|
changeWindowsTitle();
|
||||||
newMessageRecived();
|
newMessageRecived();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void form_ChatWidget::newMessageRecived(){
|
void form_ChatWidget::newMessageRecived(){
|
||||||
QTextEdit *chat=this->chat;
|
QTextEdit *chat=this->chat;
|
||||||
chat->clear();
|
chat->clear();
|
||||||
|
@ -79,6 +115,7 @@ void form_ChatWidget::setTextColor(){
|
||||||
QPixmap pxm(24,24);
|
QPixmap pxm(24,24);
|
||||||
pxm.fill(textColor);
|
pxm.fill(textColor);
|
||||||
txtColor->setIcon(pxm);
|
txtColor->setIcon(pxm);
|
||||||
|
user->set_textColor(textColor);
|
||||||
|
|
||||||
message->setTextColor(textColor);
|
message->setTextColor(textColor);
|
||||||
|
|
||||||
|
@ -91,7 +128,7 @@ void form_ChatWidget::setFont()
|
||||||
bool ok;
|
bool ok;
|
||||||
mCurrentFont = QFontDialog::getFont(&ok, mCurrentFont, this);
|
mCurrentFont = QFontDialog::getFont(&ok, mCurrentFont, this);
|
||||||
|
|
||||||
|
user->set_textFont(mCurrentFont);
|
||||||
message->setCurrentFont(mCurrentFont);
|
message->setCurrentFont(mCurrentFont);
|
||||||
message->setFocus();
|
message->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -102,6 +139,7 @@ void form_ChatWidget::setBold(bool t){
|
||||||
QTextEdit *message=this->message;
|
QTextEdit *message=this->message;
|
||||||
QFont font = message->currentFont();
|
QFont font = message->currentFont();
|
||||||
font.setBold(t);
|
font.setBold(t);
|
||||||
|
user->set_textFont(mCurrentFont);
|
||||||
message->setCurrentFont(font);
|
message->setCurrentFont(font);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -114,18 +152,83 @@ void form_ChatWidget::closeEvent(QCloseEvent *e){
|
||||||
|
|
||||||
void form_ChatWidget::sendMessageSignal(){
|
void form_ChatWidget::sendMessageSignal(){
|
||||||
QTextEdit *message=this->message;
|
QTextEdit *message=this->message;
|
||||||
|
if(message->toPlainText().length()==0)return;
|
||||||
QFont font = message->currentFont();
|
|
||||||
QColor color= message->textColor();
|
|
||||||
|
|
||||||
|
|
||||||
emit sendChatMessage(message->toHtml());
|
emit sendChatMessage(message->toHtml());
|
||||||
//message->setHtml("");
|
message->clear();
|
||||||
|
|
||||||
message->setText(" ");
|
//message->document()->clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void form_ChatWidget::WorkAround()
|
||||||
|
{
|
||||||
|
QTextEdit *message=this->message;
|
||||||
|
if(message->textCursor().position()>1)return;
|
||||||
|
else if(message->textCursor().position()==1 && message->toPlainText().length()==1)
|
||||||
|
{
|
||||||
message->selectAll();
|
message->selectAll();
|
||||||
message->setTextColor(color);
|
|
||||||
message->setCurrentFont(font);
|
|
||||||
|
//message->textCursor().setPosition(QTextCursor::Start);
|
||||||
|
//message->textCursor().setPosition(QTextCursor::Left);
|
||||||
|
//message->textCursor().select(QTextCursor::Document);
|
||||||
|
//message->textCursor().movePosition(QTextCursor::End,QTextCursor::KeepAnchor);
|
||||||
|
|
||||||
|
message->setTextColor(textColor);
|
||||||
|
message->setCurrentFont(mCurrentFont);
|
||||||
|
|
||||||
|
message->moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
|
||||||
|
message->textCursor().clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void form_ChatWidget::changeWindowsTitle()
|
||||||
|
{
|
||||||
|
QString OnlineStatus;
|
||||||
|
QString OnlineStatusIcon;
|
||||||
|
switch(user->get_OnlineState())
|
||||||
|
{
|
||||||
|
|
||||||
|
case USERTRYTOCONNECT:
|
||||||
|
case USERINVISIBLE:
|
||||||
|
case USEROFFLINE:{
|
||||||
|
OnlineStatus="offline";
|
||||||
|
this->setWindowIcon(QIcon(ICON_USER_OFFLINE));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case USERONLINE:
|
||||||
|
{
|
||||||
|
OnlineStatus="online";
|
||||||
|
this->setWindowIcon(QIcon(ICON_USER_ONLINE));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case USERWANTTOCHAT:
|
||||||
|
{
|
||||||
|
OnlineStatus="want to chat";
|
||||||
|
this->setWindowIcon(QIcon(ICON_USER_WANTTOCHAT));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case USERAWAY:
|
||||||
|
{
|
||||||
|
OnlineStatus="away";
|
||||||
|
this->setWindowIcon(QIcon(ICON_USER_AWAY));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case USERDONT_DISTURB:
|
||||||
|
{
|
||||||
|
OnlineStatus="don't disturb";
|
||||||
|
this->setWindowIcon(QIcon(ICON_USER_DONT_DUSTURB));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this->setWindowTitle("Chat with: "+user->get_Name()+" ("+ OnlineStatus +")");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,26 @@
|
||||||
|
|
||||||
|
|
||||||
#include "ui_form_chatwidget.h"
|
#include "ui_form_chatwidget.h"
|
||||||
|
#include "gui_icons.h"
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
|
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
class ChatEventEater : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ChatEventEater(QWidget *parent = 0) : QObject(parent){ }
|
||||||
|
bool m_send_on_enter;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sendMessage();
|
||||||
|
protected:
|
||||||
|
bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class cUser;
|
class cUser;
|
||||||
class form_ChatWidget : public QWidget, public Ui::form_chatwidget
|
class form_ChatWidget : public QWidget, public Ui::form_chatwidget
|
||||||
|
@ -22,6 +38,8 @@ private slots:
|
||||||
void newMessageRecived();
|
void newMessageRecived();
|
||||||
void setBold(bool t);
|
void setBold(bool t);
|
||||||
void setFont();
|
void setFont();
|
||||||
|
void WorkAround();
|
||||||
|
void changeWindowsTitle();
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -32,5 +50,6 @@ private:
|
||||||
QStringList history;
|
QStringList history;
|
||||||
cUser* user;
|
cUser* user;
|
||||||
QFont mCurrentFont;
|
QFont mCurrentFont;
|
||||||
|
ChatEventEater *m_event_eater;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -245,7 +245,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="send" >
|
<widget class="QPushButton" name="send" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Senden</string>
|
<string>Senden</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -30,24 +30,73 @@ void form_newUserWindow::addnewUser()
|
||||||
QString Name=lineEdit->text();
|
QString Name=lineEdit->text();
|
||||||
QString I2PDestination=textEdit->toPlainText();
|
QString I2PDestination=textEdit->toPlainText();
|
||||||
|
|
||||||
|
if(Name.isEmpty())
|
||||||
|
{
|
||||||
|
QMessageBox* msgBox= new QMessageBox(this);
|
||||||
|
msgBox->setIcon(QMessageBox::Warning);
|
||||||
|
msgBox->setText("Adding User");
|
||||||
|
msgBox->setInformativeText("You must add a nick for the User\nadding abborted");
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
msgBox->show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(I2PDestination.length()!=516)
|
||||||
|
{
|
||||||
|
QMessageBox* msgBox= new QMessageBox(this);
|
||||||
|
msgBox->setIcon(QMessageBox::Warning);
|
||||||
|
msgBox->setText("Adding User");
|
||||||
|
msgBox->setInformativeText("The Destination is to short (must be 516)\nadding abborted");
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
msgBox->show();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!I2PDestination.right(4).contains("AAAA",Qt::CaseInsensitive)){
|
||||||
|
//the last 4 char must be "AAAA"
|
||||||
|
QMessageBox* msgBox= new QMessageBox(this);
|
||||||
|
msgBox->setIcon(QMessageBox::Warning);
|
||||||
|
msgBox->setText("Adding User");
|
||||||
|
msgBox->setInformativeText("The Destination must end with AAAA\nadding abborted");
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
msgBox->show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(I2PDestination==Core->getMyDestination())
|
if(I2PDestination==Core->getMyDestination())
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox* msgBox= new QMessageBox(this);
|
||||||
msgBox.setIcon(QMessageBox::Warning);
|
msgBox->setIcon(QMessageBox::Warning);
|
||||||
msgBox.setText("Adding User");
|
msgBox->setText("Adding User");
|
||||||
msgBox.setInformativeText("This Destination is yours, adding aborted !");
|
msgBox->setInformativeText("This Destination is yours, adding aborted !");
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.exec();
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
msgBox->show();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Core->addNewUser(Name,I2PDestination,"","")==false)
|
if(Core->addNewUser(Name,I2PDestination,0)==false){
|
||||||
QMessageBox::warning(this, tr("I2PChat"),
|
|
||||||
("There allready exits one user with the same I2P,- or TorDestination"),
|
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||||
QMessageBox::Ok);
|
msgBox->setIcon(QMessageBox::Warning);
|
||||||
|
msgBox->setInformativeText("There allready exits one user with the same I2P,- or TorDestination");
|
||||||
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
msgBox->show();
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -21,14 +21,7 @@
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="4" column="0" >
|
<item row="3" column="0" >
|
||||||
<widget class="QLineEdit" name="lineEdit_2" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" >
|
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="spacing" >
|
<property name="spacing" >
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
|
@ -36,33 +29,6 @@
|
||||||
<property name="margin" >
|
<property name="margin" >
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Network:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>I2P</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_2" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Tor</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
|
@ -85,13 +51,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
|
||||||
<widget class="QLabel" name="label_4" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Destination Tor:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
|
|
|
@ -31,8 +31,15 @@ form_settingsgui::form_settingsgui(QWidget *parent, Qt::WFlags flags)
|
||||||
styleCombo->addItems(QStyleFactory::keys());
|
styleCombo->addItems(QStyleFactory::keys());
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
connect(ok_Button,SIGNAL(clicked() ),this,SLOT(saveSettings() ) );
|
connect(ok_Button, SIGNAL(clicked(bool) ),this,SLOT(saveSettings() ) );
|
||||||
connect(cancel_Button,SIGNAL(clicked() ),this,SLOT(close() ) );
|
connect(cancel_Button, SIGNAL(clicked(bool) ),this,SLOT(close() ) );
|
||||||
|
connect(cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile()));
|
||||||
|
connect(cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2()));
|
||||||
|
connect(cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3()));
|
||||||
|
connect(cmd_openFile_4,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile4()));
|
||||||
|
connect(cmd_openFile_5,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile5()));
|
||||||
|
connect(cmd_openFile_6,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile6()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
form_settingsgui::~form_settingsgui()
|
form_settingsgui::~form_settingsgui()
|
||||||
|
@ -42,8 +49,6 @@ form_settingsgui::~form_settingsgui()
|
||||||
|
|
||||||
void form_settingsgui::loadSettings()
|
void form_settingsgui::loadSettings()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
settings->beginGroup("General");
|
settings->beginGroup("General");
|
||||||
spinBox->setValue(settings->value("Debug_Max_Message_count","20").toInt());
|
spinBox->setValue(settings->value("Debug_Max_Message_count","20").toInt());
|
||||||
spinBox_3->setValue(settings->value("Waittime_between_rechecking_offline_users","30000").toInt()/1000);
|
spinBox_3->setValue(settings->value("Waittime_between_rechecking_offline_users","30000").toInt()/1000);
|
||||||
|
@ -76,7 +81,7 @@ void form_settingsgui::loadSettings()
|
||||||
lineEdit->setText(settings->value("TunnelName","I2PChat").toString());
|
lineEdit->setText(settings->value("TunnelName","I2PChat").toString());
|
||||||
spinBox_10->setValue(settings->value("SamPort","7656").toInt());
|
spinBox_10->setValue(settings->value("SamPort","7656").toInt());
|
||||||
|
|
||||||
spinBox_4->setMinimum(0);
|
spinBox_4->setMinimum(1);
|
||||||
spinBox_4->setValue(settings->value("inbound.length","1").toInt());
|
spinBox_4->setValue(settings->value("inbound.length","1").toInt());
|
||||||
spinBox_4->setMaximum(3);
|
spinBox_4->setMaximum(3);
|
||||||
|
|
||||||
|
@ -92,7 +97,7 @@ void form_settingsgui::loadSettings()
|
||||||
spinBox_7->setValue(settings->value("outbound.backupQuantity","1").toInt());
|
spinBox_7->setValue(settings->value("outbound.backupQuantity","1").toInt());
|
||||||
spinBox_7->setMaximum(3);
|
spinBox_7->setMaximum(3);
|
||||||
|
|
||||||
spinBox_8->setMinimum(0);
|
spinBox_8->setMinimum(1);
|
||||||
spinBox_8->setValue(settings->value("outbound.length","1").toInt());
|
spinBox_8->setValue(settings->value("outbound.length","1").toInt());
|
||||||
spinBox_8->setMaximum(3);
|
spinBox_8->setMaximum(3);
|
||||||
|
|
||||||
|
@ -101,6 +106,36 @@ void form_settingsgui::loadSettings()
|
||||||
spinBox_9->setMaximum(3);
|
spinBox_9->setMaximum(3);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
|
|
||||||
|
settings->beginGroup("Sound");
|
||||||
|
settings->beginGroup("SoundFilePath");
|
||||||
|
txt_SoundFile->setText(settings->value("User_go_Online","").toString());
|
||||||
|
txt_SoundFile2->setText(settings->value("User_go_Offline","").toString());
|
||||||
|
txt_SoundFile3->setText(settings->value("FileSend_Finished","").toString());
|
||||||
|
txt_SoundFile4->setText(settings->value("FileRecive_Incoming","").toString());
|
||||||
|
txt_SoundFile5->setText(settings->value("FileRecive_Finished","").toString());
|
||||||
|
txt_SoundFile6->setText(settings->value("NewChatMessage","").toString());
|
||||||
|
|
||||||
|
if(!txt_SoundFile->text().isEmpty())checkBoxSound->setEnabled(true);
|
||||||
|
if(!txt_SoundFile2->text().isEmpty())checkBoxSound_2->setEnabled(true);
|
||||||
|
if(!txt_SoundFile3->text().isEmpty())checkBoxSound_3->setEnabled(true);
|
||||||
|
if(!txt_SoundFile4->text().isEmpty())checkBoxSound_4->setEnabled(true);
|
||||||
|
if(!txt_SoundFile5->text().isEmpty())checkBoxSound_5->setEnabled(true);
|
||||||
|
if(!txt_SoundFile6->text().isEmpty())checkBoxSound_6->setEnabled(true);
|
||||||
|
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
settings->beginGroup("Enable");
|
||||||
|
checkBoxSound->setChecked(settings->value("User_go_Online",false).toBool());
|
||||||
|
checkBoxSound_2->setChecked(settings->value("User_go_Offline",false).toBool());
|
||||||
|
checkBoxSound_3->setChecked(settings->value("FileSend_Finished",false).toBool());
|
||||||
|
checkBoxSound_4->setChecked(settings->value("FileRecive_Incoming",false).toBool());
|
||||||
|
checkBoxSound_5->setChecked(settings->value("FileRecive_Finished",false).toBool());
|
||||||
|
checkBoxSound_6->setChecked(settings->value("NewChatMessage",false).toBool());
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
void form_settingsgui::saveSettings()
|
void form_settingsgui::saveSettings()
|
||||||
{
|
{
|
||||||
|
@ -133,6 +168,13 @@ void form_settingsgui::saveSettings()
|
||||||
temp.setNum(spinBox_8->value());
|
temp.setNum(spinBox_8->value());
|
||||||
SessionOptionString+=temp;
|
SessionOptionString+=temp;
|
||||||
|
|
||||||
|
settings->beginGroup("General");
|
||||||
|
settings->setValue("Debug_Max_Message_count",spinBox->value());
|
||||||
|
settings->setValue("Waittime_between_rechecking_offline_users",spinBox_3->value()*1000);
|
||||||
|
settings->setValue("current_Style",styleCombo->currentText());
|
||||||
|
settings->setValue("current_Style_sheet",styleSheetCombo->currentText());
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
settings->beginGroup("Network");
|
settings->beginGroup("Network");
|
||||||
settings->setValue("SamHost",lineEdit_3->text());
|
settings->setValue("SamHost",lineEdit_3->text());
|
||||||
settings->setValue("Destination",lineEdit_2->text());
|
settings->setValue("Destination",lineEdit_2->text());
|
||||||
|
@ -149,15 +191,24 @@ void form_settingsgui::saveSettings()
|
||||||
|
|
||||||
settings->setValue("SessionOptionString",SessionOptionString);
|
settings->setValue("SessionOptionString",SessionOptionString);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
settings->beginGroup("Sound");
|
||||||
settings->beginGroup("General");
|
settings->beginGroup("Enable");
|
||||||
settings->setValue("Debug_Max_Message_count",spinBox->value());
|
settings->setValue("User_go_Online",checkBoxSound->isChecked());
|
||||||
settings->setValue("Waittime_between_rechecking_offline_users",spinBox_3->value()*1000);
|
settings->setValue("User_go_Offline",checkBoxSound_2->isChecked());
|
||||||
settings->setValue("current_Style",styleCombo->currentText());
|
settings->setValue("FileSend_Finished",checkBoxSound_3->isChecked());
|
||||||
settings->setValue("current_Style_sheet",styleSheetCombo->currentText());
|
settings->setValue("FileRecive_Incoming",checkBoxSound_4->isChecked());
|
||||||
|
settings->setValue("FileRecive_Finished",checkBoxSound_5->isChecked());
|
||||||
|
settings->setValue("NewChatMessage",checkBoxSound_6->isChecked());
|
||||||
|
settings->endGroup();
|
||||||
|
settings->beginGroup("SoundFilePath");
|
||||||
|
settings->setValue("User_go_Online",txt_SoundFile->text());
|
||||||
|
settings->setValue("User_go_Offline",txt_SoundFile2->text());
|
||||||
|
settings->setValue("FileSend_Finished",txt_SoundFile3->text());
|
||||||
|
settings->setValue("FileRecive_Incoming",txt_SoundFile4->text());
|
||||||
|
settings->setValue("FileRecive_Finished",txt_SoundFile5->text());
|
||||||
|
settings->setValue("NewChatMessage",txt_SoundFile6->text());
|
||||||
|
settings->endGroup();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,3 +246,68 @@ void form_settingsgui::loadqss()
|
||||||
styleSheetCombo->addItem(st.fileName().remove(".qss"));
|
styleSheetCombo->addItem(st.fileName().remove(".qss"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
////FilePath=QFileDialog::getOpenFileName(this,"Open File", ".", "all Files (*.*)");
|
||||||
|
void form_settingsgui::on_cmd_openFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
txt_SoundFile->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||||
|
if(txt_SoundFile->text().isEmpty()){
|
||||||
|
checkBoxSound->setChecked(false);
|
||||||
|
checkBoxSound->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkBoxSound->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void form_settingsgui::on_cmd_openFile2()
|
||||||
|
{
|
||||||
|
txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||||
|
if(txt_SoundFile2->text().isEmpty()){
|
||||||
|
checkBoxSound_2->setChecked(false);
|
||||||
|
checkBoxSound_2->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkBoxSound_2->setEnabled(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
void form_settingsgui::on_cmd_openFile3()
|
||||||
|
{
|
||||||
|
txt_SoundFile3->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||||
|
if(txt_SoundFile3->text().isEmpty()){
|
||||||
|
checkBoxSound_3->setChecked(false);
|
||||||
|
checkBoxSound_3->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkBoxSound_3->setEnabled(true);
|
||||||
|
}
|
||||||
|
void form_settingsgui::on_cmd_openFile4()
|
||||||
|
{
|
||||||
|
txt_SoundFile4->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||||
|
if(txt_SoundFile4->text().isEmpty()){
|
||||||
|
checkBoxSound_4->setChecked(false);
|
||||||
|
checkBoxSound_4->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkBoxSound_4->setEnabled(true);
|
||||||
|
}
|
||||||
|
void form_settingsgui::on_cmd_openFile5()
|
||||||
|
{
|
||||||
|
txt_SoundFile5->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||||
|
if(txt_SoundFile5->text().isEmpty()){
|
||||||
|
checkBoxSound_5->setChecked(false);
|
||||||
|
checkBoxSound_5->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkBoxSound_5->setEnabled(true);
|
||||||
|
}
|
||||||
|
void form_settingsgui::on_cmd_openFile6()
|
||||||
|
{
|
||||||
|
txt_SoundFile6->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
|
||||||
|
if(txt_SoundFile6->text().isEmpty()){
|
||||||
|
checkBoxSound_6->setChecked(false);
|
||||||
|
checkBoxSound_6->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkBoxSound_6->setEnabled(true);
|
||||||
|
|
||||||
|
}
|
|
@ -40,11 +40,20 @@ private slots:
|
||||||
void on_styleCombo_activated(const QString &styleName);
|
void on_styleCombo_activated(const QString &styleName);
|
||||||
void on_styleSheetCombo_activated(const QString &styleSheetName);
|
void on_styleSheetCombo_activated(const QString &styleSheetName);
|
||||||
|
|
||||||
|
void on_cmd_openFile();
|
||||||
|
void on_cmd_openFile2();
|
||||||
|
void on_cmd_openFile3();
|
||||||
|
void on_cmd_openFile4();
|
||||||
|
void on_cmd_openFile5();
|
||||||
|
void on_cmd_openFile6();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings* settings;
|
QSettings* settings;
|
||||||
void loadStyleSheet(const QString &sheetName);
|
void loadStyleSheet(const QString &sheetName);
|
||||||
void loadqss();
|
void loadqss();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,15 @@
|
||||||
<normaloff>:/icons/encrypted24.png</normaloff>:/icons/encrypted24.png</iconset>
|
<normaloff>:/icons/encrypted24.png</normaloff>:/icons/encrypted24.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Sound</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="resourcen.qrc" >
|
||||||
|
<normaloff>:/icons/sound.png</normaloff>:/icons/sound.png</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="3" >
|
<item row="1" column="0" colspan="3" >
|
||||||
|
@ -299,7 +308,7 @@
|
||||||
<item row="0" column="1" >
|
<item row="0" column="1" >
|
||||||
<widget class="QStackedWidget" name="stackedWidget" >
|
<widget class="QStackedWidget" name="stackedWidget" >
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex" >
|
||||||
<number>0</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="basic_page" >
|
<widget class="QWidget" name="basic_page" >
|
||||||
<widget class="QGroupBox" name="groupBox_6" >
|
<widget class="QGroupBox" name="groupBox_6" >
|
||||||
|
@ -336,6 +345,12 @@
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimum" >
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum" >
|
||||||
|
<number>99999</number>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGroupBox" name="groupBox" >
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
|
@ -958,7 +973,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>147</width>
|
<width>150</width>
|
||||||
<height>32</height>
|
<height>32</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1136,7 +1151,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<x>11</x>
|
<x>11</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>77</width>
|
<width>77</width>
|
||||||
<height>28</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2" >
|
<layout class="QGridLayout" name="gridLayout_2" >
|
||||||
|
@ -1217,7 +1232,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>98</width>
|
<width>104</width>
|
||||||
<height>27</height>
|
<height>27</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1246,6 +1261,358 @@ p, li { white-space: pre-wrap; }
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="Seite" >
|
||||||
|
<widget class="QWidget" name="layoutWidget_2" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>104</width>
|
||||||
|
<height>27</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_4" >
|
||||||
|
<item row="0" column="0" >
|
||||||
|
<widget class="QLabel" name="label_24" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/icons/sound.png" /></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QLabel" name="label_25" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||||
|
<p style=" -qt-block-indent:0; text-indent:0px; font-size:8pt;"><span style=" font-size:12pt; font-weight:600;">Sound</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="groupBox_11" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>441</width>
|
||||||
|
<height>381</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title" >
|
||||||
|
<string>Sound Events</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QGroupBox" name="groupBox_12" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>421</width>
|
||||||
|
<height>81</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title" >
|
||||||
|
<string>User</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSound" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>go Online</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSound_2" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>go Offline</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txt_SoundFile" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>281</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txt_SoundFile2" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>281</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cmd_openFile" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>380</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cmd_openFile_2" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>380</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="groupBox_13" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>421</width>
|
||||||
|
<height>61</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title" >
|
||||||
|
<string>FileSend</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLineEdit" name="txt_SoundFile3" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>281</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cmd_openFile_3" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>380</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSound_3" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Finished</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="groupBox_14" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>421</width>
|
||||||
|
<height>91</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title" >
|
||||||
|
<string>FileRecive</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSound_4" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Incoming</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txt_SoundFile4" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>281</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cmd_openFile_4" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>380</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="cmd_openFile_5" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>380</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSound_5" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Finished</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txt_SoundFile5" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>281</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="groupBox_15" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>260</y>
|
||||||
|
<width>421</width>
|
||||||
|
<height>111</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title" >
|
||||||
|
<string>Chatmessage</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QPushButton" name="cmd_openFile_6" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>380</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSound_6" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="txt_SoundFile6" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>90</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>281</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by normal *
|
||||||
|
* normal@Desktop2 *
|
||||||
|
* *
|
||||||
|
* 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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef GUI_ICONS_H
|
||||||
|
#define GUI_ICONS_H
|
||||||
|
|
||||||
|
/*Icons */
|
||||||
|
#define ICON_QUIT ":/icons/exit.png"
|
||||||
|
#define ICON_MINIMIZE ":/icons/window_nofullscreen.png"
|
||||||
|
#define ICON_MAXIMIZE ":/icons/window_fullscreen.png"
|
||||||
|
#define ICON_QTCHAT ":/icons/userblue24.png"
|
||||||
|
#define ICON_CLOSE ":/icons/exit.png"
|
||||||
|
#define ICON_NEWUSER ":/icons/add_user.png"
|
||||||
|
#define ICON_SETTINGS ":/icons/settings.png"
|
||||||
|
#define ICON_NEWUNREADMESSAGE ":/icons/send.png"
|
||||||
|
#define ICON_USER_TRYTOCONNECT ":/icons/yellow.png"
|
||||||
|
#define ICON_USER_OFFLINE ":/icons/red.png"
|
||||||
|
#define ICON_USER_ONLINE ":/icons/green.png"
|
||||||
|
#define ICON_USER_WANTTOCHAT ":/icons/chatty.png"
|
||||||
|
#define ICON_USER_AWAY ":/icons/xa.png"
|
||||||
|
#define ICON_USER_DONT_DUSTURB ":/icons/dnd.png"
|
||||||
|
#define ICON_USER_INVISIBLE ":/icons/invisible.png"
|
||||||
|
#define ICON_DEBUGMESSAGES ":/icons/status_unknown.png"
|
||||||
|
#define ICON_MYDESTINATION ":/icons/editcopy.png"
|
||||||
|
#define ICON_ABOUT ":/icons/about.png"
|
||||||
|
#define ICON_SOUND_ON ":/icons/sound.png"
|
||||||
|
#define ICON_SOUND_OFF ":/icons/sound_off.png"
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Binary file not shown.
After Width: | Height: | Size: 589 B |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -23,5 +23,7 @@
|
||||||
<file>icons/dnd.png</file>
|
<file>icons/dnd.png</file>
|
||||||
<file>icons/xa.png</file>
|
<file>icons/xa.png</file>
|
||||||
<file>icons/about.png</file>
|
<file>icons/about.png</file>
|
||||||
|
<file>icons/sound.png</file>
|
||||||
|
<file>icons/sound_off.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -34,7 +34,8 @@ DEPENDPATH += . \
|
||||||
|
|
||||||
INCLUDEPATH += . \
|
INCLUDEPATH += . \
|
||||||
|
|
||||||
SOURCES += gui/form_Main.cpp \
|
SOURCES += src/Main.cpp \
|
||||||
|
gui/form_Main.cpp \
|
||||||
src/Core.cpp \
|
src/Core.cpp \
|
||||||
gui/form_newUser.cpp \
|
gui/form_newUser.cpp \
|
||||||
gui/form_DebugMessages.cpp \
|
gui/form_DebugMessages.cpp \
|
||||||
|
@ -52,7 +53,8 @@ SOURCES += gui/form_Main.cpp \
|
||||||
src/FileTransferSend.cpp \
|
src/FileTransferSend.cpp \
|
||||||
src/FileTransferRecive.cpp \
|
src/FileTransferRecive.cpp \
|
||||||
gui/form_fileSend.cpp \
|
gui/form_fileSend.cpp \
|
||||||
gui/form_fileRecive.cpp
|
gui/form_fileRecive.cpp \
|
||||||
|
src/SoundManager.cpp
|
||||||
|
|
||||||
HEADERS += gui/form_Main.h \
|
HEADERS += gui/form_Main.h \
|
||||||
src/Core.h \
|
src/Core.h \
|
||||||
|
@ -72,7 +74,9 @@ HEADERS += gui/form_Main.h \
|
||||||
src/FileTransferSend.h \
|
src/FileTransferSend.h \
|
||||||
src/FileTransferRecive.h \
|
src/FileTransferRecive.h \
|
||||||
gui/form_fileSend.h \
|
gui/form_fileSend.h \
|
||||||
gui/form_fileRecive.h
|
gui/form_fileRecive.h \
|
||||||
|
src/SoundManager.h \
|
||||||
|
gui/gui_icons.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,3 +96,4 @@ RESOURCES += gui/resourcen.qrc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -134,33 +134,33 @@ void cConnectionI2P::readFromSocket()
|
||||||
case STREAM_STATUS:{
|
case STREAM_STATUS:{
|
||||||
emit debugMessages(t);
|
emit debugMessages(t);
|
||||||
if(sam.result==OK)
|
if(sam.result==OK)
|
||||||
this->doSendStreamSessionLimit(sam.Id,0);
|
this->doSendStreamSessionLimit(sam.ID,0);
|
||||||
|
|
||||||
emit StreamStatusRecived(sam.result,sam.Id,sam.Message);
|
emit StreamStatusRecived(sam.result,sam.ID,sam.Message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STREAM_CONNECTED:{
|
case STREAM_CONNECTED:{
|
||||||
emit debugMessages(t);
|
emit debugMessages(t);
|
||||||
|
|
||||||
this->doSendStreamSessionLimit(sam.Id,0);
|
this->doSendStreamSessionLimit(sam.ID,0);
|
||||||
|
|
||||||
emit StreamConnectedRecived(sam.Destination,sam.Id);
|
emit StreamConnectedRecived(sam.Destination,sam.ID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STREAM_CLOSED:{
|
case STREAM_CLOSED:{
|
||||||
emit debugMessages(t);
|
emit debugMessages(t);
|
||||||
emit StreamClosedRecived(sam.result,sam.Id,sam.Message);
|
emit StreamClosedRecived(sam.result,sam.ID,sam.Message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case STREAM_SEND:{
|
case STREAM_SEND:{
|
||||||
emit debugMessages(t);
|
emit debugMessages(t);
|
||||||
emit StreamSendRecived(sam.Id,sam.result,sam.state);
|
emit StreamSendRecived(sam.ID,sam.result,sam.state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STREAM_READY_TO_SEND:{
|
case STREAM_READY_TO_SEND:{
|
||||||
emit debugMessages(t);
|
emit debugMessages(t);
|
||||||
emit StreamReadyToSendRecived(sam.Id);
|
emit StreamReadyToSendRecived(sam.ID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NAMING_REPLY:{
|
case NAMING_REPLY:{
|
||||||
|
@ -175,7 +175,7 @@ void cConnectionI2P::readFromSocket()
|
||||||
|
|
||||||
QByteArray Data=IncomingPackets->mid(CurrentPacket.length(),sam.Size.toLong());
|
QByteArray Data=IncomingPackets->mid(CurrentPacket.length(),sam.Size.toLong());
|
||||||
emit debugMessages(t+Data);
|
emit debugMessages(t+Data);
|
||||||
emit StreamDataRecived(sam.Id,sam.Size,Data);
|
emit StreamDataRecived(sam.ID,sam.Size,Data);
|
||||||
IncomingPackets->remove(CurrentPacket.length(),sam.Size.toLong());
|
IncomingPackets->remove(CurrentPacket.length(),sam.Size.toLong());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -253,46 +253,43 @@ QByteArray Message="SESSION CREATE STYLE=";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 cConnectionI2P::get_NextFreeId()
|
qint32 cConnectionI2P::get_NextFreeId()
|
||||||
{
|
{
|
||||||
return nextFreeID++;
|
return nextFreeID++;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString cConnectionI2P::doStreamConnect(QString Destination)
|
qint32 cConnectionI2P::doStreamConnect(QString Destination)
|
||||||
{
|
{
|
||||||
|
|
||||||
ConnectionReadyCheck();
|
ConnectionReadyCheck();
|
||||||
quint32 ID=get_NextFreeId();
|
qint32 ID=get_NextFreeId();
|
||||||
QString IDtemp;
|
|
||||||
IDtemp.setNum(ID);
|
|
||||||
|
|
||||||
QByteArray Message="STREAM CONNECT ID=";
|
QByteArray Message="STREAM CONNECT ID=";
|
||||||
Message+=IDtemp;
|
Message+=QString::number(ID,10);
|
||||||
Message+=" DESTINATION="+Destination+"\n";
|
Message+=" DESTINATION="+Destination+"\n";
|
||||||
|
|
||||||
emit debugMessages(Message);
|
emit debugMessages(Message);
|
||||||
tcpSocket->write(Message);
|
tcpSocket->write(Message);
|
||||||
tcpSocket->flush();
|
tcpSocket->flush();
|
||||||
return IDtemp;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cConnectionI2P::doStreamClose(QString ID)
|
void cConnectionI2P::doStreamClose(qint32 ID)
|
||||||
{
|
{
|
||||||
|
|
||||||
ConnectionReadyCheck();
|
ConnectionReadyCheck();
|
||||||
QByteArray Message="STREAM CLOSE ID=";
|
QByteArray Message="STREAM CLOSE ID=";
|
||||||
Message+=ID+"\n";
|
Message+=QString::number(ID,10)+"\n";
|
||||||
|
|
||||||
emit debugMessages(Message);
|
emit debugMessages(Message);
|
||||||
tcpSocket->write(Message);
|
tcpSocket->write(Message);
|
||||||
tcpSocket->flush();
|
tcpSocket->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cConnectionI2P::doSendStreamSessionLimit(QString ID,quint64 value)
|
void cConnectionI2P::doSendStreamSessionLimit(qint32 ID,quint64 value)
|
||||||
{
|
{
|
||||||
ConnectionReadyCheck();
|
ConnectionReadyCheck();
|
||||||
QByteArray Message="STREAM RECEIVE ID=";
|
QByteArray Message="STREAM RECEIVE ID=";
|
||||||
Message+=ID+" LIMIT=";
|
Message+=QString::number(ID,10)+" LIMIT=";
|
||||||
if(value==0)
|
if(value==0)
|
||||||
Message+="NONE\n";
|
Message+="NONE\n";
|
||||||
else
|
else
|
||||||
|
@ -305,23 +302,22 @@ void cConnectionI2P::doSendStreamSessionLimit(QString ID,quint64 value)
|
||||||
tcpSocket->write(Message);
|
tcpSocket->write(Message);
|
||||||
tcpSocket->flush();
|
tcpSocket->flush();
|
||||||
}
|
}
|
||||||
void cConnectionI2P::doStreamSend(QString ID,QString Data)
|
void cConnectionI2P::doStreamSend(qint32 ID,QString Data)
|
||||||
{
|
{
|
||||||
QByteArray t="";
|
QByteArray t="";
|
||||||
t.insert(0,Data);
|
t.insert(0,Data);
|
||||||
doStreamSend(ID,t);
|
doStreamSend(ID,t);
|
||||||
}
|
}
|
||||||
void cConnectionI2P::doStreamSend(QString ID,QByteArray Data)
|
void cConnectionI2P::doStreamSend(qint32 ID,QByteArray Data)
|
||||||
{
|
{
|
||||||
|
|
||||||
ConnectionReadyCheck();
|
ConnectionReadyCheck();
|
||||||
|
|
||||||
QString Size;
|
QString Size;
|
||||||
Size.setNum(Data.length());
|
Size.setNum(Data.length());
|
||||||
|
|
||||||
QByteArray Message="STREAM SEND ID=";
|
QByteArray Message="STREAM SEND ID=";
|
||||||
Message+=ID+" SIZE="+Size+"\n";
|
Message+=QString::number(ID,10)+" SIZE="+Size+"\n";
|
||||||
Message.append(Data);
|
Message.append(Data+="\n");
|
||||||
|
|
||||||
emit debugMessages(Message);
|
emit debugMessages(Message);
|
||||||
tcpSocket->write(Message);
|
tcpSocket->write(Message);
|
||||||
|
|
|
@ -69,11 +69,11 @@ class cConnectionI2P :public QObject
|
||||||
public slots:
|
public slots:
|
||||||
void doConnect();
|
void doConnect();
|
||||||
void doDisconnect();
|
void doDisconnect();
|
||||||
QString doStreamConnect(QString Destination);//base64key || return the new id for the stream
|
qint32 doStreamConnect(QString Destination);//base64key || return the new id for the stream
|
||||||
void doStreamSend(QString ID,QByteArray Data);
|
void doStreamSend(qint32 ID,QByteArray Data);
|
||||||
void doStreamSend(QString ID,QString Data);
|
void doStreamSend(qint32 ID,QString Data);
|
||||||
void doStreamClose(QString ID);
|
void doStreamClose(qint32 ID);
|
||||||
void doSendStreamSessionLimit(QString ID,quint64 value=0);
|
void doSendStreamSessionLimit(qint32 ID,quint64 value=0);
|
||||||
void doNamingLookUP(QString Name);
|
void doNamingLookUP(QString Name);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -85,18 +85,18 @@ class cConnectionI2P :public QObject
|
||||||
void debugMessages(const QString Message);
|
void debugMessages(const QString Message);
|
||||||
void HelloReplayRecived(const SAM_Message_Types::RESULT result);
|
void HelloReplayRecived(const SAM_Message_Types::RESULT result);
|
||||||
void SessionStatusRecived(const SAM_Message_Types::RESULT result,const QString Destination,const QString Message);
|
void SessionStatusRecived(const SAM_Message_Types::RESULT result,const QString Destination,const QString Message);
|
||||||
void StreamStatusRecived(const SAM_Message_Types::RESULT result,const QString ID,QString Message);
|
void StreamStatusRecived(const SAM_Message_Types::RESULT result,const qint32 ID,QString Message);
|
||||||
void StreamConnectedRecived(const QString Destinaton,const QString ID);
|
void StreamConnectedRecived(const QString Destinaton,const qint32 ID);
|
||||||
void StreamSendRecived(const QString ID,const SAM_Message_Types::RESULT result,SAM_Message_Types::STATE state);
|
void StreamSendRecived(const qint32 ID,const SAM_Message_Types::RESULT result,SAM_Message_Types::STATE state);
|
||||||
void StreamClosedRecived(const SAM_Message_Types::RESULT result,QString ID,QString Message);
|
void StreamClosedRecived(const SAM_Message_Types::RESULT result,qint32 ID,QString Message);
|
||||||
void StreamReadyToSendRecived(const QString ID);
|
void StreamReadyToSendRecived(const qint32 ID);
|
||||||
void StreamDataRecived(const QString ID,const QString Size,const QByteArray Data);
|
void StreamDataRecived(const qint32 ID,const QString Size,const QByteArray Data);
|
||||||
void NamingReplyRecived(const SAM_Message_Types::RESULT result,QString Name,QString Value="",QString Message="");
|
void NamingReplyRecived(const SAM_Message_Types::RESULT result,QString Name,QString Value="",QString Message="");
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString SamHost;
|
const QString SamHost;
|
||||||
const QString SamPort;
|
const QString SamPort;
|
||||||
quint32 nextFreeID;
|
qint32 nextFreeID;
|
||||||
QByteArray* IncomingPackets;
|
QByteArray* IncomingPackets;
|
||||||
QTcpSocket* tcpSocket;
|
QTcpSocket* tcpSocket;
|
||||||
I2PSamMessageAnalyser* Analyser;
|
I2PSamMessageAnalyser* Analyser;
|
||||||
|
@ -109,7 +109,7 @@ class cConnectionI2P :public QObject
|
||||||
const SESSION_Types::SESSION_DIRECTION SessionDirection;
|
const SESSION_Types::SESSION_DIRECTION SessionDirection;
|
||||||
const QString SessionOptions;
|
const QString SessionOptions;
|
||||||
void doSessionCreate();
|
void doSessionCreate();
|
||||||
quint32 get_NextFreeId();
|
qint32 get_NextFreeId();
|
||||||
|
|
||||||
inline void ConnectionReadyCheck()
|
inline void ConnectionReadyCheck()
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,41 +24,12 @@ cCore::cCore(){
|
||||||
}
|
}
|
||||||
|
|
||||||
cCore::~cCore(){
|
cCore::~cCore(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(StreamClosedRecived(const SAM_Message_Types::RESULT, QString, QString)),this,
|
|
||||||
SLOT(StreamClosedRecived(const SAM_Message_Types::RESULT, QString, QString)));
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(SessionStatusRecived(const SAM_Message_Types::RESULT, const QString, const QString)),this,
|
|
||||||
SLOT(SessionStatusRecived(const SAM_Message_Types::RESULT, const QString, QString)));
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(StreamStatusRecived(const SAM_Message_Types::RESULT, const QString, const QString)),this,
|
|
||||||
SLOT(StreamStatusRecived(const SAM_Message_Types::RESULT, const QString, QString)));
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(StreamConnectedRecived(const QString, const QString)),this,
|
|
||||||
SLOT(StreamConnectedRecived(const QString, const QString)));
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(StreamReadyToSendRecived(const QString)),this,
|
|
||||||
SLOT(StreamReadyToSendRecived(const QString)));
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(StreamSendRecived(const QString, const SAM_Message_Types::RESULT, SAM_Message_Types::STATE)),this,
|
|
||||||
SLOT(StreamSendRecived(const QString, const SAM_Message_Types::RESULT, SAM_Message_Types::STATE)));
|
|
||||||
|
|
||||||
disconnect(I2P,SIGNAL(StreamDataRecived(const QString,const QString,const QByteArray)),this,
|
|
||||||
SLOT(StreamDataRecived(const QString, const QString, const QByteArray)));
|
|
||||||
|
|
||||||
disconnect (I2P,SIGNAL(NamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),this,
|
|
||||||
SLOT(NamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)));
|
|
||||||
|
|
||||||
this->UserConnectThread->stop();
|
this->UserConnectThread->stop();
|
||||||
this->saveUserList();
|
this->saveUserList();
|
||||||
this->closeAllActiveConenctions();
|
this->closeAllActiveConnections();
|
||||||
for(int i=0;i<this->users.count();i++)
|
for(int i=0;i<this->users.count();i++)
|
||||||
delete users.at(i);
|
delete users.at(i);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<cPacketManager*>::Iterator it;
|
QList<cPacketManager*>::Iterator it;
|
||||||
for(it=DataPacketsManagers.begin(); it<DataPacketsManagers.end() ;++it){
|
for(it=DataPacketsManagers.begin(); it<DataPacketsManagers.end() ;++it){
|
||||||
DataPacketsManagers.erase(it);
|
DataPacketsManagers.erase(it);
|
||||||
|
@ -67,52 +38,59 @@ cCore::~cCore(){
|
||||||
delete this->DebugMessageHandler;
|
delete this->DebugMessageHandler;
|
||||||
delete this->Protocol;
|
delete this->Protocol;
|
||||||
delete this->I2P;
|
delete this->I2P;
|
||||||
|
delete this->SoundManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
cDebugMessageManager* cCore::get_DebugMessageHandler(){
|
cDebugMessageManager* cCore::get_DebugMessageHandler(){
|
||||||
return this->DebugMessageHandler;
|
return this->DebugMessageHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCore::addNewUser(QString Name,QString I2PDestination,QString TorDestination,QString I2PStream_ID){
|
bool cCore::addNewUser(QString Name,QString I2PDestination,qint32 I2PStream_ID){
|
||||||
//TODO I2PDestination verify check
|
//TODO I2PDestination verify check
|
||||||
//check if user already exist
|
//check if user already exist
|
||||||
|
|
||||||
|
if(I2PDestination.length()!=516){
|
||||||
|
//Destination must be 516 length
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!I2PDestination.right(4).contains("AAAA",Qt::CaseInsensitive)){
|
||||||
|
//the last 4 char must be "AAAA"
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(I2PDestination.length()>0)
|
if(I2PDestination.length()>0)
|
||||||
if(this->doesUserAllReadyExitsByI2PDestination(I2PDestination)==true)
|
if(this->doesUserAllReadyExitsByI2PDestination(I2PDestination)==true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(TorDestination.length()>0)
|
|
||||||
if(this->doesUserAllReadyExitsByTorDestination(TorDestination)==true)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//add newuser
|
//add newuser
|
||||||
cUser* newuser=new cUser(Protocol,Name,I2PDestination,I2PStream_ID,TorDestination);
|
cUser* newuser=new cUser(Protocol,Name,I2PDestination,I2PStream_ID);
|
||||||
|
connect(newuser,SIGNAL(newIncomingMessageRecived()),SoundManager,
|
||||||
|
SLOT(event_NewChatMessage()));
|
||||||
|
|
||||||
|
connect(newuser,SIGNAL(connectionOnline()),SoundManager,
|
||||||
|
SLOT(event_User_go_Online()));
|
||||||
|
|
||||||
|
connect(newuser,SIGNAL(connectionOffline()),SoundManager,
|
||||||
|
SLOT(event_User_go_Offline()));
|
||||||
|
|
||||||
this->users.append(newuser);
|
this->users.append(newuser);
|
||||||
saveUserList();
|
saveUserList();
|
||||||
|
|
||||||
emit eventUserChanged();
|
emit eventUserChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool cCore::deleteUserByTorDestination(QString TorDestination){
|
|
||||||
/*
|
|
||||||
for(int i=0;i<users.count();i++){
|
|
||||||
if(users.at(i)->get_TORDestination()==TorDestination){
|
|
||||||
if(users.at(i)->get_ConnectionStatus()==ONLINE ||users.at(i)->get_ConnectionStatus()==TRYTOCONNECT)
|
|
||||||
I2P->doStreamClose(users.at(i)-
|
|
||||||
users.removeAt(i);
|
|
||||||
emit eventUserChanged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool cCore::deleteUserByI2PDestination(QString I2PDestination){
|
bool cCore::deleteUserByI2PDestination(QString I2PDestination){
|
||||||
for(int i=0;i<users.count();i++){
|
for(int i=0;i<users.count();i++){
|
||||||
if(users.at(i)->get_I2PDestination()==I2PDestination){
|
if(users.at(i)->get_I2PDestination()==I2PDestination){
|
||||||
if(users.at(i)->get_ConnectionStatus()==ONLINE ||users.at(i)->get_ConnectionStatus()==TRYTOCONNECT)
|
if(users.at(i)->get_ConnectionStatus()==ONLINE ||users.at(i)->get_ConnectionStatus()==TRYTOCONNECT)
|
||||||
{
|
{
|
||||||
deletePacketManagerByID(users.at(i)->get_I2PStreamID());
|
|
||||||
this->StreamClose(users.at(i)->get_I2PStreamID());
|
this->StreamClose(users.at(i)->get_I2PStreamID());
|
||||||
|
deletePacketManagerByID(users.at(i)->get_I2PStreamID());
|
||||||
}
|
}
|
||||||
|
|
||||||
users.removeAt(i);
|
users.removeAt(i);
|
||||||
|
@ -124,16 +102,7 @@ bool cCore::deleteUserByI2PDestination(QString I2PDestination){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCore::doesUserAllReadyExitsByTorDestination(const QString TorDestination){
|
|
||||||
|
|
||||||
for(int i=0;i<users.count();i++){
|
|
||||||
if(users.at(i)->get_TORDestination()==TorDestination) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool cCore::doesUserAllReadyExitsByI2PDestination(const QString I2PDestination){
|
bool cCore::doesUserAllReadyExitsByI2PDestination(const QString I2PDestination){
|
||||||
if(I2PDestination==MyDestination) return true;
|
if(I2PDestination==MyDestination) return true;
|
||||||
|
|
||||||
|
@ -169,30 +138,31 @@ void cCore::init(){
|
||||||
this->I2P=I2P;
|
this->I2P=I2P;
|
||||||
|
|
||||||
//signals from I2PConnection Core
|
//signals from I2PConnection Core
|
||||||
connect (I2P,SIGNAL(StreamClosedRecived(const SAM_Message_Types::RESULT, QString, QString)),this,
|
connect (I2P,SIGNAL(StreamClosedRecived(const SAM_Message_Types::RESULT, qint32, QString)),this,
|
||||||
SLOT(StreamClosedRecived(const SAM_Message_Types::RESULT, QString, QString)),Qt::DirectConnection);
|
SLOT(StreamClosedRecived(const SAM_Message_Types::RESULT, qint32, QString)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(StreamStatusRecived(const SAM_Message_Types::RESULT, const QString, const QString)),this,
|
connect (I2P,SIGNAL(StreamStatusRecived(const SAM_Message_Types::RESULT, const qint32, const QString)),this,
|
||||||
SLOT(StreamStatusRecived(const SAM_Message_Types::RESULT, const QString, QString)),Qt::DirectConnection);
|
SLOT(StreamStatusRecived(const SAM_Message_Types::RESULT, const qint32, QString)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(SessionStatusRecived(const SAM_Message_Types::RESULT, const QString, const QString)),this,
|
connect (I2P,SIGNAL(SessionStatusRecived(const SAM_Message_Types::RESULT, const QString, const QString)),this,
|
||||||
SLOT(SessionStatusRecived(const SAM_Message_Types::RESULT, const QString, QString)),Qt::DirectConnection);
|
SLOT(SessionStatusRecived(const SAM_Message_Types::RESULT, const QString, QString)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(StreamConnectedRecived(const QString, const QString)),this,
|
connect (I2P,SIGNAL(StreamConnectedRecived(const QString, const qint32)),this,
|
||||||
SLOT(StreamConnectedRecived(const QString, const QString)),Qt::DirectConnection);
|
SLOT(StreamConnectedRecived(const QString, const qint32)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(StreamReadyToSendRecived(const QString)),this,
|
connect (I2P,SIGNAL(StreamReadyToSendRecived(const qint32)),this,
|
||||||
SLOT(StreamReadyToSendRecived(const QString)),Qt::DirectConnection);
|
SLOT(StreamReadyToSendRecived(const qint32)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(StreamSendRecived(const QString, const SAM_Message_Types::RESULT, SAM_Message_Types::STATE)),this,
|
connect (I2P,SIGNAL(StreamSendRecived(const qint32, const SAM_Message_Types::RESULT, SAM_Message_Types::STATE)),this,
|
||||||
SLOT(StreamSendRecived(const QString, const SAM_Message_Types::RESULT, SAM_Message_Types::STATE)),Qt::DirectConnection);
|
SLOT(StreamSendRecived(const qint32, const SAM_Message_Types::RESULT, SAM_Message_Types::STATE)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(StreamDataRecived(const QString, const QString, const QByteArray)),this,
|
connect (I2P,SIGNAL(StreamDataRecived(const qint32, const QString, const QByteArray)),this,
|
||||||
SLOT(StreamDataRecived(const QString, const QString, const QByteArray)),Qt::DirectConnection);
|
SLOT(StreamDataRecived(const qint32, const QString, const QByteArray)),Qt::DirectConnection);
|
||||||
|
|
||||||
connect (I2P,SIGNAL(NamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),this,
|
connect (I2P,SIGNAL(NamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),this,
|
||||||
SLOT(NamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),Qt::DirectConnection);
|
SLOT(NamingReplyRecived(const SAM_Message_Types::RESULT, QString, QString, QString)),Qt::DirectConnection);
|
||||||
|
|
||||||
|
this->SoundManager=new cSoundManager();
|
||||||
this->DebugMessageHandler= new cDebugMessageManager(I2P);
|
this->DebugMessageHandler= new cDebugMessageManager(I2P);
|
||||||
this->Protocol= new cProtocol(this);
|
this->Protocol= new cProtocol(this);
|
||||||
this->loadUserList();
|
this->loadUserList();
|
||||||
|
@ -200,6 +170,7 @@ void cCore::init(){
|
||||||
|
|
||||||
this->UserConnectThread= new cUserConnectThread(this,settings->value("Waittime_between_rechecking_offline_users","30000").toInt());
|
this->UserConnectThread= new cUserConnectThread(this,settings->value("Waittime_between_rechecking_offline_users","30000").toInt());
|
||||||
|
|
||||||
|
delete settings;
|
||||||
}
|
}
|
||||||
void cCore::saveUserList(){
|
void cCore::saveUserList(){
|
||||||
QFile file(QApplication::applicationDirPath()+"/users.config");
|
QFile file(QApplication::applicationDirPath()+"/users.config");
|
||||||
|
@ -208,8 +179,7 @@ void cCore::saveUserList(){
|
||||||
|
|
||||||
for(int i=0;i<this->users.count();i++){
|
for(int i=0;i<this->users.count();i++){
|
||||||
out<<"Nick:\t"<<(users.at(i)->get_Name())<<endl
|
out<<"Nick:\t"<<(users.at(i)->get_Name())<<endl
|
||||||
<<"I2PDest:\t"<<(users.at(i)->get_I2PDestination())<<endl
|
<<"I2PDest:\t"<<(users.at(i)->get_I2PDestination())<<endl;
|
||||||
<<"TorDest:\t"<<(users.at(i)->get_TORDestination())<<endl;
|
|
||||||
}
|
}
|
||||||
out.flush();
|
out.flush();
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -221,25 +191,26 @@ void cCore::loadUserList(){
|
||||||
|
|
||||||
QTextStream in(&file);
|
QTextStream in(&file);
|
||||||
in.skipWhiteSpace();
|
in.skipWhiteSpace();
|
||||||
QString NickName;QString I2PDest;QString TorDest;
|
QString NickName;QString I2PDest;
|
||||||
while (!in.atEnd()) {
|
while (!in.atEnd()) {
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
QStringList temp=line.split("\t");
|
QStringList temp=line.split("\t");
|
||||||
|
|
||||||
if(temp[0]=="Nick:")NickName=temp[1];
|
if(temp[0]=="Nick:")NickName=temp[1];
|
||||||
else if(temp[0]=="I2PDest:")I2PDest=temp[1];
|
if(temp[0]=="I2PDest:"){
|
||||||
else if(temp[0]=="TorDest:"){
|
I2PDest=temp[1];
|
||||||
TorDest=temp[1];
|
this->addNewUser(NickName,I2PDest);
|
||||||
this->addNewUser(NickName,I2PDest,TorDest);
|
|
||||||
NickName.clear();
|
NickName.clear();
|
||||||
I2PDest.clear();
|
I2PDest.clear();
|
||||||
TorDest.clear();
|
}
|
||||||
|
else if(temp[0]=="TorDest:"){
|
||||||
|
//ignore it
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::StreamClosedRecived(const SAM_Message_Types::RESULT result,QString ID,QString Message){
|
void cCore::StreamClosedRecived(const SAM_Message_Types::RESULT result,qint32 ID,QString Message){
|
||||||
|
|
||||||
if(isThisID_a_FileSendID(ID)){
|
if(isThisID_a_FileSendID(ID)){
|
||||||
//FileSend
|
//FileSend
|
||||||
|
@ -276,23 +247,21 @@ void cCore::StreamClosedRecived(const SAM_Message_Types::RESULT result,QString I
|
||||||
result==SAM_Message_Types::TIMEOUT
|
result==SAM_Message_Types::TIMEOUT
|
||||||
){
|
){
|
||||||
users.at(i)->set_ConnectionStatus(OFFLINE);
|
users.at(i)->set_ConnectionStatus(OFFLINE);
|
||||||
deletePacketManagerByID(ID);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//on I2P_ERROR or PEER_NOT_FOUND
|
//on I2P_ERROR or PEER_NOT_FOUND
|
||||||
users.at(i)->set_ConnectionStatus(ERROR);
|
users.at(i)->set_ConnectionStatus(ERROR);
|
||||||
deletePacketManagerByID(ID);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
deletePacketManagerByID(ID);
|
||||||
emit eventUserChanged();
|
emit eventUserChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::StreamStatusRecived(const SAM_Message_Types::RESULT result,const QString ID,QString Message){
|
void cCore::StreamStatusRecived(const SAM_Message_Types::RESULT result,const qint32 ID,QString Message){
|
||||||
|
|
||||||
if(isThisID_a_FileSendID(ID)){
|
if(isThisID_a_FileSendID(ID)){
|
||||||
//FileSend
|
//FileSend
|
||||||
|
@ -300,6 +269,7 @@ void cCore::StreamStatusRecived(const SAM_Message_Types::RESULT result,const QSt
|
||||||
if(FileSends.at(i)->get_StreamID()==ID){
|
if(FileSends.at(i)->get_StreamID()==ID){
|
||||||
FileSends.at(i)->StreamStatus(result,ID,Message);
|
FileSends.at(i)->StreamStatus(result,ID,Message);
|
||||||
if(result!=SAM_Message_Types::OK){
|
if(result!=SAM_Message_Types::OK){
|
||||||
|
I2P->doStreamClose(ID);
|
||||||
FileSends.removeAt(i);
|
FileSends.removeAt(i);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -313,6 +283,7 @@ void cCore::StreamStatusRecived(const SAM_Message_Types::RESULT result,const QSt
|
||||||
if(FileRecives.at(i)->get_StreamID()==ID){
|
if(FileRecives.at(i)->get_StreamID()==ID){
|
||||||
FileRecives.at(i)->StreamStatus(result,ID,Message);
|
FileRecives.at(i)->StreamStatus(result,ID,Message);
|
||||||
if(result!=SAM_Message_Types::OK){
|
if(result!=SAM_Message_Types::OK){
|
||||||
|
I2P->doStreamClose(ID);
|
||||||
FileRecives.removeAt(i);
|
FileRecives.removeAt(i);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -322,41 +293,53 @@ void cCore::StreamStatusRecived(const SAM_Message_Types::RESULT result,const QSt
|
||||||
else if(this->isThisIDunknown(ID)){
|
else if(this->isThisIDunknown(ID)){
|
||||||
if(result==SAM_Message_Types::OK){
|
if(result==SAM_Message_Types::OK){
|
||||||
Protocol->newConnectionChat(ID);
|
Protocol->newConnectionChat(ID);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//I2P->doStreamClose(ID);
|
//I2P->doStreamClose(ID);
|
||||||
removeUnknownID(ID);
|
removeUnknownID(ID);
|
||||||
for(int i=0;i<users.count();i++){
|
|
||||||
if(users.at(i)->get_I2PStreamID()==ID){
|
|
||||||
users.at(i)->set_ConnectionStatus(OFFLINE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<users.count();i++){
|
for(int i=0;i<users.count();i++){
|
||||||
if(users.at(i)->get_I2PStreamID()==ID){
|
if(users.at(i)->get_I2PStreamID()==ID){
|
||||||
if(result==SAM_Message_Types::OK){
|
if(result==SAM_Message_Types::OK){
|
||||||
users.at(i)->set_ConnectionStatus(ONLINE);
|
|
||||||
users.at(i)->set_I2PStreamID(ID);
|
users.at(i)->set_I2PStreamID(ID);
|
||||||
this->Protocol->newConnectionChat(ID);
|
users.at(i)->set_ConnectionStatus(ONLINE);
|
||||||
|
|
||||||
|
//this->Protocol->newConnectionChat(ID);
|
||||||
}
|
}
|
||||||
else if( result==SAM_Message_Types::CANT_REACH_PEER ||
|
else if( result==SAM_Message_Types::CANT_REACH_PEER ||
|
||||||
result==SAM_Message_Types::TIMEOUT
|
result==SAM_Message_Types::TIMEOUT
|
||||||
){
|
){
|
||||||
|
|
||||||
users.at(i)->set_ConnectionStatus(OFFLINE);
|
if(users.at(i)->get_OnlineState()!=USEROFFLINE && users.at(i)->get_OnlineState()!=USERTRYTOCONNECT)
|
||||||
deletePacketManagerByID(ID);
|
{
|
||||||
|
users.at(i)->IncomingMessageFromSystem("The Connection is broken: "+Message+"\nConnection closed");
|
||||||
|
I2P->doStreamClose(ID);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
//I2P Error
|
|
||||||
users.at(i)->set_ConnectionStatus(ERROR);
|
|
||||||
deletePacketManagerByID(ID);
|
deletePacketManagerByID(ID);
|
||||||
|
users.at(i)->set_ConnectionStatus(OFFLINE);
|
||||||
|
}
|
||||||
|
else if( result==SAM_Message_Types::INVALID_KEY){
|
||||||
|
users.at(i)->IncomingMessageFromSystem("Invalid User - Destination: please delete the user\n");
|
||||||
|
|
||||||
|
if(users.at(i)->get_ConnectionStatus()==ONLINE)
|
||||||
|
I2P->doStreamClose(ID);
|
||||||
|
|
||||||
|
deletePacketManagerByID(ID);
|
||||||
|
users.at(i)->set_ConnectionStatus(ERROR);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(result==SAM_Message_Types::I2P_ERROR){
|
||||||
|
users.at(i)->IncomingMessageFromSystem("I2P_Error: "+Message);
|
||||||
|
|
||||||
|
if(users.at(i)->get_ConnectionStatus()==ONLINE)
|
||||||
|
I2P->doStreamClose(ID);
|
||||||
|
|
||||||
|
deletePacketManagerByID(ID);
|
||||||
|
users.at(i)->set_ConnectionStatus(ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit eventUserChanged();
|
emit eventUserChanged();
|
||||||
|
@ -375,26 +358,24 @@ void cCore::SessionStatusRecived(const SAM_Message_Types::RESULT result,const QS
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void cCore::StreamConnectedRecived(const QString Destinaton,const QString ID){
|
void cCore::StreamConnectedRecived(const QString Destinaton,const qint32 ID){
|
||||||
//Someone connected you
|
//Someone connected you
|
||||||
//this->Protocol->newConnection(ID);
|
//this->Protocol->newConnection(ID);
|
||||||
cConnection t(ID,Destinaton);
|
cConnection t(ID,Destinaton);
|
||||||
this->unknownConnections.push_back(t);
|
this->unknownConnections.push_back(t);
|
||||||
}
|
}
|
||||||
bool cCore::removeUnknownID(QString ID)
|
bool cCore::removeUnknownID(qint32 ID)
|
||||||
{
|
{
|
||||||
|
|
||||||
for(int i=0;i<this->unknownConnections.size();i++){
|
for(int i=0;i<this->unknownConnections.size();i++){
|
||||||
if(unknownConnections.at(i).ID==ID){
|
if(unknownConnections.at(i).ID==ID){
|
||||||
unknownConnections.removeAt(i);
|
unknownConnections.removeAt(i);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QString cCore::get_UserProtocolVersionByStreamID(QString ID){
|
QString cCore::get_UserProtocolVersionByStreamID(qint32 ID){
|
||||||
|
|
||||||
for(int i=0;i< users.size();i++)
|
for(int i=0;i< users.size();i++)
|
||||||
if(users.at(i)->get_I2PStreamID()==ID){
|
if(users.at(i)->get_I2PStreamID()==ID){
|
||||||
|
@ -404,7 +385,7 @@ QString cCore::get_UserProtocolVersionByStreamID(QString ID){
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
void cCore::set_UserProtocolVersionByStreamID(QString ID,QString Version){
|
void cCore::set_UserProtocolVersionByStreamID(qint32 ID,QString Version){
|
||||||
|
|
||||||
for(int i=0;i< users.size();i++)
|
for(int i=0;i< users.size();i++)
|
||||||
if(users.at(i)->get_I2PStreamID()==ID){
|
if(users.at(i)->get_I2PStreamID()==ID){
|
||||||
|
@ -415,7 +396,7 @@ void cCore::set_UserProtocolVersionByStreamID(QString ID,QString Version){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::removeUnknownIDCreateUserIfNeeded(const QString ID,const QString ProtocolVersion){
|
void cCore::removeUnknownIDCreateUserIfNeeded(const qint32 ID,const QString ProtocolVersion){
|
||||||
//TODO add some security thinks for adding !!! at the moment all user are allowed to connect
|
//TODO add some security thinks for adding !!! at the moment all user are allowed to connect
|
||||||
|
|
||||||
QString Destinaton;
|
QString Destinaton;
|
||||||
|
@ -424,32 +405,43 @@ void cCore::removeUnknownIDCreateUserIfNeeded(const QString ID,const QString Pro
|
||||||
if(unknownConnections.at(i).ID==ID){
|
if(unknownConnections.at(i).ID==ID){
|
||||||
|
|
||||||
Destinaton=unknownConnections.at(i).Destination;
|
Destinaton=unknownConnections.at(i).Destination;
|
||||||
|
removeUnknownID(ID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeUnknownID(ID);
|
|
||||||
|
|
||||||
|
|
||||||
if(doesUserAllReadyExitsByI2PDestination(Destinaton)==false){
|
if(doesUserAllReadyExitsByI2PDestination(Destinaton)==false){
|
||||||
addNewUser("Unknown",Destinaton,"",ID);
|
addNewUser("Unknown",Destinaton,ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<users.count();i++){
|
for(int i=0;i<users.count();i++){
|
||||||
if(users.at(i)->get_I2PDestination()==Destinaton){
|
if(users.at(i)->get_I2PDestination()==Destinaton){
|
||||||
if(users.at(i)->get_ConnectionStatus()==OFFLINE || users.at(i)->get_ConnectionStatus()==ERROR){
|
if(users.at(i)->get_ConnectionStatus()==OFFLINE){
|
||||||
users.at(i)->set_ProtocolVersion(ProtocolVersion);
|
users.at(i)->set_ProtocolVersion(ProtocolVersion);
|
||||||
users.at(i)->set_I2PStreamID(ID);
|
users.at(i)->set_I2PStreamID(ID);
|
||||||
users.at(i)->set_ConnectionStatus(ONLINE);
|
users.at(i)->set_ConnectionStatus(ONLINE);
|
||||||
|
|
||||||
|
cPacketManager* newPacket=new cPacketManager(ID);
|
||||||
|
connect(newPacket,SIGNAL(aPacketIsComplead(const qint32, const QByteArray)),Protocol,
|
||||||
|
SLOT(inputKnown(const qint32,const QByteArray)));
|
||||||
|
|
||||||
|
DataPacketsManagers.push_back(newPacket);
|
||||||
}
|
}
|
||||||
else if(users.at(i)->get_ConnectionStatus()==ONLINE){
|
else if(users.at(i)->get_ConnectionStatus()==ONLINE){
|
||||||
|
/*
|
||||||
//close both Streams
|
//close both Streams
|
||||||
if(ID!=users.at(i)->get_I2PStreamID())
|
if(ID!=users.at(i)->get_I2PStreamID())
|
||||||
{
|
{
|
||||||
I2P->doStreamClose(ID);
|
I2P->doStreamClose(ID);
|
||||||
I2P->doStreamClose(users.at(i)->get_I2PStreamID());
|
I2P->doStreamClose(users.at(i)->get_I2PStreamID());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//close new connection and use the old
|
||||||
|
if(ID!=users.at(i)->get_I2PStreamID())
|
||||||
|
I2P->doStreamClose(ID);
|
||||||
}
|
}
|
||||||
else if(users.at(i)->get_ConnectionStatus()==TRYTOCONNECT){
|
else if(users.at(i)->get_ConnectionStatus()==TRYTOCONNECT){
|
||||||
|
/*
|
||||||
//Stop the TRYTOCONNECT
|
//Stop the TRYTOCONNECT
|
||||||
if(ID!=users.at(i)->get_I2PStreamID())
|
if(ID!=users.at(i)->get_I2PStreamID())
|
||||||
I2P->doStreamClose(users.at(i)->get_I2PStreamID());
|
I2P->doStreamClose(users.at(i)->get_I2PStreamID());
|
||||||
|
@ -457,13 +449,24 @@ void cCore::removeUnknownIDCreateUserIfNeeded(const QString ID,const QString Pro
|
||||||
users.at(i)->set_ProtocolVersion(ProtocolVersion);
|
users.at(i)->set_ProtocolVersion(ProtocolVersion);
|
||||||
users.at(i)->set_I2PStreamID(ID);
|
users.at(i)->set_I2PStreamID(ID);
|
||||||
users.at(i)->set_ConnectionStatus(ONLINE);
|
users.at(i)->set_ConnectionStatus(ONLINE);
|
||||||
}
|
*/
|
||||||
|
//close the tryconnection use the new one
|
||||||
|
if(ID!=users.at(i)->get_I2PStreamID())
|
||||||
|
I2P->doStreamClose(users.at(i)->get_I2PStreamID());
|
||||||
|
users.at(i)->set_ProtocolVersion(ProtocolVersion);
|
||||||
|
users.at(i)->set_I2PStreamID(ID);
|
||||||
|
users.at(i)->set_ConnectionStatus(ONLINE);
|
||||||
|
|
||||||
cPacketManager* newPacket=new cPacketManager(ID);
|
cPacketManager* newPacket=new cPacketManager(ID);
|
||||||
connect(newPacket,SIGNAL(aPacketIsComplead(const QString, const QByteArray)),Protocol,
|
connect(newPacket,SIGNAL(aPacketIsComplead(const qint32, const QByteArray)),Protocol,
|
||||||
SLOT(inputKnown(const QString,const QByteArray)));
|
SLOT(inputKnown(const qint32,const QByteArray)));
|
||||||
|
|
||||||
DataPacketsManagers.push_back(newPacket);
|
DataPacketsManagers.push_back(newPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,7 +474,7 @@ void cCore::removeUnknownIDCreateUserIfNeeded(const QString ID,const QString Pro
|
||||||
emit eventUserChanged();
|
emit eventUserChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::StreamReadyToSendRecived(const QString ID){
|
void cCore::StreamReadyToSendRecived(const qint32 ID){
|
||||||
|
|
||||||
//FileSendsConnections
|
//FileSendsConnections
|
||||||
for(int i=0;i<FileSends.size();i++){
|
for(int i=0;i<FileSends.size();i++){
|
||||||
|
@ -490,7 +493,7 @@ void cCore::StreamReadyToSendRecived(const QString ID){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void cCore::StreamSendRecived(const QString ID,const SAM_Message_Types::RESULT result,SAM_Message_Types::STATE state){
|
void cCore::StreamSendRecived(const qint32 ID,const SAM_Message_Types::RESULT result,SAM_Message_Types::STATE state){
|
||||||
//FIXME what do when result = FAILED ?, impl. a stack ?
|
//FIXME what do when result = FAILED ?, impl. a stack ?
|
||||||
|
|
||||||
//FileSendsConnections
|
//FileSendsConnections
|
||||||
|
@ -518,8 +521,8 @@ void cCore::StreamSendRecived(const QString ID,const SAM_Message_Types::RESULT r
|
||||||
const QList<cUser*> cCore::get_userList(){
|
const QList<cUser*> cCore::get_userList(){
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
QString cCore::StreamConnect(QString Destination){
|
qint32 cCore::StreamConnect(QString Destination){
|
||||||
QString ID;
|
qint32 ID;
|
||||||
|
|
||||||
ID=I2P->doStreamConnect(Destination);
|
ID=I2P->doStreamConnect(Destination);
|
||||||
|
|
||||||
|
@ -528,12 +531,10 @@ QString cCore::StreamConnect(QString Destination){
|
||||||
return (ID);
|
return (ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::StreamDataRecived(const QString ID,const QString Size,const QByteArray Data){
|
void cCore::StreamDataRecived(const qint32 ID,const QString Size,const QByteArray Data){
|
||||||
|
|
||||||
if(Data.isEmpty()==true)return;
|
if(Data.isEmpty()==true)return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//FileRecive
|
//FileRecive
|
||||||
for(int i=0;i<FileRecives.size();i++){
|
for(int i=0;i<FileRecives.size();i++){
|
||||||
if(FileRecives.at(i)->get_StreamID()==ID){
|
if(FileRecives.at(i)->get_StreamID()==ID){
|
||||||
|
@ -552,14 +553,25 @@ void cCore::StreamDataRecived(const QString ID,const QString Size,const QByteArr
|
||||||
//unknown connection
|
//unknown connection
|
||||||
if(this->isThisIDunknown(ID)){
|
if(this->isThisIDunknown(ID)){
|
||||||
QByteArray Data2=Protocol->inputUnknown(ID,Data);
|
QByteArray Data2=Protocol->inputUnknown(ID,Data);
|
||||||
|
|
||||||
if(Data2.isEmpty()==true)
|
if(Data2.isEmpty()==true)
|
||||||
return;
|
return;
|
||||||
else{
|
else{
|
||||||
|
QList<cPacketManager*>::Iterator it;
|
||||||
|
for(it=DataPacketsManagers.begin(); it!=DataPacketsManagers.end() ;++it){
|
||||||
|
if((*(it))->getID()==ID){
|
||||||
|
//(*(it))->operator <<(Data);
|
||||||
|
(*(*it))<<Data2;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
QString StringSize=QString::number(Data2.length());
|
QString StringSize=QString::number(Data2.length());
|
||||||
|
|
||||||
StreamDataRecived(ID,StringSize,Data2);
|
StreamDataRecived(ID,StringSize,Data2);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +581,6 @@ void cCore::StreamDataRecived(const QString ID,const QString Size,const QByteArr
|
||||||
if((*(it))->getID()==ID){
|
if((*(it))->getID()==ID){
|
||||||
//(*(it))->operator <<(Data);
|
//(*(it))->operator <<(Data);
|
||||||
(*(*it))<<Data;
|
(*(*it))<<Data;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -581,7 +592,7 @@ void cCore::StreamDataRecived(const QString ID,const QString Size,const QByteArr
|
||||||
//if it happen forget the Data
|
//if it happen forget the Data
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::closeAllActiveConenctions(){
|
void cCore::closeAllActiveConnections(){
|
||||||
//close all known Online||TrytoConnect Connections
|
//close all known Online||TrytoConnect Connections
|
||||||
|
|
||||||
for(int i=0;i<users.size();i++)
|
for(int i=0;i<users.size();i++)
|
||||||
|
@ -595,7 +606,6 @@ void cCore::closeAllActiveConenctions(){
|
||||||
users.at(i)->set_ConnectionStatus(User::OFFLINE);
|
users.at(i)->set_ConnectionStatus(User::OFFLINE);
|
||||||
users.at(i)->set_OnlineState(USEROFFLINE);
|
users.at(i)->set_OnlineState(USEROFFLINE);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//close all unknownConnections
|
//close all unknownConnections
|
||||||
for(int i=0;i<unknownConnections.size();i++)
|
for(int i=0;i<unknownConnections.size();i++)
|
||||||
|
@ -604,11 +614,13 @@ void cCore::closeAllActiveConenctions(){
|
||||||
removeUnknownID( unknownConnections.at(i).ID);
|
removeUnknownID( unknownConnections.at(i).ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//DataPacketsManagers.clear();
|
||||||
|
|
||||||
emit eventUserChanged();
|
emit eventUserChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCore::isThisIDunknown(QString ID){
|
bool cCore::isThisIDunknown(qint32 ID){
|
||||||
|
|
||||||
for(int i=0;i<this->unknownConnections.size();i++)
|
for(int i=0;i<this->unknownConnections.size();i++)
|
||||||
if(unknownConnections.at(i).ID==ID){
|
if(unknownConnections.at(i).ID==ID){
|
||||||
|
@ -618,7 +630,7 @@ bool cCore::isThisIDunknown(QString ID){
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cUser* cCore::getUserByI2P_ID(QString ID){
|
cUser* cCore::getUserByI2P_ID(qint32 ID){
|
||||||
|
|
||||||
for(int i=0;i<users.size();i++){
|
for(int i=0;i<users.size();i++){
|
||||||
if(users.at(i)->get_I2PStreamID()==ID){
|
if(users.at(i)->get_I2PStreamID()==ID){
|
||||||
|
@ -654,7 +666,7 @@ bool cCore::isThisDestinationInunknownConnections(QString Destination){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::deletePacketManagerByID(QString ID){
|
void cCore::deletePacketManagerByID(qint32 ID){
|
||||||
if(this->isThisIDunknown(ID)==true)
|
if(this->isThisIDunknown(ID)==true)
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
|
@ -676,24 +688,24 @@ QString cCore::get_connectionDump(){
|
||||||
|
|
||||||
Message+="< Current open Unknown IDs: >\n";
|
Message+="< Current open Unknown IDs: >\n";
|
||||||
for(int i=0;i<unknownConnections.size();i++)
|
for(int i=0;i<unknownConnections.size();i++)
|
||||||
Message+=unknownConnections.at(i).ID;
|
Message+=QString::number(unknownConnections.at(i).ID,10)+"\n";
|
||||||
|
|
||||||
Message+="\n\n< Current open Known IDs(packetManager): >\n";
|
Message+="\n\n< Current open Known IDs(packetManager): >\n";
|
||||||
|
|
||||||
QList<cPacketManager*>::Iterator it;
|
QList<cPacketManager*>::Iterator it;
|
||||||
for(it=DataPacketsManagers.begin(); it!=DataPacketsManagers.end();++it)
|
for(it=DataPacketsManagers.begin(); it!=DataPacketsManagers.end();++it)
|
||||||
Message+= ((*(it))->getID()+"\n");
|
Message+= (QString::number((*(it))->getID(),10)+"\n");
|
||||||
|
|
||||||
Message+="\n\n< Active FileTransfer: >\n";
|
Message+="\n\n< Active FileTransfer: >\n";
|
||||||
for(int i=0;i<FileSends.count();i++){
|
for(int i=0;i<FileSends.count();i++){
|
||||||
Message+="FileName:\t\t:"+FileSends.at(i)->get_FileName()+"\n";
|
Message+="FileName:\t\t:"+FileSends.at(i)->get_FileName()+"\n";
|
||||||
Message+="StreamID:\t\t"+FileSends.at(i)->get_StreamID()+"\n";
|
Message+="StreamID:\t\t"+QString::number(FileSends.at(i)->get_StreamID(),10)+"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
Message+="\n\n< Active Filerecive: >\n";
|
Message+="\n\n< Active Filerecive: >\n";
|
||||||
for(int i=0;i<FileRecives.count();i++){
|
for(int i=0;i<FileRecives.count();i++){
|
||||||
Message+="FileName:\t\t"+FileRecives.at(i)->get_FileName()+"\n";
|
Message+="FileName:\t\t"+FileRecives.at(i)->get_FileName()+"\n";
|
||||||
Message+="StreamID:\t\t"+FileRecives.at(i)->get_StreamID()+"\n";
|
Message+="StreamID:\t\t"+QString::number(FileRecives.at(i)->get_StreamID(),10)+"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -703,7 +715,7 @@ QString cCore::get_connectionDump(){
|
||||||
Message+="ClientName:\t\t"+users.at(i)->get_ClientName()+"\n";
|
Message+="ClientName:\t\t"+users.at(i)->get_ClientName()+"\n";
|
||||||
Message+="ClientVersion:\t\t"+users.at(i)->get_ClientVersion()+"\n";
|
Message+="ClientVersion:\t\t"+users.at(i)->get_ClientVersion()+"\n";
|
||||||
Message+="ProtocolVersion:\t" +users.at(i)->get_ProtocolVersion()+"\n";
|
Message+="ProtocolVersion:\t" +users.at(i)->get_ProtocolVersion()+"\n";
|
||||||
Message+="I2PStreamID:\t\t" +users.at(i)->get_I2PStreamID()+"\n";
|
Message+="I2PStreamID:\t\t" +QString::number(users.at(i)->get_I2PStreamID(),10)+"\n";
|
||||||
|
|
||||||
switch(users.at(i)->get_ConnectionStatus())
|
switch(users.at(i)->get_ConnectionStatus())
|
||||||
{
|
{
|
||||||
|
@ -828,10 +840,9 @@ void cCore::setOnlineStatus(const ONLINESTATE newStatus)
|
||||||
|
|
||||||
void cCore::stopCore()
|
void cCore::stopCore()
|
||||||
{
|
{
|
||||||
closeAllActiveConenctions();
|
|
||||||
I2P->doDisconnect();
|
|
||||||
UserConnectThread->stop();
|
UserConnectThread->stop();
|
||||||
|
closeAllActiveConnections();
|
||||||
|
I2P->doDisconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::restartCore()
|
void cCore::restartCore()
|
||||||
|
@ -840,14 +851,17 @@ void cCore::restartCore()
|
||||||
UserConnectThread->start();
|
UserConnectThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::startFileTransfer(QString FilePath, QString Destination)
|
void cCore::addNewFileTransfer(QString FilePath, QString Destination)
|
||||||
{
|
{
|
||||||
cFileTransferSend * t= new cFileTransferSend(this,FilePath,Destination);
|
cFileTransferSend * t= new cFileTransferSend(this,FilePath,Destination);
|
||||||
|
connect (t,SIGNAL(event_FileTransferFinishedOK()),SoundManager,
|
||||||
|
SLOT(event_FileSend_Finished()));
|
||||||
|
|
||||||
FileSends.append(t);
|
FileSends.append(t);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCore::isThisID_a_FileSendID(QString ID)
|
bool cCore::isThisID_a_FileSendID(qint32 ID)
|
||||||
{
|
{
|
||||||
for(int i=0;i<FileSends.size();i++){
|
for(int i=0;i<FileSends.size();i++){
|
||||||
if(FileSends.at(i)->get_StreamID()==ID){
|
if(FileSends.at(i)->get_StreamID()==ID){
|
||||||
|
@ -857,7 +871,7 @@ bool cCore::isThisID_a_FileSendID(QString ID)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCore::isThisID_a_FileReciveID(QString ID)
|
bool cCore::isThisID_a_FileReciveID(qint32 ID)
|
||||||
{
|
{
|
||||||
for(int i=0;i<FileRecives.size();i++){
|
for(int i=0;i<FileRecives.size();i++){
|
||||||
if(FileRecives.at(i)->get_StreamID()==ID){
|
if(FileRecives.at(i)->get_StreamID()==ID){
|
||||||
|
@ -867,7 +881,7 @@ bool cCore::isThisID_a_FileReciveID(QString ID)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::addNewFileRecive(QString ID, QString FileName, QString FileSize)
|
void cCore::addNewFileRecive(qint32 ID, QString FileName, QString FileSize)
|
||||||
{
|
{
|
||||||
if(isThisIDunknown(ID)) removeUnknownID(ID);
|
if(isThisIDunknown(ID)) removeUnknownID(ID);
|
||||||
|
|
||||||
|
@ -890,23 +904,28 @@ void cCore::addNewFileRecive(QString ID, QString FileName, QString FileSize)
|
||||||
this->StreamClose(ID);
|
this->StreamClose(ID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SoundManager->event_FileRecive_Incoming();
|
||||||
cFileTransferRecive* t= new cFileTransferRecive(this,ID,FileName,Size);
|
cFileTransferRecive* t= new cFileTransferRecive(this,ID,FileName,Size);
|
||||||
|
connect(t,SIGNAL(event_FileRecivedFinishedOK()),SoundManager,
|
||||||
|
SLOT(event_FileRecive_Finished()));
|
||||||
|
|
||||||
FileRecives.append(t);
|
FileRecives.append(t);
|
||||||
t->start();
|
t->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::StreamSendData(QString ID, QByteArray Data)
|
|
||||||
|
void cCore::StreamSendData(qint32 ID, QByteArray Data)
|
||||||
{
|
{
|
||||||
I2P->doStreamSend(ID,Data);
|
I2P->doStreamSend(ID,Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cCore::StreamSendData(QString ID, QString Data)
|
void cCore::StreamSendData(qint32 ID, QString Data)
|
||||||
{
|
{
|
||||||
I2P->doStreamSend(ID,Data);
|
I2P->doStreamSend(ID,Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cCore::StreamClose(QString ID)
|
void cCore::StreamClose(qint32 ID)
|
||||||
{
|
{
|
||||||
if(FileSends.count()>0){
|
if(FileSends.count()>0){
|
||||||
for(int i=0;i<FileSends.count();i++){
|
for(int i=0;i<FileSends.count();i++){
|
||||||
|
@ -935,3 +954,9 @@ bool cCore::checkIfAFileTransferOrReciveisActive()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cCore::MuteSound(bool t)
|
||||||
|
{
|
||||||
|
SoundManager->doMute(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,17 +37,18 @@
|
||||||
#include "PacketManager.h"
|
#include "PacketManager.h"
|
||||||
#include "FileTransferSend.h"
|
#include "FileTransferSend.h"
|
||||||
#include "FileTransferRecive.h"
|
#include "FileTransferRecive.h"
|
||||||
|
#include "SoundManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define CLIENTVERSION "0.2.7 Beta"
|
#define CLIENTVERSION "0.2.9 Beta"
|
||||||
#define CLIENTNAME "I2P-Messenger (QT)"
|
#define CLIENTNAME "I2P-Messenger (QT)"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct cConnection
|
struct cConnection
|
||||||
{
|
{
|
||||||
cConnection ( QString ID,QString Destination )
|
cConnection ( qint32 ID,QString Destination )
|
||||||
{
|
{
|
||||||
this->ID=ID;
|
this->ID=ID;
|
||||||
this->Destination=Destination;
|
this->Destination=Destination;
|
||||||
|
@ -57,14 +58,13 @@ struct cConnection
|
||||||
this->ID=t.ID;
|
this->ID=t.ID;
|
||||||
this->Destination=t.Destination;
|
this->Destination=t.Destination;
|
||||||
}
|
}
|
||||||
QString ID;
|
qint32 ID;
|
||||||
QString Destination;
|
QString Destination;
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace SAM_Message_Types;
|
using namespace SAM_Message_Types;
|
||||||
using namespace User;
|
using namespace User;
|
||||||
class cUserConnectThread;
|
class cUserConnectThread;
|
||||||
|
|
||||||
class cCore :public QObject
|
class cCore :public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -74,15 +74,15 @@ class cCore :public QObject
|
||||||
~cCore();
|
~cCore();
|
||||||
cDebugMessageManager* get_DebugMessageHandler();
|
cDebugMessageManager* get_DebugMessageHandler();
|
||||||
const QList<cUser*> get_userList();
|
const QList<cUser*> get_userList();
|
||||||
bool isThisIDunknown ( QString ID );
|
bool isThisIDunknown ( qint32 ID );
|
||||||
bool removeUnknownID ( QString ID );
|
bool removeUnknownID ( qint32 ID );
|
||||||
bool isThisDestinationInunknownConnections ( QString Destination );
|
bool isThisDestinationInunknownConnections ( QString Destination );
|
||||||
|
|
||||||
void removeUnknownIDCreateUserIfNeeded( const QString ID,const QString ProtocolVersion );
|
void removeUnknownIDCreateUserIfNeeded( const qint32 ID,const QString ProtocolVersion );
|
||||||
|
|
||||||
QString get_UserProtocolVersionByStreamID ( QString ID );
|
QString get_UserProtocolVersionByStreamID ( qint32 ID );
|
||||||
void set_UserProtocolVersionByStreamID ( QString ID,QString Version );
|
void set_UserProtocolVersionByStreamID ( qint32 ID,QString Version );
|
||||||
cUser* getUserByI2P_ID ( QString ID );
|
cUser* getUserByI2P_ID ( qint32 ID );
|
||||||
cUser* getUserByI2P_Destination ( QString Destination );
|
cUser* getUserByI2P_Destination ( QString Destination );
|
||||||
const QString getMyDestination() const;
|
const QString getMyDestination() const;
|
||||||
ONLINESTATE getOnlineStatus()const;
|
ONLINESTATE getOnlineStatus()const;
|
||||||
|
@ -90,35 +90,35 @@ class cCore :public QObject
|
||||||
QString get_ClientVersion(){return CLIENTVERSION;};
|
QString get_ClientVersion(){return CLIENTVERSION;};
|
||||||
QString get_ProtocolVersion(){return Protocol->get_ProtocolVersion();};
|
QString get_ProtocolVersion(){return Protocol->get_ProtocolVersion();};
|
||||||
void setOnlineStatus(const ONLINESTATE newStatus);
|
void setOnlineStatus(const ONLINESTATE newStatus);
|
||||||
void startFileTransfer(QString FilePath,QString Destination);
|
void addNewFileTransfer(QString FilePath,QString Destination);
|
||||||
void addNewFileRecive(QString ID,QString FileName,QString FileSize);
|
void addNewFileRecive(qint32 ID,QString FileName,QString FileSize);
|
||||||
void StreamSendData(QString ID,QByteArray Data);
|
void StreamSendData(qint32 ID,QByteArray Data);
|
||||||
void StreamSendData(QString ID,QString Data);
|
void StreamSendData(qint32 ID,QString Data);
|
||||||
void StreamClose(QString ID);
|
void StreamClose(qint32 ID);
|
||||||
QString StreamConnect (QString Destination );
|
qint32 StreamConnect (QString Destination );
|
||||||
bool checkIfAFileTransferOrReciveisActive();
|
bool checkIfAFileTransferOrReciveisActive();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
bool addNewUser (QString Name,QString I2PDestination,QString TorDestination,QString I2PStream_ID="");
|
bool addNewUser (QString Name,QString I2PDestination,qint32 I2PStream_ID=0);
|
||||||
bool deleteUserByTorDestination (const QString TorDestination );
|
|
||||||
bool deleteUserByI2PDestination (const QString I2PDestination );
|
bool deleteUserByI2PDestination (const QString I2PDestination );
|
||||||
bool renameuserByI2PDestination (const QString Destination, const QString newNickname);
|
bool renameuserByI2PDestination (const QString Destination, const QString newNickname);
|
||||||
void doNamingLookUP ( QString Name );
|
void doNamingLookUP ( QString Name );
|
||||||
|
void MuteSound(bool t);
|
||||||
|
|
||||||
|
|
||||||
QString get_connectionDump();
|
QString get_connectionDump();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// <SIGNALS FROM cConnectionI2P>
|
// <SIGNALS FROM cConnectionI2P>
|
||||||
void StreamClosedRecived ( const SAM_Message_Types::RESULT result,QString ID,QString Message );
|
void StreamClosedRecived ( const SAM_Message_Types::RESULT result,qint32 ID,QString Message );
|
||||||
void StreamStatusRecived ( const SAM_Message_Types::RESULT result,const QString ID,QString Message );
|
void StreamStatusRecived ( const SAM_Message_Types::RESULT result,const qint32 ID,QString Message );
|
||||||
void StreamConnectedRecived ( const QString Destinaton,const QString ID );
|
void StreamConnectedRecived ( const QString Destinaton,const qint32 ID );
|
||||||
void StreamReadyToSendRecived ( const QString ID );
|
void StreamReadyToSendRecived ( const qint32 ID );
|
||||||
void StreamSendRecived ( const QString ID,const SAM_Message_Types::RESULT result,SAM_Message_Types::STATE state );
|
void StreamSendRecived ( const qint32 ID,const SAM_Message_Types::RESULT result,SAM_Message_Types::STATE state );
|
||||||
void SessionStatusRecived ( const SAM_Message_Types::RESULT result,const QString Destination,const QString Message );
|
void SessionStatusRecived ( const SAM_Message_Types::RESULT result,const QString Destination,const QString Message );
|
||||||
void StreamDataRecived ( const QString ID,const QString Size,const QByteArray Data );
|
void StreamDataRecived ( const qint32 ID,const QString Size,const QByteArray Data );
|
||||||
void NamingReplyRecived ( const SAM_Message_Types::RESULT result,QString Name,QString Value="",QString Message="" );
|
void NamingReplyRecived ( const SAM_Message_Types::RESULT result,QString Name,QString Value="",QString Message="" );
|
||||||
signals:
|
signals:
|
||||||
void eventUserChanged();
|
void eventUserChanged();
|
||||||
|
@ -136,20 +136,19 @@ class cCore :public QObject
|
||||||
ONLINESTATE currentOnlineStatus;
|
ONLINESTATE currentOnlineStatus;
|
||||||
QList<cFileTransferSend*> FileSends;
|
QList<cFileTransferSend*> FileSends;
|
||||||
QList<cFileTransferRecive*> FileRecives;
|
QList<cFileTransferRecive*> FileRecives;
|
||||||
|
cSoundManager* SoundManager;
|
||||||
|
|
||||||
bool doesUserAllReadyExitsByTorDestination ( QString TorDestination );
|
|
||||||
bool doesUserAllReadyExitsByI2PDestination ( QString I2PDestination );
|
bool doesUserAllReadyExitsByI2PDestination ( QString I2PDestination );
|
||||||
void init();
|
void init();
|
||||||
void saveUserList();
|
void saveUserList();
|
||||||
void loadUserList();
|
void loadUserList();
|
||||||
void stopCore();
|
void stopCore();
|
||||||
void restartCore();
|
void restartCore();
|
||||||
void closeAllActiveConenctions();
|
void closeAllActiveConnections();
|
||||||
void deletePacketManagerByID ( QString ID );
|
void deletePacketManagerByID ( qint32 ID );
|
||||||
bool isThisID_a_FileSendID(QString ID);
|
bool isThisID_a_FileSendID(qint32 ID);
|
||||||
bool isThisID_a_FileReciveID(QString ID);
|
bool isThisID_a_FileReciveID(qint32 ID);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cFileTransferRecive::cFileTransferRecive(cCore * Core, QString StreamID, QString FileName, quint64 FileSize)
|
cFileTransferRecive::cFileTransferRecive(cCore * Core, qint32 StreamID, QString FileName, quint64 FileSize)
|
||||||
:StreamID(StreamID),FileName(FileName),FileSize(FileSize)
|
:StreamID(StreamID),FileName(FileName),FileSize(FileSize)
|
||||||
{
|
{
|
||||||
this->Core=Core;
|
this->Core=Core;
|
||||||
allreadyRecivedSize=0;
|
allreadyRecivedSize=0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cFileTransferRecive::~ cFileTransferRecive()
|
cFileTransferRecive::~ cFileTransferRecive()
|
||||||
|
@ -38,7 +36,7 @@ cFileTransferRecive::~ cFileTransferRecive()
|
||||||
delete FileForRecive;
|
delete FileForRecive;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFileTransferRecive::StreamStatus(const SAM_Message_Types::RESULT result, const QString ID, QString Message)
|
void cFileTransferRecive::StreamStatus(const SAM_Message_Types::RESULT result, const qint32 ID, QString Message)
|
||||||
{
|
{
|
||||||
if(result==SAM_Message_Types::OK)
|
if(result==SAM_Message_Types::OK)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +52,7 @@ void cFileTransferRecive::StreamStatus(const SAM_Message_Types::RESULT result, c
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFileTransferRecive::StreamClosed(const SAM_Message_Types::RESULT result, QString ID, QString Message)
|
void cFileTransferRecive::StreamClosed(const SAM_Message_Types::RESULT result, qint32 ID, QString Message)
|
||||||
{
|
{
|
||||||
if(allreadyRecivedSize==FileSize){
|
if(allreadyRecivedSize==FileSize){
|
||||||
|
|
||||||
|
@ -131,4 +129,22 @@ void cFileTransferRecive::start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cFileTransferRecive::start_withAutoAccept(QString Path)
|
||||||
|
{
|
||||||
|
|
||||||
|
QString SFileSize;
|
||||||
|
SFileSize.setNum(FileSize);
|
||||||
|
|
||||||
|
QString FilePath=Path+="/"+FileName;
|
||||||
|
|
||||||
|
if(!FilePath.isEmpty()){
|
||||||
|
FileForRecive= new QFile(FilePath);
|
||||||
|
FileForRecive->open(QIODevice::WriteOnly);
|
||||||
|
Core->StreamSendData(StreamID,QString("0"));//true
|
||||||
|
|
||||||
|
Dialog= new form_fileRecive(this);
|
||||||
|
Dialog->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,17 @@ class cFileTransferRecive:public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
cFileTransferRecive(cCore* Core,QString StreamID,QString FileName,quint64 FileSize);
|
cFileTransferRecive(cCore* Core,qint32 StreamID,QString FileName,quint64 FileSize);
|
||||||
~cFileTransferRecive();
|
~cFileTransferRecive();
|
||||||
void start();
|
void start();
|
||||||
|
void start_withAutoAccept(QString Path);
|
||||||
|
|
||||||
void StreamStatus(const SAM_Message_Types::RESULT result,const QString ID,QString Message);
|
void StreamStatus(const SAM_Message_Types::RESULT result,const qint32 ID,QString Message);
|
||||||
void StreamClosed(const SAM_Message_Types::RESULT result,QString ID,QString Message);
|
void StreamClosed(const SAM_Message_Types::RESULT result,qint32 ID,QString Message);
|
||||||
void operator << ( QByteArray t );
|
void operator << ( QByteArray t );
|
||||||
quint64 get_FileSize(){return FileSize;};
|
quint64 get_FileSize(){return FileSize;};
|
||||||
QString get_FileName(){return FileName;};
|
QString get_FileName(){return FileName;};
|
||||||
QString get_StreamID(){return StreamID;};
|
qint32 get_StreamID(){return StreamID;};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void abbortFileRecive();
|
void abbortFileRecive();
|
||||||
|
@ -54,7 +55,7 @@ class cFileTransferRecive:public QObject
|
||||||
const quint64 FileSize;
|
const quint64 FileSize;
|
||||||
quint64 allreadyRecivedSize;
|
quint64 allreadyRecivedSize;
|
||||||
const QString FileName;
|
const QString FileName;
|
||||||
const QString StreamID;
|
const qint32 StreamID;
|
||||||
QFile* FileForRecive;
|
QFile* FileForRecive;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -45,7 +45,7 @@ void cFileTransferSend::abbortFileSend()
|
||||||
Core->StreamClose(StreamID);
|
Core->StreamClose(StreamID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFileTransferSend::StreamStatus(const SAM_Message_Types::RESULT result, const QString ID, QString Message)
|
void cFileTransferSend::StreamStatus(const SAM_Message_Types::RESULT result, const qint32 ID, QString Message)
|
||||||
{
|
{
|
||||||
using namespace FileTransferProtocol;
|
using namespace FileTransferProtocol;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ void cFileTransferSend::StreamStatus(const SAM_Message_Types::RESULT result, con
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFileTransferSend::StreamClosed(const SAM_Message_Types::RESULT result, QString ID, QString Message)
|
void cFileTransferSend::StreamClosed(const SAM_Message_Types::RESULT result, qint32 ID, QString Message)
|
||||||
{
|
{
|
||||||
if(result==SAM_Message_Types::OK){
|
if(result==SAM_Message_Types::OK){
|
||||||
if(allreadySendedSize==FileSize){
|
if(allreadySendedSize==FileSize){
|
||||||
|
|
|
@ -30,7 +30,8 @@ namespace FileTransferProtocol
|
||||||
};
|
};
|
||||||
|
|
||||||
//limited to 30Kb
|
//limited to 30Kb
|
||||||
#define MAXPAKETSIZE 30720
|
//#define MAXPAKETSIZE 30720
|
||||||
|
#define MAXPAKETSIZE 1024
|
||||||
class cCore;
|
class cCore;
|
||||||
class form_fileSend;
|
class form_fileSend;
|
||||||
class cFileTransferSend:public QObject
|
class cFileTransferSend:public QObject
|
||||||
|
@ -40,12 +41,12 @@ class cFileTransferSend:public QObject
|
||||||
public:
|
public:
|
||||||
cFileTransferSend(cCore* Core,QString FilePath,QString Destination);
|
cFileTransferSend(cCore* Core,QString FilePath,QString Destination);
|
||||||
~cFileTransferSend();
|
~cFileTransferSend();
|
||||||
void StreamStatus(const SAM_Message_Types::RESULT result,const QString ID,QString Message);
|
void StreamStatus(const SAM_Message_Types::RESULT result,const qint32 ID,QString Message);
|
||||||
void StreamClosed(const SAM_Message_Types::RESULT result,QString ID,QString Message);
|
void StreamClosed(const SAM_Message_Types::RESULT result,qint32 ID,QString Message);
|
||||||
void StreamReadyToSend(bool t);
|
void StreamReadyToSend(bool t);
|
||||||
void operator << ( QByteArray t );
|
void operator << ( QByteArray t );
|
||||||
quint64 get_FileSize(){return FileSize;};
|
quint64 get_FileSize(){return FileSize;};
|
||||||
QString get_StreamID(){return StreamID;};
|
qint32 get_StreamID(){return StreamID;};
|
||||||
QString get_FileName(){return FileName;};
|
QString get_FileName(){return FileName;};
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ class cFileTransferSend:public QObject
|
||||||
qint64 FileSize;
|
qint64 FileSize;
|
||||||
qint64 allreadySendedSize;
|
qint64 allreadySendedSize;
|
||||||
const QString Destination;
|
const QString Destination;
|
||||||
QString StreamID;
|
qint32 StreamID;
|
||||||
QFile* FileForSend;
|
QFile* FileForSend;
|
||||||
bool sendFirstPaket;
|
bool sendFirstPaket;
|
||||||
bool FileTransferAccepted;
|
bool FileTransferAccepted;
|
||||||
|
|
|
@ -37,7 +37,10 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
|
|
||||||
//get ID
|
//get ID
|
||||||
QStringList temp=list[2].split("=");
|
QStringList temp=list[2].split("=");
|
||||||
t.Id=temp[1];
|
QString sID=temp[1];
|
||||||
|
|
||||||
|
|
||||||
|
t.ID=QStringToQint32(sID);
|
||||||
//get Size
|
//get Size
|
||||||
temp= list[3].split("=");
|
temp= list[3].split("=");
|
||||||
t.Size=temp[1].remove("\n");
|
t.Size=temp[1].remove("\n");
|
||||||
|
@ -47,7 +50,9 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
|
|
||||||
//GET ID
|
//GET ID
|
||||||
QStringList temp=list[2].split("=");
|
QStringList temp=list[2].split("=");
|
||||||
t.Id=temp[1].remove("\n");
|
QString sID=temp[1].remove("\n");
|
||||||
|
|
||||||
|
t.ID=QStringToQint32(sID);
|
||||||
}
|
}
|
||||||
else if((list[0]=="HELLO") && (list[1]=="REPLY")){
|
else if((list[0]=="HELLO") && (list[1]=="REPLY")){
|
||||||
t.type=HELLO_REPLAY;
|
t.type=HELLO_REPLAY;
|
||||||
|
@ -97,11 +102,13 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
t.type=ERROR_IN_ANALYSE;
|
t.type=ERROR_IN_ANALYSE;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------
|
//----------------
|
||||||
//Get ID
|
//Get ID
|
||||||
QStringList temp=list[3].split("=");
|
QStringList temp=list[3].split("=");
|
||||||
|
QString sID=temp[1].remove("\n");
|
||||||
|
|
||||||
t.Id=temp[1].remove("\n");
|
t.ID=QStringToQint32(sID);
|
||||||
//----------------
|
//----------------
|
||||||
//Get Message
|
//Get Message
|
||||||
if(Message.contains("MESSAGE=",Qt::CaseInsensitive)){
|
if(Message.contains("MESSAGE=",Qt::CaseInsensitive)){
|
||||||
|
@ -115,10 +122,13 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
t.type=STREAM_CONNECTED;
|
t.type=STREAM_CONNECTED;
|
||||||
|
|
||||||
QStringList temp=list[2].split("=");
|
QStringList temp=list[2].split("=");
|
||||||
|
QString sID;
|
||||||
t.Destination=temp[1];
|
t.Destination=temp[1];
|
||||||
|
|
||||||
temp=list[3].split("=");
|
temp=list[3].split("=");
|
||||||
t.Id=temp[1].remove("\n");
|
sID=temp[1].remove("\n");
|
||||||
|
|
||||||
|
t.ID=QStringToQint32(sID);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if((list[0].contains("STREAM")==true) && (list[1].contains("SEND")==true)){
|
else if((list[0].contains("STREAM")==true) && (list[1].contains("SEND")==true)){
|
||||||
|
@ -126,7 +136,8 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
|
|
||||||
//get ID
|
//get ID
|
||||||
QStringList temp=list[2].split("=");
|
QStringList temp=list[2].split("=");
|
||||||
t.Id=temp[1];
|
QString sID=temp[1];
|
||||||
|
t.ID=QStringToQint32(sID);
|
||||||
|
|
||||||
//Get Result
|
//Get Result
|
||||||
if(list[3].contains("RESULT=OK",Qt::CaseInsensitive))t.result=OK;
|
if(list[3].contains("RESULT=OK",Qt::CaseInsensitive))t.result=OK;
|
||||||
|
@ -156,7 +167,8 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
|
|
||||||
//Get ID
|
//Get ID
|
||||||
QStringList temp=list[3].split("=");
|
QStringList temp=list[3].split("=");
|
||||||
t.Id=temp[1];
|
QString sID=temp[1];
|
||||||
|
t.ID=QStringToQint32(sID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -172,7 +184,9 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
|
|
||||||
//Get ID
|
//Get ID
|
||||||
QStringList temp=list[2].split("=");
|
QStringList temp=list[2].split("=");
|
||||||
t.Id=temp[1];
|
QString sID=temp[1];
|
||||||
|
|
||||||
|
t.ID=QStringToQint32(sID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,3 +230,22 @@ const SAM_MESSAGE I2PSamMessageAnalyser::Analyse(QString Message)
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint32 I2PSamMessageAnalyser::QStringToQint32(QString value)
|
||||||
|
{
|
||||||
|
bool OK=false;
|
||||||
|
qint32 iValue =value.toInt ( &OK,10 );
|
||||||
|
|
||||||
|
if(OK==false)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
|
msgBox.setText("I2PSamMessageAnalyser");
|
||||||
|
msgBox.setInformativeText("cant parse value: "+value );
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
msgBox.exec();
|
||||||
|
}
|
||||||
|
return iValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ struct SAM_MESSAGE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString Message;
|
QString Message;
|
||||||
QString Id;
|
qint32 ID;
|
||||||
QString Destination;
|
QString Destination;
|
||||||
QString Size;
|
QString Size;
|
||||||
QString Name;
|
QString Name;
|
||||||
|
@ -89,5 +89,8 @@ class I2PSamMessageAnalyser: public QObject
|
||||||
public:
|
public:
|
||||||
I2PSamMessageAnalyser();
|
I2PSamMessageAnalyser();
|
||||||
const SAM_MESSAGE Analyse(QString Message);
|
const SAM_MESSAGE Analyse(QString Message);
|
||||||
|
|
||||||
|
private:
|
||||||
|
qint32 QStringToQint32(QString value);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cPacketManager::cPacketManager ( QString ID )
|
cPacketManager::cPacketManager ( qint32 ID )
|
||||||
:ID ( ID )
|
:ID ( ID )
|
||||||
{
|
{
|
||||||
Data.clear();
|
Data.clear();
|
||||||
|
@ -32,10 +32,10 @@ cPacketManager::~cPacketManager()
|
||||||
}
|
}
|
||||||
void cPacketManager::operator << ( QByteArray t )
|
void cPacketManager::operator << ( QByteArray t )
|
||||||
{
|
{
|
||||||
Data.push_back ( t );
|
Data.append ( t );
|
||||||
checkifOnePacketIsComplead();
|
checkifOnePacketIsComplead();
|
||||||
}
|
}
|
||||||
const QString cPacketManager::getID()
|
qint32 cPacketManager::getID()
|
||||||
{
|
{
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ void cPacketManager::checkifOnePacketIsComplead()
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setIcon(QMessageBox::Warning);
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
msgBox.setText("cPacketManager");
|
msgBox.setText("cPacketManager ("+QString(ID)+")");
|
||||||
msgBox.setInformativeText("cant parse PacketLength\nHexValue: "+sPacketLength );
|
msgBox.setInformativeText("cant parse PacketLength\nHexValue: "+sPacketLength );
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
@ -67,5 +67,6 @@ void cPacketManager::checkifOnePacketIsComplead()
|
||||||
checkifOnePacketIsComplead();
|
checkifOnePacketIsComplead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,17 @@ class cPacketManager :public QObject
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cPacketManager() {}
|
//cPacketManager() {}
|
||||||
cPacketManager ( QString ID );
|
cPacketManager ( qint32 ID );
|
||||||
~cPacketManager();
|
~cPacketManager();
|
||||||
void operator << ( QByteArray t );
|
void operator << ( QByteArray t );
|
||||||
const QString getID();
|
qint32 getID();
|
||||||
|
|
||||||
void checkifOnePacketIsComplead();
|
void checkifOnePacketIsComplead();
|
||||||
signals:
|
signals:
|
||||||
void aPacketIsComplead ( const QString ID,const QByteArray CurrentPacket );
|
void aPacketIsComplead ( const qint32 ID,const QByteArray CurrentPacket );
|
||||||
private:
|
private:
|
||||||
const QString ID;
|
const qint32 ID;
|
||||||
QByteArray Data;
|
QByteArray Data;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -28,12 +28,12 @@ cProtocol::cProtocol(cCore * Core){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cProtocol::newConnectionChat(const QString ID){
|
void cProtocol::newConnectionChat(const qint32 ID){
|
||||||
using namespace Protocol_Info;
|
using namespace Protocol_Info;
|
||||||
//send the ChatSystem\tProtocolVersion
|
//send the ChatSystem\tProtocolVersion
|
||||||
Core->StreamSendData(ID,FIRSTPAKETCHAT);
|
Core->StreamSendData(ID,FIRSTPAKETCHAT);
|
||||||
}
|
}
|
||||||
void cProtocol::inputKnown(const QString ID, const QByteArray Data){
|
void cProtocol::inputKnown(const qint32 ID, const QByteArray Data){
|
||||||
using namespace Protocol_Info;
|
using namespace Protocol_Info;
|
||||||
|
|
||||||
if(Data.length()<4)
|
if(Data.length()<4)
|
||||||
|
@ -84,13 +84,14 @@ using namespace Protocol_Info;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox* msgBox= new QMessageBox(NULL);
|
||||||
msgBox.setIcon(QMessageBox::Warning);
|
msgBox->setIcon(QMessageBox::Warning);
|
||||||
msgBox.setText("cProtocol(inputKnown)");
|
msgBox->setText("cProtocol(inputKnown)");
|
||||||
msgBox.setInformativeText("Unknown USERSTATE");
|
msgBox->setInformativeText("Unknown USERSTATE");
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox->setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.exec();
|
msgBox->setWindowModality(Qt::NonModal);
|
||||||
|
msgBox->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ using namespace Protocol_Info;
|
||||||
//end Messages
|
//end Messages
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray cProtocol::inputUnknown(const QString ID, const QByteArray Data){
|
QByteArray cProtocol::inputUnknown(const qint32 ID, const QByteArray Data){
|
||||||
using namespace Protocol_Info;
|
using namespace Protocol_Info;
|
||||||
|
|
||||||
if(Core->isThisIDunknown(ID)==true){
|
if(Core->isThisIDunknown(ID)==true){
|
||||||
|
@ -181,26 +182,14 @@ using namespace Protocol_Info;
|
||||||
|
|
||||||
//dont send the firstpacket if you have connected someone
|
//dont send the firstpacket if you have connected someone
|
||||||
//(the firstpacket is sended from core::StreamStatusRecived)
|
//(the firstpacket is sended from core::StreamStatusRecived)
|
||||||
bool OK=false;
|
|
||||||
int IDNumber =ID.toInt ( &OK,16 );
|
|
||||||
if(OK==false)
|
|
||||||
{
|
|
||||||
QMessageBox msgBox;
|
|
||||||
msgBox.setIcon(QMessageBox::Critical);
|
|
||||||
msgBox.setText("cProtocol(inputUnknown)");
|
|
||||||
msgBox.setInformativeText("cant parse StreamID\nHexValue: "+ID );
|
|
||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
|
||||||
msgBox.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(IDNumber<0)
|
if(ID < 0)
|
||||||
newConnectionChat(ID);//someone connect you
|
newConnectionChat(ID);//someone connect you
|
||||||
|
|
||||||
Core->removeUnknownIDCreateUserIfNeeded(ID,version);
|
Core->removeUnknownIDCreateUserIfNeeded(ID,version);
|
||||||
//remove Firstpacket
|
//remove Firstpacket
|
||||||
QByteArray Data2=Data;
|
QByteArray Data2=Data;
|
||||||
Data2.remove(0,Data.indexOf("\n")+1);
|
Data2=Data2.remove(0,Data.indexOf("\n")+1);
|
||||||
|
|
||||||
return Data2;
|
return Data2;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +228,7 @@ using namespace Protocol_Info;
|
||||||
return Data;
|
return Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cProtocol::send(const COMMANDS_TAGS TAG,const QString ID){
|
void cProtocol::send(const COMMANDS_TAGS TAG,const qint32 ID){
|
||||||
using namespace Protocol_Info;
|
using namespace Protocol_Info;
|
||||||
QString ProtocolInfoTag;
|
QString ProtocolInfoTag;
|
||||||
QString Data="";
|
QString Data="";
|
||||||
|
@ -275,7 +264,7 @@ void cProtocol::send(const COMMANDS_TAGS TAG,const QString ID){
|
||||||
Core->StreamSendData(ID,Data);
|
Core->StreamSendData(ID,Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cProtocol::send(const MESSAGES_TAGS TAG,const QString ID,QString Data){
|
void cProtocol::send(const MESSAGES_TAGS TAG,const qint32 ID,QString Data){
|
||||||
QString ProtocolInfoTag;
|
QString ProtocolInfoTag;
|
||||||
|
|
||||||
switch(TAG)
|
switch(TAG)
|
||||||
|
|
|
@ -77,11 +77,11 @@ public:
|
||||||
cProtocol(cCore* Core);
|
cProtocol(cCore* Core);
|
||||||
QString get_ProtocolVersion(){return PROTOCOLVERSION;};
|
QString get_ProtocolVersion(){return PROTOCOLVERSION;};
|
||||||
public slots:
|
public slots:
|
||||||
QByteArray inputUnknown(const QString ID,const QByteArray Data);
|
QByteArray inputUnknown(const qint32 ID,const QByteArray Data);
|
||||||
void inputKnown(const QString ID, const QByteArray Data);
|
void inputKnown(const qint32 ID, const QByteArray Data);
|
||||||
void send(const MESSAGES_TAGS TAG,const QString ID,QString Data);
|
void send(const MESSAGES_TAGS TAG,const qint32 ID,QString Data);
|
||||||
void send(const COMMANDS_TAGS TAG,const QString ID);
|
void send(const COMMANDS_TAGS TAG,const qint32 ID);
|
||||||
void newConnectionChat(const QString ID);
|
void newConnectionChat(const qint32 ID);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void eventUserChanged();//also used for newchatMessage
|
void eventUserChanged();//also used for newchatMessage
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by normal *
|
||||||
|
* normal@Desktop2 *
|
||||||
|
* *
|
||||||
|
* 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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
#include "SoundManager.h"
|
||||||
|
|
||||||
|
cSoundManager::cSoundManager()
|
||||||
|
{
|
||||||
|
isMute=false;
|
||||||
|
reInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cSoundManager::doMute(bool t)
|
||||||
|
{
|
||||||
|
isMute=t;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cSoundManager::event_User_go_Online()
|
||||||
|
{
|
||||||
|
if(isMute==true) return;
|
||||||
|
|
||||||
|
if(enable_eventUser_go_Online)
|
||||||
|
QSound::play(SoundFileUser_go_Online);
|
||||||
|
}
|
||||||
|
void cSoundManager::event_User_go_Offline()
|
||||||
|
{
|
||||||
|
if(isMute==true) return;
|
||||||
|
if(enable_eventUser_go_Offline)
|
||||||
|
QSound::play(SoundFileUser_go_Offline);
|
||||||
|
}
|
||||||
|
void cSoundManager::event_FileSend_Finished()
|
||||||
|
{
|
||||||
|
if(isMute==true) return;
|
||||||
|
if(enable_eventFileSend_Finished)
|
||||||
|
QSound::play(SoundFileFileSend_Finished);
|
||||||
|
}
|
||||||
|
void cSoundManager::event_FileRecive_Incoming()
|
||||||
|
{
|
||||||
|
if(isMute==true) return;
|
||||||
|
if(enable_eventFileRecive_Incoming)
|
||||||
|
QSound::play(SoundFileFileRecive_Incoming);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cSoundManager::event_FileRecive_Finished()
|
||||||
|
{
|
||||||
|
if(isMute==true) return;
|
||||||
|
if(enable_eventFileRecive_Finished)
|
||||||
|
QSound::play(SoundFileFileRecive_Finished);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cSoundManager::event_NewChatMessage()
|
||||||
|
{
|
||||||
|
if(isMute==true) return;
|
||||||
|
if(enable_eventNewChatMessage)
|
||||||
|
{
|
||||||
|
QSound::play(SoundFileNewChatMessage);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cSoundManager::reInit()
|
||||||
|
{
|
||||||
|
QSettings* settings= new QSettings(QApplication::applicationDirPath()+"/application.ini",QSettings::IniFormat);
|
||||||
|
settings->beginGroup("Sound");
|
||||||
|
settings->beginGroup("Enable");
|
||||||
|
enable_eventUser_go_Online=settings->value("User_go_Online",false).toBool();
|
||||||
|
enable_eventUser_go_Offline=settings->value("User_go_Offline",false).toBool();
|
||||||
|
enable_eventFileSend_Finished=settings->value("FileSend_Finished",false).toBool();
|
||||||
|
enable_eventFileRecive_Incoming=settings->value("FileRecive_Incoming",false).toBool();
|
||||||
|
enable_eventFileRecive_Finished=settings->value("FileRecive_Finished",false).toBool();
|
||||||
|
enable_eventNewChatMessage=settings->value("NewChatMessage",false).toBool();
|
||||||
|
settings->endGroup();
|
||||||
|
|
||||||
|
settings->beginGroup("SoundFilePath");
|
||||||
|
SoundFileUser_go_Online=settings->value("User_go_Online","").toString();
|
||||||
|
SoundFileUser_go_Offline=settings->value("User_go_Offline","").toString();
|
||||||
|
SoundFileFileSend_Finished=settings->value("FileSend_Finished","").toString();
|
||||||
|
SoundFileFileRecive_Incoming=settings->value("FileRecive_Incoming","").toString();
|
||||||
|
SoundFileFileRecive_Finished=settings->value("FileRecive_Finished","").toString();
|
||||||
|
SoundFileNewChatMessage=settings->value("NewChatMessage","").toString();
|
||||||
|
settings->endGroup();
|
||||||
|
settings->endGroup();
|
||||||
|
delete settings;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2008 by normal *
|
||||||
|
* normal@Desktop2 *
|
||||||
|
* *
|
||||||
|
* 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 2 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, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
#ifndef SOUND_MANAGER_H
|
||||||
|
#define SOUND_MANAGER_H
|
||||||
|
|
||||||
|
#include <QSound>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
|
||||||
|
class cSoundManager :public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
cSoundManager();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void doMute(bool t);
|
||||||
|
void event_User_go_Online();
|
||||||
|
void event_User_go_Offline();
|
||||||
|
void event_FileSend_Finished();
|
||||||
|
void event_FileRecive_Incoming();
|
||||||
|
void event_FileRecive_Finished();
|
||||||
|
void event_NewChatMessage();
|
||||||
|
void reInit();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isMute;
|
||||||
|
QString SoundFileUser_go_Online;
|
||||||
|
QString SoundFileUser_go_Offline;
|
||||||
|
QString SoundFileFileSend_Finished;
|
||||||
|
QString SoundFileFileRecive_Incoming;
|
||||||
|
QString SoundFileFileRecive_Finished;
|
||||||
|
QString SoundFileNewChatMessage;
|
||||||
|
|
||||||
|
bool enable_eventUser_go_Online;
|
||||||
|
bool enable_eventUser_go_Offline;
|
||||||
|
bool enable_eventFileSend_Finished;
|
||||||
|
bool enable_eventFileRecive_Incoming;
|
||||||
|
bool enable_eventFileRecive_Finished;
|
||||||
|
bool enable_eventNewChatMessage;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -23,14 +23,12 @@
|
||||||
cUser::cUser( cProtocol* Protocol,
|
cUser::cUser( cProtocol* Protocol,
|
||||||
QString Name,
|
QString Name,
|
||||||
QString I2PDestination,
|
QString I2PDestination,
|
||||||
QString I2PStream_ID,
|
qint32 I2PStream_ID
|
||||||
QString TorDestination
|
):I2PDestination(I2PDestination)
|
||||||
):I2PDestination(I2PDestination),TorDestination(TorDestination)
|
|
||||||
{
|
{
|
||||||
this->Protocol=Protocol;
|
this->Protocol=Protocol;
|
||||||
this->Name=Name;
|
this->Name=Name;
|
||||||
this->ReadyToSend=true;
|
this->ReadyToSend=true;
|
||||||
this->TORStream_ID="";
|
|
||||||
this->I2PStream_ID=I2PStream_ID;
|
this->I2PStream_ID=I2PStream_ID;
|
||||||
this->ConnectionStatus=OFFLINE;
|
this->ConnectionStatus=OFFLINE;
|
||||||
this->HaveAllreadyOneChatWindow=false;
|
this->HaveAllreadyOneChatWindow=false;
|
||||||
|
@ -38,6 +36,9 @@ cUser::cUser( cProtocol* Protocol,
|
||||||
this->ClientName="";
|
this->ClientName="";
|
||||||
this->ClientVersion="";
|
this->ClientVersion="";
|
||||||
this->CurrentOnlineState=USEROFFLINE;
|
this->CurrentOnlineState=USEROFFLINE;
|
||||||
|
|
||||||
|
this->textColor=Qt::black;
|
||||||
|
this->textFont=QFont("Comic Sans MS", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString cUser::get_Name()const{
|
const QString cUser::get_Name()const{
|
||||||
|
@ -46,15 +47,9 @@ const QString cUser::get_Name()const{
|
||||||
const QString cUser::get_I2PDestination()const{
|
const QString cUser::get_I2PDestination()const{
|
||||||
return this->I2PDestination;
|
return this->I2PDestination;
|
||||||
}
|
}
|
||||||
const QString cUser::get_I2PStreamID()const{
|
qint32 cUser::get_I2PStreamID()const{
|
||||||
return this->I2PStream_ID;
|
return this->I2PStream_ID;
|
||||||
}
|
}
|
||||||
const QString cUser::get_TORDestination()const{
|
|
||||||
return this->TorDestination;
|
|
||||||
}
|
|
||||||
const QString cUser::get_TORStream_ID()const{
|
|
||||||
return this->TORStream_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
CONNECTIONTOUSER cUser::get_ConnectionStatus()const{
|
CONNECTIONTOUSER cUser::get_ConnectionStatus()const{
|
||||||
return this->ConnectionStatus;
|
return this->ConnectionStatus;
|
||||||
|
@ -64,24 +59,27 @@ void cUser::set_Name(QString newName){
|
||||||
this->Name=newName;
|
this->Name=newName;
|
||||||
}
|
}
|
||||||
void cUser::set_ConnectionStatus(CONNECTIONTOUSER Status){
|
void cUser::set_ConnectionStatus(CONNECTIONTOUSER Status){
|
||||||
|
|
||||||
this->ConnectionStatus=Status;
|
this->ConnectionStatus=Status;
|
||||||
|
|
||||||
if(Status==ONLINE){
|
if(Status==ONLINE){
|
||||||
|
this->ConnectionStatus=Status;
|
||||||
//get some Infos from the CHATSYSTEM - client
|
//get some Infos from the CHATSYSTEM - client
|
||||||
Protocol->send(GET_CLIENTNAME,I2PStream_ID);
|
Protocol->send(GET_CLIENTNAME,I2PStream_ID);
|
||||||
Protocol->send(GET_CLIENTVERSION,I2PStream_ID);
|
Protocol->send(GET_CLIENTVERSION,I2PStream_ID);
|
||||||
Protocol->send(GET_USER_ONLINESTATUS,I2PStream_ID);
|
Protocol->send(GET_USER_ONLINESTATUS,I2PStream_ID);
|
||||||
|
//emit connectionOnline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(Status==OFFLINE ||Status==ERROR)
|
if(Status==OFFLINE ||Status==ERROR)
|
||||||
{
|
{
|
||||||
I2PStream_ID="";
|
I2PStream_ID=0;
|
||||||
this->CurrentOnlineState=USEROFFLINE;
|
this->CurrentOnlineState=USEROFFLINE;
|
||||||
|
this->ConnectionStatus=Status;
|
||||||
}
|
}
|
||||||
//emit OnlineStateChanged();
|
|
||||||
}
|
}
|
||||||
void cUser::set_I2PStreamID(QString ID){
|
void cUser::set_I2PStreamID(qint32 ID){
|
||||||
this->I2PStream_ID=ID;
|
this->I2PStream_ID=ID;
|
||||||
}
|
}
|
||||||
void cUser::set_ReadyToSend(bool b){
|
void cUser::set_ReadyToSend(bool b){
|
||||||
|
@ -95,9 +93,10 @@ const QString cUser::get_ProtocolVersion()const{
|
||||||
}
|
}
|
||||||
|
|
||||||
void cUser::IncomingNewChatMessage(QString newMessage){
|
void cUser::IncomingNewChatMessage(QString newMessage){
|
||||||
this->Messages.push_back(Name+": "+newMessage+"<br>");
|
this->Messages.push_back(Name+"("+ QTime::currentTime().toString("hh:mm:ss") +"): "+newMessage+"<br>");
|
||||||
this->newUnreadMessages=true;
|
this->newUnreadMessages=true;
|
||||||
emit newMessageRecived();
|
emit newMessageRecived();
|
||||||
|
emit newIncomingMessageRecived();
|
||||||
}
|
}
|
||||||
void cUser::sendChatMessage(QString Message){
|
void cUser::sendChatMessage(QString Message){
|
||||||
using namespace PROTOCOL_TAGS;
|
using namespace PROTOCOL_TAGS;
|
||||||
|
@ -108,13 +107,13 @@ void cUser::sendChatMessage(QString Message){
|
||||||
CurrentOnlineState != USERINVISIBLE
|
CurrentOnlineState != USERINVISIBLE
|
||||||
){
|
){
|
||||||
Protocol->send(CHATMESSAGE,I2PStream_ID,Message);
|
Protocol->send(CHATMESSAGE,I2PStream_ID,Message);
|
||||||
this->Messages.push_back("Me: "+Message+"<br>");
|
this->Messages.push_back("Me("+QTime::currentTime().toString("hh:mm:ss") +"): "+Message+"<br>");
|
||||||
//this->Messages.push_back(Message);
|
//this->Messages.push_back(Message);
|
||||||
emit newMessageRecived();
|
emit newMessageRecived();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
this->Messages.push_back("[SYSTEM]: Sending the Message when the user come online<br>When you close the client the Message is lost<br>");
|
this->Messages.push_back("[SYSTEM]("+QTime::currentTime().toString("hh:mm:ss") +"): Sending the Message when the user come online<br>When you close the client the Message is lost<br>");
|
||||||
|
|
||||||
unsendedMessages.push_back(Message);
|
unsendedMessages.push_back(Message);
|
||||||
emit newMessageRecived();
|
emit newMessageRecived();
|
||||||
|
@ -141,7 +140,7 @@ void cUser::sendAllunsendedMessages(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this->Messages.push_back("[SYSTEM]: All unsended Messages where sended<br><br>");
|
this->Messages.push_back("[SYSTEM]("+QTime::currentTime().toString("hh:mm:ss")+"): All unsended Messages were sended<br><br>");
|
||||||
unsendedMessages.clear();
|
unsendedMessages.clear();
|
||||||
this->newUnreadMessages=true;
|
this->newUnreadMessages=true;
|
||||||
emit newMessageRecived();
|
emit newMessageRecived();
|
||||||
|
@ -161,6 +160,7 @@ void cUser::set_ClientName(QString Name)
|
||||||
ClientName=Name;
|
ClientName=Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const QString cUser::get_ClientVersion() const
|
const QString cUser::get_ClientVersion() const
|
||||||
{
|
{
|
||||||
return ClientVersion;
|
return ClientVersion;
|
||||||
|
@ -178,12 +178,47 @@ ONLINESTATE cUser::get_OnlineState() const
|
||||||
|
|
||||||
void cUser::set_OnlineState(const ONLINESTATE newState)
|
void cUser::set_OnlineState(const ONLINESTATE newState)
|
||||||
{
|
{
|
||||||
this->CurrentOnlineState=newState;
|
|
||||||
|
|
||||||
if( CurrentOnlineState!=USEROFFLINE &&
|
if(newState!=USEROFFLINE &&
|
||||||
CurrentOnlineState!=USERINVISIBLE){
|
newState!=USERINVISIBLE){
|
||||||
|
if(CurrentOnlineState==USEROFFLINE || CurrentOnlineState==USERINVISIBLE)
|
||||||
|
emit connectionOnline();
|
||||||
this->sendAllunsendedMessages();
|
this->sendAllunsendedMessages();
|
||||||
}
|
}
|
||||||
|
else if(newState==USEROFFLINE || newState==USERINVISIBLE){
|
||||||
|
if(newState!=CurrentOnlineState)
|
||||||
|
emit connectionOffline();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this->CurrentOnlineState=newState;
|
||||||
emit OnlineStateChanged();
|
emit OnlineStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor cUser::get_textColor()
|
||||||
|
{
|
||||||
|
return textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cUser::set_textColor(QColor textColor)
|
||||||
|
{
|
||||||
|
this->textColor=textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cUser::set_textFont(QFont textFont)
|
||||||
|
{
|
||||||
|
this->textFont=textFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFont cUser::get_textFont()
|
||||||
|
{
|
||||||
|
return textFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cUser::IncomingMessageFromSystem(QString newMessage)
|
||||||
|
{
|
||||||
|
this->Messages.push_back("[System]("+ QTime::currentTime().toString("hh:mm:ss") +"): "+newMessage+"<br>");
|
||||||
|
this->newUnreadMessages=true;
|
||||||
|
emit newMessageRecived();
|
||||||
|
emit newIncomingMessageRecived();
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
|
||||||
namespace User
|
namespace User
|
||||||
|
@ -54,18 +55,18 @@ class cUser: public QObject
|
||||||
cUser( cProtocol* Protocol,
|
cUser( cProtocol* Protocol,
|
||||||
QString Name,
|
QString Name,
|
||||||
QString I2PDestination,
|
QString I2PDestination,
|
||||||
QString I2PStream_ID,
|
qint32 I2PStream_ID
|
||||||
QString TorDestination
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const QString get_Name()const;
|
const QString get_Name()const;
|
||||||
const QString get_I2PDestination()const;
|
const QString get_I2PDestination()const;
|
||||||
const QString get_I2PStreamID()const;
|
qint32 get_I2PStreamID()const;
|
||||||
const QString get_TORDestination()const;
|
|
||||||
const QString get_TORStream_ID()const;
|
|
||||||
const QString get_ProtocolVersion()const;
|
const QString get_ProtocolVersion()const;
|
||||||
const QString get_ClientName()const;
|
const QString get_ClientName()const;
|
||||||
const QString get_ClientVersion()const;
|
const QString get_ClientVersion()const;
|
||||||
|
QColor get_textColor();
|
||||||
|
QFont get_textFont();
|
||||||
|
|
||||||
CONNECTIONTOUSER get_ConnectionStatus()const;
|
CONNECTIONTOUSER get_ConnectionStatus()const;
|
||||||
ONLINESTATE get_OnlineState()const;
|
ONLINESTATE get_OnlineState()const;
|
||||||
|
|
||||||
|
@ -76,13 +77,17 @@ class cUser: public QObject
|
||||||
void set_ConnectionStatus(CONNECTIONTOUSER Status);
|
void set_ConnectionStatus(CONNECTIONTOUSER Status);
|
||||||
void set_OnlineState(const ONLINESTATE newState);
|
void set_OnlineState(const ONLINESTATE newState);
|
||||||
void set_Name(QString newName);
|
void set_Name(QString newName);
|
||||||
void set_I2PStreamID(QString ID);
|
void set_I2PStreamID(qint32 ID);
|
||||||
void set_ReadyToSend(bool b);
|
void set_ReadyToSend(bool b);
|
||||||
void set_ProtocolVersion(QString Version);
|
void set_ProtocolVersion(QString Version);
|
||||||
void set_HaveAllreadyOneChatWindow(bool t);
|
void set_HaveAllreadyOneChatWindow(bool t);
|
||||||
void set_ClientName(QString Name);
|
void set_ClientName(QString Name);
|
||||||
void set_ClientVersion(QString Version);
|
void set_ClientVersion(QString Version);
|
||||||
void IncomingNewChatMessage(QString newMessage);
|
void IncomingNewChatMessage(QString newMessage);
|
||||||
|
void IncomingMessageFromSystem(QString newMessage);
|
||||||
|
|
||||||
|
void set_textColor(QColor textColor);
|
||||||
|
void set_textFont(QFont textFont);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendChatMessage(QString Message);
|
void sendChatMessage(QString Message);
|
||||||
|
@ -90,17 +95,18 @@ class cUser: public QObject
|
||||||
signals:
|
signals:
|
||||||
void OnlineStateChanged();
|
void OnlineStateChanged();
|
||||||
void newMessageRecived();
|
void newMessageRecived();
|
||||||
|
void newIncomingMessageRecived();
|
||||||
|
void connectionOnline();
|
||||||
|
void connectionOffline();
|
||||||
private:
|
private:
|
||||||
bool HaveAllreadyOneChatWindow;
|
bool HaveAllreadyOneChatWindow;
|
||||||
bool newUnreadMessages;
|
bool newUnreadMessages;
|
||||||
void sendAllunsendedMessages();
|
void sendAllunsendedMessages();
|
||||||
|
|
||||||
const QString I2PDestination;
|
const QString I2PDestination;
|
||||||
const QString TorDestination;
|
|
||||||
|
|
||||||
QString Name;
|
QString Name;
|
||||||
QString I2PStream_ID;
|
qint32 I2PStream_ID;
|
||||||
QString TORStream_ID;
|
|
||||||
|
|
||||||
bool ReadyToSend;
|
bool ReadyToSend;
|
||||||
|
|
||||||
|
@ -112,6 +118,10 @@ class cUser: public QObject
|
||||||
QStringList Messages;
|
QStringList Messages;
|
||||||
QStringList unsendedMessages;
|
QStringList unsendedMessages;
|
||||||
cProtocol* Protocol;
|
cProtocol* Protocol;
|
||||||
|
|
||||||
|
//Settings for the chatwindow
|
||||||
|
QColor textColor;
|
||||||
|
QFont textFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue