Exemple #1
0
 QWidget* MainPage::showIntroduceYourselfSuggestions(QWidget *parent, std::function<void()> addNewContactsRoutine)
 {
     if (!introduceYourselfSuggestions_)
     {
         introduceYourselfSuggestions_ = new IntroduceYourself(MyInfo()->aimId(), MyInfo()->friendlyName(), parent);
         introduceYourselfSuggestions_->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding);
         introduceYourselfSuggestions_->setStyleSheet("border: 20px solid red;");
     }
     return introduceYourselfSuggestions_;
 }
Exemple #2
0
    void MainPage::onFinishSelectMembers(bool _isAccept)
	{
		if (_isAccept)
		{
			auto selectedContacts = Logic::GetContactListModel()->GetCheckedContacts();
			Logic::GetContactListModel()->ClearChecked();

			QString chat_name = MyInfo()->friendlyName();
            if (chat_name.isEmpty())
                chat_name = MyInfo()->aimId();
			
            for (int i = 0; i < 2; ++i)
			{
				chat_name += ", " + selectedContacts[i].Get()->GetDisplayName();
			}

            QString result_chat_name;
			auto result = SelectContactsWidget::ChatNameEditor(chat_name, &result_chat_name, this, QT_TRANSLATE_NOOP("groupchat_pages","Create"));

            if (chat_name != result_chat_name)
                Ui::GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::groupchat_create_rename);

			if (result)
            {
                Ui::gui_coll_helper collection(Ui::GetDispatcher()->create_collection(), true);
				chat_name = result_chat_name.isEmpty() ? chat_name : result_chat_name;

				QStringList chat_members;
				for (const auto& contact : selectedContacts)
				{
					chat_members.push_back(contact.get_aimid());
				}

				collection.set_value_as_string("m_chat_name", chat_name.toUtf8().data(), chat_name.toUtf8().size());
				collection.set_value_as_string("m_chat_members", chat_members.join(";").toStdString());
				Ui::GetDispatcher()->post_message_to_core("add_chat", collection.get());
				contact_list_widget_->changeTab(Ui::CurrentTab::RECENTS);

				// QString chat_id = "*@chat.agent";
				// emit contactlListWidget_->itemSelected(chat_id);
			}
			else
			{
				clearSearchMembers();
			}
		}
	}
Exemple #3
0
 void MainPage::myInfo()
 {
     if (login_new_user_ && MyInfo()->friendlyName().isEmpty() && !get_gui_settings()->get_value(get_account_setting_name(settings_skip_intro_yourself).c_str(), false))
     {
         if (!recv_my_info_)
         {
             emit Utils::InterConnector::instance().showPlaceholder(Utils::PlaceholdersType::PlaceholdersType_SetExistanseOnIntroduceYourself);
             emit Utils::InterConnector::instance().showPlaceholder(Utils::PlaceholdersType::PlaceholdersType_IntroduceYourself);
         }
     }
     else
     {
         emit Utils::InterConnector::instance().showPlaceholder(Utils::PlaceholdersType::PlaceholdersType_SetExistanseOffIntroduceYourself);
     }
     recv_my_info_ = true;
 }
    void ContactAvatarWidget::postSetAvatarToCore(const QPixmap& _avatar)
    {
        auto byteArray = processImage(_avatar);

        core::coll_helper helper(GetDispatcher()->create_collection(), true);

        core::ifptr<core::istream> data_stream(helper->create_stream());
        if (byteArray.size())
            data_stream->write((const uint8_t*)byteArray.data(), (uint32_t)byteArray.size());
        helper.set_value_as_stream("avatar", data_stream.get());
        if (aimid_.isEmpty())
            helper.set_value_as_bool("chat", true);
        else if (aimid_ != MyInfo()->aimId())
            helper.set_value_as_string("aimid", aimid_.toStdString());

        seq_ = GetDispatcher()->post_message_to_core(qsl("set_avatar"), helper.get());
    }
Exemple #5
0
 void TrayIcon::menuStateInvisible()
 {
     if (!onlineAction_ ||
         !dndAction_ ||
         !invAction_)
     {
         return;
     }
     
     onlineAction_->setChecked(false);
     dndAction_->setChecked(false);
     
     Ui::gui_coll_helper collection(Ui::GetDispatcher()->create_collection(), true);
     collection.set_value_as_string("state", "invisible");
     collection.set_value_as_string("aimid", MyInfo()->aimId().toStdString());
     Ui::GetDispatcher()->post_message_to_core("set_state", collection.get());
 }
Exemple #6
0
    void TrayIcon::setMacIcon()
    {
#ifdef __APPLE__
        QString state = MyInfo()->state().toLower();
        
        if (state.length() == 0 ||
            state == "mobile")
        {
            state = "online";
        }
        
        bool unreads = Logic::GetRecentsModel()->totalUnreads() != 0;
        QString iconResource(QString(":resources/main_window/mac_tray/icq_osxlogo_%1_%2%3_100.png").
                             arg(state).arg(MacSupport::currentTheme()).
                             arg(unreads?"_unread":""));
        QIcon icon(Utils::parse_image_name(iconResource));
        Icon_->setIcon(icon);
#endif
    }
Exemple #7
0
 void TrayIcon::updateStatus()
 {
     if (!onlineAction_ ||
         !dndAction_ ||
         !invAction_)
     {
         return;
     }
     
     onlineAction_->setCheckable(true);
     dndAction_->setCheckable(true);
     invAction_->setCheckable(true);
     
     auto state = MyInfo()->state().toLower();
     if (state == "invisible")
     {
         onlineAction_->setChecked(false);
         dndAction_->setChecked(false);
         invAction_->setChecked(true);
     }
     else if (state == "dnd")
     {
         onlineAction_->setChecked(false);
         dndAction_->setChecked(true);
         invAction_->setChecked(false);
     }
     //        else if (state == "offline")
     //        {
     //            setStateOffline();
     //    }
     else
     {
         onlineAction_->setChecked(true);
         dndAction_->setChecked(false);
         invAction_->setChecked(false);
     }
 }
Exemple #8
0
 const std::string get_account_setting_name(const std::string& setting_name)
 {
     return MyInfo()->aimId().toUtf8().constData() + std::string("/") + setting_name;
 }