Skip to content

Commit 7c4d6fa

Browse files
- ui optimization
- linux optimization
1 parent d56dc48 commit 7c4d6fa

File tree

344 files changed

+1710
-808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+1710
-808
lines changed

accountlistform.cpp

+71
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/**
2+
* Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
4+
*
5+
* This is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU Lesser General Public License as
7+
* published by the Free Software Foundation; either version 2.1 of
8+
* the License, or (at your option) any later version.
9+
*
10+
* This software is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this software; if not, write to the Free
17+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19+
*/
20+
121
#include "accountlistform.h"
222
#include "ui_accountlistform.h"
323

@@ -6,6 +26,57 @@ AccountListForm::AccountListForm(QWidget *parent) :
626
ui(new Ui::AccountListForm)
727
{
828
ui->setupUi(this);
29+
30+
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
31+
32+
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(addButtonDidClick()));
33+
connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(rowDidSelect(QListWidgetItem*)));
34+
}
35+
36+
void AccountListForm::addCell(QString name, QString clientID, QString host, int port)
37+
{
38+
CellAccountItem *cell = CellAccountItem::createCellWith(name, clientID, host, QString::number(port), ui->listWidget);
39+
connect(cell, SIGNAL(deleteButtonClickOn(int)), this, SLOT(deleteItemAt(int)));
40+
}
41+
42+
void AccountListForm::setAccountList(DQList<AccountEntity> list)
43+
{
44+
for (int i = 0 ; i < ui->listWidget->count(); i++) {
45+
QListWidgetItem *item = ui->listWidget->item(i);
46+
ui->listWidget->removeItemWidget(item);
47+
}
48+
ui->listWidget->clear();
49+
50+
this->accounts = list;
51+
52+
for (int i = 0; i < this->accounts.size(); i++) {
53+
AccountEntity *item = this->accounts.at(i);
54+
this->addCell(item->username, item->clientID, item->serverHost, item->port);
55+
}
56+
}
57+
58+
void AccountListForm::rowDidSelect(QListWidgetItem *item)
59+
{
60+
int row = ui->listWidget->row(item);
61+
AccountEntity *accountItem = this->accounts.at(row);
62+
63+
emit accountDidSelect(accountItem);
64+
}
65+
66+
void AccountListForm::addButtonDidClick()
67+
{
68+
emit newAccountDidClick();
69+
}
70+
71+
void AccountListForm::deleteItemAt(int row)
72+
{
73+
AccountEntity *item = this->accounts.at(row);
74+
emit deleteAccount(item);
75+
}
76+
77+
QSize AccountListForm::getSize()
78+
{
79+
return QSize(300, 425);
980
}
1081

1182
AccountListForm::~AccountListForm()

accountlistform.h

+44
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,66 @@
1+
/**
2+
* Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
4+
*
5+
* This is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU Lesser General Public License as
7+
* published by the Free Software Foundation; either version 2.1 of
8+
* the License, or (at your option) any later version.
9+
*
10+
* This software is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
* Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Lesser General Public
16+
* License along with this software; if not, write to the Free
17+
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18+
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19+
*/
20+
121
#ifndef ACCOUNTLISTFORM_H
222
#define ACCOUNTLISTFORM_H
323

424
#include <QWidget>
25+
#include <cells/cellaccountitem.h>
26+
#include <database/entities/accountentity.h>
527

628
namespace Ui {
729
class AccountListForm;
830
}
931

32+
/**
33+
* @brief The AccountsListDialog class
34+
*/
35+
1036
class AccountListForm : public QWidget
1137
{
1238
Q_OBJECT
1339

40+
DQList<AccountEntity> accounts;
41+
42+
void addCell(QString name, QString clientID, QString host, int port);
43+
1444
public:
1545
explicit AccountListForm(QWidget *parent = 0);
1646
~AccountListForm();
1747

48+
void setAccountList(DQList<AccountEntity> list);
49+
50+
QSize getSize();
51+
1852
private:
1953
Ui::AccountListForm *ui;
54+
55+
signals:
56+
void deleteAccount(AccountEntity *account);
57+
void accountDidSelect(AccountEntity *account);
58+
void newAccountDidClick();
59+
60+
private slots:
61+
void rowDidSelect(QListWidgetItem* item);
62+
void addButtonDidClick();
63+
void deleteItemAt(int row);
2064
};
2165

2266
#endif // ACCOUNTLISTFORM_H

accountlistform.ui

+95-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<ui version="4.0">
2-
<author/>
3-
<comment/>
4-
<exportmacro/>
53
<class>AccountListForm</class>
6-
<widget name="AccountListForm" class="QWidget">
4+
<widget class="QWidget" name="AccountListForm">
75
<property name="geometry">
86
<rect>
97
<x>0</x>
108
<y>0</y>
11-
<width>400</width>
12-
<height>300</height>
9+
<width>300</width>
10+
<height>425</height>
1311
</rect>
1412
</property>
1513
<property name="windowTitle">
1614
<string>Form</string>
1715
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<property name="leftMargin">
18+
<number>0</number>
19+
</property>
20+
<property name="topMargin">
21+
<number>0</number>
22+
</property>
23+
<property name="rightMargin">
24+
<number>0</number>
25+
</property>
26+
<property name="bottomMargin">
27+
<number>0</number>
28+
</property>
29+
<property name="spacing">
30+
<number>0</number>
31+
</property>
32+
<item row="0" column="0">
33+
<widget class="QLabel" name="label">
34+
<property name="minimumSize">
35+
<size>
36+
<width>0</width>
37+
<height>32</height>
38+
</size>
39+
</property>
40+
<property name="maximumSize">
41+
<size>
42+
<width>16777215</width>
43+
<height>32</height>
44+
</size>
45+
</property>
46+
<property name="styleSheet">
47+
<string notr="true">QLabel {
48+
border-style: outset;
49+
border-width: 0px;
50+
color: white;
51+
background-color: rgb(25,163,219);
52+
}</string>
53+
</property>
54+
<property name="text">
55+
<string>Please select account</string>
56+
</property>
57+
<property name="alignment">
58+
<set>Qt::AlignCenter</set>
59+
</property>
60+
</widget>
61+
</item>
62+
<item row="1" column="0">
63+
<widget class="ListWidget" name="listWidget">
64+
<property name="alternatingRowColors">
65+
<bool>true</bool>
66+
</property>
67+
</widget>
68+
</item>
69+
<item row="2" column="0">
70+
<widget class="QPushButton" name="pushButton">
71+
<property name="minimumSize">
72+
<size>
73+
<width>0</width>
74+
<height>48</height>
75+
</size>
76+
</property>
77+
<property name="styleSheet">
78+
<string notr="true">QPushButton {
79+
font-size:16pt;
80+
border-style: outset;
81+
border-width: 0px;
82+
color: white;
83+
background-color: rgb(25,163,219);
84+
top:100px;
85+
}
86+
QPushButton:pressed {
87+
background-color: rgb(45,183,239);
88+
}</string>
89+
</property>
90+
<property name="text">
91+
<string>Add new account</string>
92+
</property>
93+
<property name="flat">
94+
<bool>false</bool>
95+
</property>
96+
</widget>
97+
</item>
98+
</layout>
1899
</widget>
19-
<pixmapfunction/>
100+
<customwidgets>
101+
<customwidget>
102+
<class>ListWidget</class>
103+
<extends>QListWidget</extends>
104+
<header>listwidget.h</header>
105+
</customwidget>
106+
</customwidgets>
107+
<resources/>
20108
<connections/>
21109
</ui>

cells/cellaccountitem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellaccountitem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellmessageitem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellmessageitem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/celltopicitem.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/celltopicitem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellwithcheckbox.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellwithcheckbox.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellwithcombobox.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellwithcombobox.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as

cells/cellwitheditline.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as
@@ -42,6 +42,12 @@ CellWithEditLine *CellWithEditLine::createCellWith(QString imagePath, QString te
4242
return widgetForm;
4343
}
4444

45+
void CellWithEditLine::setNumbersValidator()
46+
{
47+
QRegExpValidator *validator = new QRegExpValidator(QRegExp("\\d*"), this);
48+
ui->lineEdit->setValidator(validator);
49+
}
50+
4551
QImage CellWithEditLine::getImage()
4652
{
4753
QGraphicsPixmapItem *item = (QGraphicsPixmapItem *)ui->graphicsView->items().at(0);

cells/cellwitheditline.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Mobius Software LTD
3-
* Copyright 2015-2017, Mobius Software LTD
3+
* Copyright 2015-2018, Mobius Software LTD
44
*
55
* This is free software; you can redistribute it and/or modify it
66
* under the terms of the GNU Lesser General Public License as
@@ -41,6 +41,8 @@ class CellWithEditLine : public QWidget
4141

4242
static CellWithEditLine *createCellWith(QString imagePath, QString text, QString placeholder, ListWidget *widget);
4343

44+
void setNumbersValidator();
45+
4446
QImage getImage();
4547
void setImage(QString path);
4648

cells/cellwitheditline.ui

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
<string notr="true">background-color: rgba(255, 255, 255, 0);
8181
border-color: rgb(254, 198, 66);</string>
8282
</property>
83+
<property name="inputMask">
84+
<string/>
85+
</property>
8386
<property name="alignment">
8487
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
8588
</property>

0 commit comments

Comments
 (0)