Ejemplo n.º 1
0
GroupInviteForm::GroupInviteForm()
{
    QVBoxLayout* layout = new QVBoxLayout(this);
    createButton = new QPushButton(this);
    connect(createButton, &QPushButton::released, [this]()
    {
        emit groupCreate(TOX_GROUPCHAT_TYPE_AV);
    });

    inviteBox = new QGroupBox(this);
    inviteLayout = new QVBoxLayout(inviteBox);

    scroll = new QScrollArea(this);

    QWidget* innerWidget = new QWidget(scroll);
    innerWidget->setLayout(new QVBoxLayout());
    innerWidget->layout()->setAlignment(Qt::AlignTop);
    scroll->setWidget(innerWidget);
    scroll->setWidgetResizable(true);

    inviteLayout->addWidget(scroll);

    layout->addWidget(createButton);
    layout->addWidget(inviteBox);

    QFont bold;
    bold.setBold(true);

    headLabel = new QLabel(this);
    headLabel->setFont(bold);
    headWidget = new QWidget(this);
    QHBoxLayout* headLayout = new QHBoxLayout(headWidget);
    headLayout->addWidget(headLabel);

    retranslateUi();
    Translator::registerHandler(std::bind(&GroupInviteForm::retranslateUi, this), this);
}
Ejemplo n.º 2
0
void mainChat(){
	string str,temp;
	int status;
	status=1; //0 if logout

	header2();
	while(status==1){
		cout << endl;
		kunci.lock();
		messageNotifier();
		cout << username << "> ";
		getline(cin >> ws,str);
		kunci.unlock();
		//logout
		if(str.compare("logout")==0){
			status=0;
			logout();
		}
		//message
		else if(str.substr(0,8).compare("message ")==0){
			temp = str.substr(8);
			sendMessage(temp);
		}
		//create group
		else if(str.substr(0,7).compare("create ")==0){
			temp = str.substr(7);
			groupCreate(temp);
		}
		//join group
		else if(str.substr(0,5).compare("join ")==0){
			temp = str.substr(5);
			groupJoin(temp);
		}
		//leave group
		else if(str.substr(0,6).compare("leave ")==0){
			temp = str.substr(6);
			groupLeave(temp);
		}
		//show chat history
		else if(str.substr(0,5).compare("show ")==0){
			temp = str.substr(5);
			readChat2(temp);
			deleteNotifSender(temp);
			//moveToBottom(..pathnya dimana..);
		}
		else if(str.compare("help")==0){
			header2();
		}
		//exit
		else if(str.compare("exit")==0){
			status=0;
			active = false;
			closeConnection();
			exit(0);
		}
		//empty input
		else if(str.compare("")==0){
			//do nothing
		}
		//wrong input
		else{
			cout <<"Unknown input, please type \'help\' for help." <<endl;
		}
	}
}