mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
add insert chatlog capability (not finished)
This commit is contained in:
parent
8630ab80e2
commit
2ede886c7d
9
qtox.pro
9
qtox.pro
|
@ -30,7 +30,8 @@ FORMS += \
|
|||
widget/form/settings/generalsettings.ui \
|
||||
widget/form/settings/avsettings.ui \
|
||||
widget/form/settings/identitysettings.ui \
|
||||
widget/form/settings/privacysettings.ui
|
||||
widget/form/settings/privacysettings.ui \
|
||||
widget/form/loadhistorydialog.ui
|
||||
CONFIG += c++11
|
||||
|
||||
TRANSLATIONS = translations/de.ts \
|
||||
|
@ -134,7 +135,8 @@ HEADERS += widget/form/addfriendform.h \
|
|||
widget/tool/chatactions/systemmessageaction.h \
|
||||
widget/tool/chatactions/actionaction.h \
|
||||
historykeeper.h \
|
||||
widget/maskablepixmapwidget.h
|
||||
widget/maskablepixmapwidget.h \
|
||||
widget/form/loadhistorydialog.h
|
||||
|
||||
SOURCES += \
|
||||
widget/form/addfriendform.cpp \
|
||||
|
@ -181,4 +183,5 @@ SOURCES += \
|
|||
widget/tool/chatactions/systemmessageaction.cpp \
|
||||
widget/tool/chatactions/actionaction.cpp \
|
||||
historykeeper.cpp \
|
||||
widget/maskablepixmapwidget.cpp
|
||||
widget/maskablepixmapwidget.cpp \
|
||||
widget/form/loadhistorydialog.cpp
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "widget/croppinglabel.h"
|
||||
#include "misc/style.h"
|
||||
#include "historykeeper.h"
|
||||
#include "loadhistorydialog.h"
|
||||
|
||||
ChatForm::ChatForm(Friend* chatFriend)
|
||||
: f(chatFriend)
|
||||
|
@ -56,6 +57,8 @@ ChatForm::ChatForm(Friend* chatFriend)
|
|||
headTextLayout->addStretch();
|
||||
headTextLayout->setSpacing(0);
|
||||
|
||||
menu.addAction(tr("Load History..."), this, SLOT(onLoadHistory()));
|
||||
|
||||
connect(Core::getInstance(), &Core::fileSendStarted, this, &ChatForm::startFileSend);
|
||||
connect(Core::getInstance(), &Core::videoFrameReceived, netcam, &NetCamView::updateDisplay);
|
||||
connect(sendButton, &QPushButton::clicked, this, &ChatForm::onSendTriggered);
|
||||
|
@ -529,3 +532,18 @@ void ChatForm::onAvatarRemoved(int FriendId)
|
|||
|
||||
avatar->setPixmap(QPixmap(":/img/contact_dark.png"), Qt::transparent);
|
||||
}
|
||||
|
||||
void ChatForm::onLoadHistory()
|
||||
{
|
||||
LoadHistoryDialog dlg;
|
||||
|
||||
if (dlg.exec())
|
||||
{
|
||||
QDateTime fromTime = dlg.getFromDate();
|
||||
QDateTime toTime = dlg.getToDate();
|
||||
|
||||
auto msgs = HistoryKeeper::getInstance()->getChatHistory(HistoryKeeper::ctSingle, Core::getInstance()->getSelfId().publicKey,
|
||||
f->userId, fromTime, toTime);
|
||||
// do smth with messages
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ private slots:
|
|||
void onCancelCallTriggered();
|
||||
void onFileTansBtnClicked(QString widgetName, QString buttonName);
|
||||
void onFileSendFailed(int FriendId, const QString &fname);
|
||||
void onLoadHistory();
|
||||
|
||||
protected:
|
||||
// drag & drop
|
||||
|
|
42
widget/form/loadhistorydialog.cpp
Normal file
42
widget/form/loadhistorydialog.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
This program is libre 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 3 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 COPYING file for more details.
|
||||
*/
|
||||
|
||||
#include "loadhistorydialog.h"
|
||||
#include "ui_loadhistorydialog.h"
|
||||
|
||||
LoadHistoryDialog::LoadHistoryDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LoadHistoryDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
LoadHistoryDialog::~LoadHistoryDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QDateTime LoadHistoryDialog::getFromDate()
|
||||
{
|
||||
QDateTime res(ui->fromDate->selectedDate());
|
||||
return res;
|
||||
}
|
||||
|
||||
QDateTime LoadHistoryDialog::getToDate()
|
||||
{
|
||||
QDateTime res(ui->toDate->selectedDate().addDays(1));
|
||||
return res;
|
||||
}
|
42
widget/form/loadhistorydialog.h
Normal file
42
widget/form/loadhistorydialog.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Project Tox <https://tox.im>
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
This program is libre 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 3 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 COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef LOADHISTORYDIALOG_H
|
||||
#define LOADHISTORYDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Ui {
|
||||
class LoadHistoryDialog;
|
||||
}
|
||||
|
||||
class LoadHistoryDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LoadHistoryDialog(QWidget *parent = 0);
|
||||
~LoadHistoryDialog();
|
||||
|
||||
QDateTime getFromDate();
|
||||
QDateTime getToDate();
|
||||
|
||||
private:
|
||||
Ui::LoadHistoryDialog *ui;
|
||||
};
|
||||
|
||||
#endif // LOADHISTORYDIALOG_H
|
100
widget/form/loadhistorydialog.ui
Normal file
100
widget/form/loadhistorydialog.ui
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LoadHistoryDialog</class>
|
||||
<widget class="QDialog" name="LoadHistoryDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>574</width>
|
||||
<height>264</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Load History Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="fromLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="fromLabel">
|
||||
<property name="text">
|
||||
<string>From Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCalendarWidget" name="fromDate">
|
||||
<property name="gridVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="toLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="toLabel">
|
||||
<property name="text">
|
||||
<string>To Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCalendarWidget" name="toDate"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>LoadHistoryDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>LoadHistoryDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user