Browse Source

change some gui elements

pull/130/head
DenioD 4 years ago
parent
commit
747580151a
  1. 10
      src/Chat/Chat.cpp
  2. 2
      src/Chat/Helper/ChatDelegator.h
  3. 1
      src/DataStore/ChatDataStore.cpp
  4. 4
      src/chatmodel.cpp
  5. 2
      src/controller.cpp
  6. 4
      src/mainwindow.cpp
  7. 76
      src/mainwindow.ui

10
src/Chat/Chat.cpp

@ -50,9 +50,6 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
{
QStandardItemModel *chat = new QStandardItemModel();
// ui->lcdNumber->setStyleSheet("background-color: red");
// ui->lcdNumber->setPalette(Qt::red);
// ui->lcdNumber->display("1");
DataStore::getChatDataStore()->dump(); // test to see if the chat items in datastore are correctly dumped to json
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
{
@ -63,7 +60,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
if (
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
(p.getPartnerAddress() == c.second.getAddress()) &&
(c.second.isOutgoing() == true))
(c.second.isOutgoing() == true))
{
QStandardItem *Items = new QStandardItem(c.second.toChatLine());
@ -81,8 +78,9 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
if (
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
(p.getMyAddress() == c.second.getAddress()) &&
(c.second.isOutgoing() == false))
(c.second.isOutgoing() == false) &&
(c.second.getCid() == p.getCid())
)
{
QStandardItem *Items1 = new QStandardItem(c.second.toChatLine());
Items1->setData(INCOMING, Qt::UserRole + 1);

2
src/Chat/Helper/ChatDelegator.h

@ -37,7 +37,7 @@ class ListViewDelegate : public QAbstractItemDelegate
inline QSize sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const;
};
inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(5), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.6)
inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(7), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.7)
{
}

1
src/DataStore/ChatDataStore.cpp

@ -96,6 +96,7 @@ std::map<QString, ChatItem> ChatDataStore::getAllMemos()
(c.second.getMemo().startsWith("{") == false) &&
(c.second.getMemo().isEmpty() == false)
)
{

4
src/chatmodel.cpp

@ -125,7 +125,7 @@ void MainWindow::renderContactRequest(){
requestContact.requestMemo->setModel(contactMemo);
requestContact.requestMemo->show();
requestContact.requestCID->setText(c.second.getCid());
requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestMyAddr->setText(c.second.getAddress());
}else{}
@ -617,7 +617,7 @@ Tx MainWindow::createTxForSafeContactRequest()
QString hmemo= createHeaderMemo(type,cid,myAddr);
QString memo = contactRequest.getMemo();
// ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat
tx.toAddrs.push_back(ToFields{addr, amt, hmemo});
tx.toAddrs.push_back(ToFields{addr, amt, memo});

2
src/controller.cpp

@ -1009,7 +1009,7 @@ void Controller::refreshTransactions() {
// Update model data, which updates the table view
transactionsTableModel->replaceData(txdata);
chat->renderChatBox(ui, ui->listChat,ui->memoSize);
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
// refreshContacts(
// ui->listContactWidget

4
src/mainwindow.cpp

@ -1080,14 +1080,14 @@ void MainWindow::setupchatTab() {
});
ui->memoTxtChat->setLenDisplayLabel(ui->memoSize);// Todo -> activate lendisplay for chat
ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat);
}
void MainWindow::updateChat()
{
rpc->refreshChat(ui->listChat,ui->memoSize);
rpc->refreshChat(ui->listChat,ui->memoSizeChat);
rpc->refresh(true);

76
src/mainwindow.ui

@ -1506,16 +1506,16 @@
</rect>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
<set>QAbstractItemView::AllEditTriggers</set>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
@ -1533,12 +1533,24 @@
<widget class="QPushButton" name="safeContactRequest">
<property name="geometry">
<rect>
<x>270</x>
<y>580</y>
<x>10</x>
<y>20</y>
<width>51</width>
<height>51</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize">
<size>
<width>100</width>
@ -1569,12 +1581,24 @@
<widget class="QPushButton" name="pushContact">
<property name="geometry">
<rect>
<x>0</x>
<x>80</x>
<y>20</y>
<width>61</width>
<width>51</width>
<height>51</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize">
<size>
<width>100</width>
@ -1607,12 +1631,24 @@
<widget class="QPushButton" name="givemeZaddr">
<property name="geometry">
<rect>
<x>70</x>
<x>150</x>
<y>20</y>
<width>61</width>
<width>51</width>
<height>51</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="toolTip">
<string>Get a new Address</string>
</property>
@ -1633,15 +1669,18 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="memoSize">
<widget class="QLabel" name="memoSizeChat">
<property name="geometry">
<rect>
<x>1160</x>
<y>540</y>
<x>1140</x>
<y>640</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string notr="true">0 / 512</string>
</property>
@ -1649,6 +1688,17 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<zorder>listContactWidget</zorder>
<zorder>label_39</zorder>
<zorder>contactNameMemo</zorder>
<zorder>contactNameMemo_3</zorder>
<zorder>safeContactRequest</zorder>
<zorder>pushContact</zorder>
<zorder>givemeZaddr</zorder>
<zorder>memoSizeChat</zorder>
<zorder>listChat</zorder>
<zorder>memoTxtChat</zorder>
<zorder>sendChatButton</zorder>
</widget>
</widget>
</item>
@ -1838,7 +1888,7 @@
<customwidget>
<class>ChatMemoEdit</class>
<extends>QTextEdit</extends>
<header location="global">mainwindow.h</header>
<header>mainwindow.h</header>
</customwidget>
</customwidgets>
<tabstops>

Loading…
Cancel
Save