mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-18 19:31:37 -05:00
feature: since now smilie widget will appear near smile button (as it usually is in all messengers). Both in group and private chats
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1073 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4451c2690f
commit
32c12542dc
@ -866,7 +866,10 @@ void PeersDialog::toggleSendItem( QTreeWidgetItem *item, int col )
|
||||
return;
|
||||
}
|
||||
|
||||
PopupChatDialog *PeersDialog::getPrivateChat(std::string id, std::string name, uint chatflags)
|
||||
//============================================================================
|
||||
|
||||
PopupChatDialog *
|
||||
PeersDialog::getPrivateChat(std::string id, std::string name, uint chatflags)
|
||||
{
|
||||
/* see if it exists already */
|
||||
PopupChatDialog *popupchatdialog = NULL;
|
||||
@ -935,6 +938,7 @@ PopupChatDialog *PeersDialog::getPrivateChat(std::string id, std::string name, u
|
||||
return popupchatdialog;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
void PeersDialog::clearOldChats()
|
||||
{
|
||||
@ -1074,14 +1078,46 @@ void PeersDialog::loadEmoticonsgroupchat()
|
||||
void PeersDialog::smileyWidgetgroupchat()
|
||||
{
|
||||
qDebug("MainWindow::smileyWidget()");
|
||||
QWidget *smWidget = new QWidget;
|
||||
QWidget *smWidget = new QWidget(this , Qt::Popup );
|
||||
smWidget->setWindowTitle("Emoticons");
|
||||
smWidget->setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||
smWidget->setFixedSize(256,256);
|
||||
//smWidget->setFixedSize(256,256);
|
||||
|
||||
smWidget->setBaseSize( 4*24, (smileys.size()/4)*24 );
|
||||
|
||||
//Warning: this part of code was taken from kadu instant messenger;
|
||||
// It was EmoticonSelector::alignTo(QWidget* w) function there
|
||||
// comments are Polish, I dont' know how does it work...
|
||||
// oblicz pozycj<63> widgetu do kt<6B>rego r<>wnamy
|
||||
QWidget* w = ui.emoticonBtn;
|
||||
QPoint w_pos = w->mapToGlobal(QPoint(0,0));
|
||||
// oblicz rozmiar selektora
|
||||
QSize e_size = smWidget->sizeHint();
|
||||
// oblicz rozmiar pulpitu
|
||||
QSize s_size = QApplication::desktop()->size();
|
||||
// oblicz dystanse od widgetu do lewego brzegu i do prawego
|
||||
int l_dist = w_pos.x();
|
||||
int r_dist = s_size.width() - (w_pos.x() + w->width());
|
||||
// oblicz pozycj<63> w zale<6C>no<6E>ci od tego czy po lewej stronie
|
||||
// jest wi<77>cej miejsca czy po prawej
|
||||
int x;
|
||||
if (l_dist >= r_dist)
|
||||
x = w_pos.x() - e_size.width();
|
||||
else
|
||||
x = w_pos.x() + w->width();
|
||||
// oblicz pozycj<63> y - centrujemy w pionie
|
||||
int y = w_pos.y() + w->height()/2 - e_size.height()/2;
|
||||
// je<6A>li wychodzi poza doln<6C> kraw<61>d<EFBFBD> to r<>wnamy do niej
|
||||
if (y + e_size.height() > s_size.height())
|
||||
y = s_size.height() - e_size.height();
|
||||
// je<6A>li wychodzi poza g<>rn<72> kraw<61>d<EFBFBD> to r<>wnamy do niej
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
// ustawiamy selektor na wyliczonej pozycji
|
||||
smWidget->move(x, y);
|
||||
|
||||
|
||||
int x = 0, y = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
QHashIterator<QString, QString> i(smileys);
|
||||
while(i.hasNext())
|
||||
@ -1100,6 +1136,7 @@ void PeersDialog::smileyWidgetgroupchat()
|
||||
y++;
|
||||
}
|
||||
connect(smButton, SIGNAL(clicked()), this, SLOT(addSmileys()));
|
||||
connect(smButton, SIGNAL(clicked()), smWidget, SLOT(close()));
|
||||
}
|
||||
|
||||
smWidget->show();
|
||||
|
@ -456,18 +456,51 @@ void PopupChatDialog::loadEmoticons()
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
void PopupChatDialog::smileyWidget()
|
||||
{
|
||||
qDebug("MainWindow::smileyWidget()");
|
||||
QWidget *smWidget = new QWidget;
|
||||
QWidget *smWidget = new QWidget(this , Qt::Popup);
|
||||
smWidget->setAttribute( Qt::WA_DeleteOnClose);
|
||||
smWidget->setWindowTitle("Emoticons");
|
||||
smWidget->setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||
smWidget->setFixedSize(256,256);
|
||||
smWidget->setBaseSize( 4*24, (smileys.size()/4)*24 );
|
||||
|
||||
//Warning: this part of code was taken from kadu instant messenger;
|
||||
// It was EmoticonSelector::alignTo(QWidget* w) function there
|
||||
// comments are Polish, I dont' know how does it work...
|
||||
// oblicz pozycj<63> widgetu do kt<6B>rego r<>wnamy
|
||||
QWidget* w = ui.emoteiconButton;
|
||||
QPoint w_pos = w->mapToGlobal(QPoint(0,0));
|
||||
// oblicz rozmiar selektora
|
||||
QSize e_size = smWidget->sizeHint();
|
||||
// oblicz rozmiar pulpitu
|
||||
QSize s_size = QApplication::desktop()->size();
|
||||
// oblicz dystanse od widgetu do lewego brzegu i do prawego
|
||||
int l_dist = w_pos.x();
|
||||
int r_dist = s_size.width() - (w_pos.x() + w->width());
|
||||
// oblicz pozycj<63> w zale<6C>no<6E>ci od tego czy po lewej stronie
|
||||
// jest wi<77>cej miejsca czy po prawej
|
||||
int x;
|
||||
if (l_dist >= r_dist)
|
||||
x = w_pos.x() - e_size.width();
|
||||
else
|
||||
x = w_pos.x() + w->width();
|
||||
// oblicz pozycj<63> y - centrujemy w pionie
|
||||
int y = w_pos.y() + w->height()/2 - e_size.height()/2;
|
||||
// je<6A>li wychodzi poza doln<6C> kraw<61>d<EFBFBD> to r<>wnamy do niej
|
||||
if (y + e_size.height() > s_size.height())
|
||||
y = s_size.height() - e_size.height();
|
||||
// je<6A>li wychodzi poza g<>rn<72> kraw<61>d<EFBFBD> to r<>wnamy do niej
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
// ustawiamy selektor na wyliczonej pozycji
|
||||
smWidget->move(x, y);
|
||||
|
||||
|
||||
|
||||
int x = 0, y = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
QHashIterator<QString, QString> i(smileys);
|
||||
while(i.hasNext())
|
||||
@ -485,16 +518,21 @@ void PopupChatDialog::smileyWidget()
|
||||
y++;
|
||||
}
|
||||
connect(smButton, SIGNAL(clicked()), this, SLOT(addSmiley()));
|
||||
connect(smButton, SIGNAL(clicked()), smWidget, SLOT(close()));
|
||||
}
|
||||
|
||||
smWidget->show();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
void PopupChatDialog::addSmiley()
|
||||
{
|
||||
ui.chattextEdit->setText(ui.chattextEdit->toHtml() + qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
QString PopupChatDialog::loadEmptyStyle()
|
||||
{
|
||||
#ifdef CHAT_DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user