Merge pull request #6 from DenioD/chat
choose a avatar when create a contact
@@ -12,16 +12,16 @@
|
|||||||
<file>res/sdlogo.png</file>
|
<file>res/sdlogo.png</file>
|
||||||
<file>res/sdlogo2.png</file>
|
<file>res/sdlogo2.png</file>
|
||||||
<file>res/Berg.png</file>
|
<file>res/Berg.png</file>
|
||||||
<file>res/denio.png</file>
|
<file>res/Denio.png</file>
|
||||||
<file>res/duke.png</file>
|
<file>res/Duke.png</file>
|
||||||
<file>res/sharpee.png</file>
|
<file>res/Sharpee.png</file>
|
||||||
<file>res/yoda.png</file>
|
<file>res/Yoda.png</file>
|
||||||
<file>res/mickey.png</file>
|
<file>res/Mickey.png</file>
|
||||||
<file>res/snoopy.png</file>
|
<file>res/Snoopy.png</file>
|
||||||
<file>res/popey.png</file>
|
<file>res/Popey.png</file>
|
||||||
<file>res/garfield.png</file>
|
<file>res/Garfield.png</file>
|
||||||
<file>res/pinguin.png</file>
|
<file>res/Pinguin.png</file>
|
||||||
<file>res/hirsch.png</file>
|
<file>res/Hirsch.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/img">
|
<qresource prefix="/img">
|
||||||
<file>res/hushdlogo.gif</file>
|
<file>res/hushdlogo.gif</file>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
@@ -169,7 +169,10 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
auto myAddr = ab.addr_chat->text().trimmed();
|
auto myAddr = ab.addr_chat->text().trimmed();
|
||||||
QString newLabel = ab.label->text();
|
QString newLabel = ab.label->text();
|
||||||
QString cid = ab.cid->text();
|
QString cid = ab.cid->text();
|
||||||
QString avatar = "res/yoda.png";
|
|
||||||
|
|
||||||
|
QString avatar = QString("res/") + ab.comboBoxAvatar->currentText() + QString(".png");
|
||||||
|
qDebug()<<"AVATAR NAME : " << avatar;
|
||||||
|
|
||||||
if (addr.isEmpty() || newLabel.isEmpty())
|
if (addr.isEmpty() || newLabel.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -332,11 +335,34 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Get Avatar Data
|
||||||
|
|
||||||
|
|
||||||
|
// int avatar_index = ab.comboBoxAvatar->findText(AddressBook::getInstance()->get_avatar_name(), Qt::MatchExactly);
|
||||||
|
// ab.comboBoxAvatar->setCurrentIndex(avatar_index);
|
||||||
|
|
||||||
|
// QObject::connect(ab.comboBoxAvatar, &QComboBox::currentTextChanged, [=] (QString avatar_name) {
|
||||||
|
// parent->slot_change_avatar(avatar_name);
|
||||||
|
// rpc->refresh(true);
|
||||||
|
// });
|
||||||
|
|
||||||
// Refresh after the dialog is closed to update the labels everywhere.
|
// Refresh after the dialog is closed to update the labels everywhere.
|
||||||
parent->getRPC()->refresh(true);
|
parent->getRPC()->refresh(true);
|
||||||
model.updateUi(); //todo fix updating gui after adding
|
model.updateUi(); //todo fix updating gui after adding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AddressBook::get_avatar_name() {
|
||||||
|
// Load from the QT Settings.
|
||||||
|
// QString avatar = ab.comboBoxAvatar.text();
|
||||||
|
// return QString()
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBook::set_avatar_name(QString avatar_name) {
|
||||||
|
avatar_name = "abs.comboBoxAvatar.text()";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============
|
//=============
|
||||||
// AddressBook singleton class
|
// AddressBook singleton class
|
||||||
//=============
|
//=============
|
||||||
@@ -515,6 +541,8 @@ QString AddressBook::addLabelToAddress(QString addr)
|
|||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString AddressBook::addressFromAddressLabel(const QString& lblAddr)
|
QString AddressBook::addressFromAddressLabel(const QString& lblAddr)
|
||||||
{
|
{
|
||||||
return lblAddr.trimmed().split("/").last();
|
return lblAddr.trimmed().split("/").last();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadData();
|
void loadData();
|
||||||
void saveData();
|
void saveData();
|
||||||
@@ -58,6 +59,14 @@ public:
|
|||||||
QString getLabelForAddress(QString address);
|
QString getLabelForAddress(QString address);
|
||||||
// Get a Label's address
|
// Get a Label's address
|
||||||
QString getAddressForLabel(QString label);
|
QString getAddressForLabel(QString label);
|
||||||
|
|
||||||
|
QString get_avatar_name();
|
||||||
|
void set_avatar_name(QString avatar_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AddressBook();
|
AddressBook();
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/hirsch.png</activeon>
|
<activeon>:/icons/res/Hirsch.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/denio.png</activeon>
|
<activeon>:/icons/res/Denio.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/duke.png</activeon>
|
<activeon>:/icons/res/Duke.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/yoda.png</activeon>
|
<activeon>:/icons/res/Yoda.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/sharpee.png</activeon>
|
<activeon>:/icons/res/Sharpee.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/garfield.png</activeon>
|
<activeon>:/icons/res/Garfield.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/snoopy.png</activeon>
|
<activeon>:/icons/res/Snoopy.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/popey.png</activeon>
|
<activeon>:/icons/res/Popey.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
@@ -159,7 +159,17 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset>
|
||||||
<activeon>:/icons/res/pinguin.png</activeon>
|
<activeon>:/icons/res/Pinguin.png</activeon>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Mickey</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<activeon>:/icons/res/Mickey.png</activeon>
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void ContactModel::renderContactList(QListView* view)
|
|||||||
if ((theme == "dark" || theme == "midnight")) {
|
if ((theme == "dark" || theme == "midnight")) {
|
||||||
|
|
||||||
// QIcon avatar = c.getAvatar();
|
// QIcon avatar = c.getAvatar();
|
||||||
QString avatar = "res/yoda.png";
|
QString avatar = c.getAvatar();
|
||||||
|
|
||||||
QStandardItem* Items1 = new QStandardItem(QIcon(avatar) ,c.getName());
|
QStandardItem* Items1 = new QStandardItem(QIcon(avatar) ,c.getName());
|
||||||
contact->appendRow(Items1);
|
contact->appendRow(Items1);
|
||||||
|
|||||||
@@ -436,7 +436,9 @@ void MainWindow::setupSettingsModal() {
|
|||||||
|
|
||||||
this->slot_change_currency(currency_name);
|
this->slot_change_currency(currency_name);
|
||||||
|
|
||||||
;
|
// Include Avatar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Setup theme combo
|
// Setup theme combo
|
||||||
@@ -1468,6 +1470,26 @@ void MainWindow::slot_change_currency(const QString& currency_name)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void MainWindow::slot_change_avatar(const QString& avatar_name)
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
AddressBook::getInstance()->set_avatar_name(avatar_name);
|
||||||
|
|
||||||
|
// Include currency
|
||||||
|
|
||||||
|
QString saved_avatar_name;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
saved_avatar_name = AddressBook::getInstance()->get_avatar_name();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
saved_avatar_name = "Yoda";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::slot_change_theme(const QString& theme_name)
|
void MainWindow::slot_change_theme(const QString& theme_name)
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void slot_change_theme(const QString& themeName);
|
void slot_change_theme(const QString& themeName);
|
||||||
void slot_change_currency(const QString& currencyName);
|
void slot_change_currency(const QString& currencyName);
|
||||||
|
void slot_change_avatar(const QString& avatarName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent* event);
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|||||||
@@ -226,12 +226,8 @@ QString Settings::get_currency_name() {
|
|||||||
|
|
||||||
void Settings::set_currency_name(QString currency_name) {
|
void Settings::set_currency_name(QString currency_name) {
|
||||||
QSettings().setValue("options/currency_name", currency_name);
|
QSettings().setValue("options/currency_name", currency_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Settings::get_theme_name() {
|
QString Settings::get_theme_name() {
|
||||||
// Load from the QT Settings.
|
// Load from the QT Settings.
|
||||||
return QSettings().value("options/theme_name", false).toString();
|
return QSettings().value("options/theme_name", false).toString();
|
||||||
@@ -242,6 +238,9 @@ void Settings::set_theme_name(QString theme_name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================
|
//=================================
|
||||||
// Static Stuff
|
// Static Stuff
|
||||||
//=================================
|
//=================================
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public:
|
|||||||
void set_currency_name(QString currency_name);
|
void set_currency_name(QString currency_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool isSaplingActive();
|
bool isSaplingActive();
|
||||||
|
|
||||||
void setZECPrice(double p) { ZECPrice = p; }
|
void setZECPrice(double p) { ZECPrice = p; }
|
||||||
|
|||||||