1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge branch 'pr2354'

This commit is contained in:
tux3 2015-10-07 17:20:40 +02:00
commit 3e75fd4dbc
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
7 changed files with 68 additions and 69 deletions

View File

@ -58,7 +58,7 @@ ChatMessage::Ptr ChatMessage::createChatMessage(const QString &sender, const QSt
{
case ACTION:
senderText = "*";
text = wrapDiv(QString("%1 %2").arg(sender, text), "action");
text = wrapDiv(QString("%1 %2").arg(sender.toHtmlEscaped(), text), "action");
msg->setAsAction();
break;
case ALERT:

View File

@ -858,6 +858,9 @@ QSplitter:handle{
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item>
@ -937,6 +940,9 @@ QSplitter:handle{
<pointsize>8</pointsize>
</font>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
</layout>

View File

@ -904,8 +904,18 @@ void ChatForm::doScreenshot()
}
void ChatForm::onScreenshotTaken(const QPixmap &pixmap) {
QTemporaryFile file(Settings::getInstance().getSettingsDirPath()+"screenshots"+QDir::separator()+"qTox-Screenshot-XXXXXXXX.png");
if (!file.open())
// use ~ISO 8601 for screenshot timestamp, considering FS limitations
// https://en.wikipedia.org/wiki/ISO_8601
// Windows has to be supported, thus filename can't have `:` in it :/
// Format should be: `qTox_Screenshot_yyyy-MM-dd HH-mm-ss.zzz.png`
QString filepath = QString("%1screenshots%2qTox_Screenshot_%3.png")
.arg(Settings::getInstance().getSettingsDirPath())
.arg(QDir::separator())
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd HH-mm-ss.zzz"));
QFile file(filepath);
if (!file.open(QFile::ReadWrite))
{
QMessageBox::warning(this,
tr("Failed to open temporary file", "Temporary file for screenshot"),
@ -913,8 +923,6 @@ void ChatForm::onScreenshotTaken(const QPixmap &pixmap) {
return;
}
file.setAutoRemove(false);
pixmap.save(&file, "PNG");
long long filesize = file.size();
@ -995,7 +1003,7 @@ void ChatForm::setFriendTyping(bool isTyping)
chatWidget->setTypingNotificationVisible(isTyping);
Text* text = static_cast<Text*>(chatWidget->getTypingNotification()->getContent(1));
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName()) + "</div>");
text->setText("<div class=typing>" + QString("%1 is typing").arg(f->getDisplayedName().toHtmlEscaped()) + "</div>");
}
void ChatForm::show(ContentLayout* contentLayout)
@ -1085,5 +1093,17 @@ void ChatForm::hideNetcam()
void ChatForm::retranslateUi()
{
QString volObjectName = volButton->objectName();
QString micObjectName = micButton->objectName();
loadHistoryAction->setText(tr("Load chat history..."));
if (volObjectName == QStringLiteral("green"))
volButton->setToolTip(tr("Mute call"));
else if (volObjectName == QStringLiteral("red"))
volButton->setToolTip(tr("Unmute call"));
if (micObjectName == QStringLiteral("green"))
micButton->setToolTip(tr("Mute microphone"));
else if (micObjectName == QStringLiteral("red"))
micButton->setToolTip(tr("Unmute microphone"));
}

View File

@ -254,7 +254,7 @@ QDate GenericChatForm::getLatestDate() const
void GenericChatForm::setName(const QString &newName)
{
nameLabel->setText(newName);
nameLabel->setToolTip(newName); // for overlength names
nameLabel->setToolTip(newName.toHtmlEscaped()); // for overlength names
}
void GenericChatForm::show(ContentLayout* contentLayout)
@ -294,17 +294,18 @@ void GenericChatForm::onChatContextMenuRequested(QPoint pos)
ChatMessage::Ptr GenericChatForm::addMessage(const ToxId& author, const QString &message, bool isAction,
const QDateTime &datetime, bool isSent)
{
QString authorStr = author.isActiveProfile() ? Core::getInstance()->getUsername() : resolveToxId(author);
bool authorIsActiveProfile = author.isActiveProfile();
QString authorStr = authorIsActiveProfile ? Core::getInstance()->getUsername() : resolveToxId(author);
ChatMessage::Ptr msg;
if (isAction)
{
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, false);
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::ACTION, authorIsActiveProfile);
previousId.clear();
}
else
{
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, author.isActiveProfile());
msg = ChatMessage::createChatMessage(authorStr, message, ChatMessage::NORMAL, authorIsActiveProfile);
if ( (author == previousId) && (prevMsgDateTime.secsTo(QDateTime::currentDateTime()) < getChatLog()->repNameAfter) )
msg->hideSender();
@ -512,12 +513,27 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
void GenericChatForm::retranslateUi()
{
QString callObjectName = callButton->objectName();
QString videoObjectName = videoButton->objectName();
if (callObjectName == QStringLiteral("green"))
callButton->setToolTip(tr("Start audio call"));
else if (callObjectName == QStringLiteral("yellow"))
callButton->setToolTip(tr("Accept audio call"));
else if (callObjectName == QStringLiteral("red"))
callButton->setToolTip(tr("End audio call"));
if (videoObjectName == QStringLiteral("green"))
videoButton->setToolTip(tr("Start video call"));
else if (videoObjectName == QStringLiteral("yellow"))
videoButton->setToolTip(tr("Accept video call"));
else if (videoObjectName == QStringLiteral("red"))
videoButton->setToolTip(tr("End video call"));
sendButton->setToolTip(tr("Send message"));
emoteButton->setToolTip(tr("Smileys"));
fileButton->setToolTip(tr("Send file(s)"));
screenshotButton->setToolTip(tr("Send a screenshot"));
callButton->setToolTip(tr("Start an audio call"));
videoButton->setToolTip(tr("Start a video call"));
saveChatAction->setText(tr("Save chat log"));
clearAction->setText(tr("Clear displayed messages"));
}

View File

@ -8,7 +8,7 @@ RemoveFriendDialog::RemoveFriendDialog(QWidget *parent, const Friend *f)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setAttribute(Qt::WA_QuitOnClose, false);
ui.setupUi(this);
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName()));
ui.label->setText(ui.label->text().replace("&lt;name&gt;", f->getDisplayedName().toHtmlEscaped()));
auto removeButton = ui.buttonBox->button(QDialogButtonBox::Ok);
auto cancelButton = ui.buttonBox->button(QDialogButtonBox::Cancel);
removeButton->setText(tr("Remove"));

View File

@ -341,7 +341,16 @@ void Widget::init()
//restore window state
restoreGeometry(Settings::getInstance().getWindowGeometry());
restoreState(Settings::getInstance().getWindowState());
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
if (!ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState()))
{
// Set the status panel (friendlist) to a reasonnable width by default/on first start
constexpr int spWidthPc = 33;
ui->mainSplitter->resize(size());
QList<int> sizes = ui->mainSplitter->sizes();
sizes[0] = ui->mainSplitter->width()*spWidthPc/100;
sizes[1] = ui->mainSplitter->width() - sizes[0];
ui->mainSplitter->setSizes(sizes);
}
connect(settingsWidget, &SettingsWidget::compactToggled, contactListWidget, &FriendListWidget::onCompactChanged);
connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, contactListWidget, &FriendListWidget::onGroupchatPositionChanged);
@ -801,7 +810,7 @@ void Widget::setUsername(const QString& username)
else
{
ui->nameLabel->setText(username);
ui->nameLabel->setToolTip(username); // for overlength names
ui->nameLabel->setToolTip(username.toHtmlEscaped()); // for overlength names
}
QString sanename = username;
@ -826,7 +835,7 @@ void Widget::setStatusMessage(const QString &statusMessage)
else
{
ui->statusLabel->setText(statusMessage);
ui->statusLabel->setToolTip(statusMessage); // for overlength messsages
ui->statusLabel->setToolTip(statusMessage.toHtmlEscaped()); // for overlength messsages
}
}
@ -1425,7 +1434,7 @@ void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray in
{
if (type == TOX_GROUPCHAT_TYPE_TEXT || type == TOX_GROUPCHAT_TYPE_AV)
{
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId)), true, false))
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId).toHtmlEscaped()), true, false))
{
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
if (groupId < 0)

View File

@ -89,58 +89,6 @@ if [ ! -f "bin/OpenAL32.dll" ]; then
popd
fi
## opencv
if [ ! -f "opencv-2.4.9.tar.gz" ]; then
wget --no-check-certificate https://github.com/Itseez/opencv/archive/2.4.9.tar.gz -O opencv-2.4.9.tar.gz
rm -rf opencv-2.4.9
fi
if [ ! -d "opencv-2.4.9" ]; then
tar -xvf opencv-2.4.9.tar.gz
rm bin/libopencv_core249.dll
fi
if [ ! -f "bin/libopencv_core249.dll" ]; then
mkdir opencv-2.4.9/build
pushd opencv-2.4.9/build
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$QTOX_DIR/libs \
-DBUILD_opencv_apps=NO \
-DBUILD_opencv_calib3d=NO \
-DBUILD_opencv_contrib=NO \
-DBUILD_opencv_core=YES \
-DBUILD_opencv_features2d=NO \
-DBUILD_opencv_flann=NO \
-DBUILD_opencv_gpu=NO \
-DBUILD_opencv_highgui=YES \
-DBUILD_opencv_imgproc=YES \
-DBUILD_opencv_legacy=NO \
-DBUILD_opencv_ml=NO \
-DBUILD_opencv_nonfree=NO \
-DBUILD_opencv_objdetect=NO \
-DBUILD_opencv_ocl=NO \
-DBUILD_opencv_photo=NO \
-DBUILD_opencv_stiching=NO \
-DBUILD_opencv_superres=NO \
-DBUILD_opencv_ts=NO \
-DBUILD_opencv_video=NO \
-DBUILD_opencv_videostab=NO \
-DBUILD_opencv_world=NO \
-DWITH_QT=NO \
-DBUILD_EXAMPLES=NO \
..
make
make install
for arch in x86 x64
do
if [ -d $QTOX_DIR/libs/$arch/mingw ]; then
mv $QTOX_DIR/libs/$arch/mingw/bin/* $QTOX_DIR/libs/bin/
mv $QTOX_DIR/libs/$arch/mingw/lib/* $QTOX_DIR/libs/lib/
rm -rf $QTOX_DIR/libs/$arch
fi
done
popd
fi
## ffmpeg
if [ ! -f "ffmpeg-2.7.tar.bz2" ]; then