diff --git a/saoricache.cpp b/saoricache.cpp index ffe0095..cbead7d 100644 --- a/saoricache.cpp +++ b/saoricache.cpp @@ -24,6 +24,7 @@ ***/ +#include "saoridef.h" #include "saoricache.h" #include "saoriapplication.h" #include @@ -87,7 +88,7 @@ { if (isCached(url)) return urlToFilename(url); else download(url); - return QString(":/icons/ionicons-md/md-hourglass.svg"); + return QString(SAORI_ICONS_LOADING); } bool SaoriCache::migration() @@ -154,7 +155,7 @@ QSqlQuery query(*SaoriApplication::saori()->database()); query.prepare("INSERT INTO file_cache(url,filename,size,timestamp) values(?,?,?,?);"); query.addBindValue(req.url().toString()); - query.addBindValue(":/icons/ionicons-md/md-alert.svg"); + query.addBindValue(SAORI_ICONS_ALERT); query.addBindValue("-1"); query.addBindValue(QDateTime::currentSecsSinceEpoch()); query.exec(); diff --git a/saoridef.h b/saoridef.h index d49177f..dd7f525 100644 --- a/saoridef.h +++ b/saoridef.h @@ -58,6 +58,22 @@ #define SAORI_SETTING_VIEW_PINED "/pined" #define SAORI_SETTING_VIEW_GEOMETRY "/geometry" - +#define SAORI_ICONS_LOADING ":/icons/ionicons-md/md-hourglass.svg" +#define SAORI_ICONS_ALERT ":/icons/ionicons-md/md-alert.svg" +#define SAORI_ICONS_GLOBAL ":/icons/ionicons-md/md-planet.svg" +#define SAORI_ICONS_LOCK ":/icons/ionicons-md/md-lock.svg" +#define SAORI_ICONS_UNLOCK ":/icons/ionicons-md/md-unlock.svg" +#define SAORI_ICONS_PERSON ":/icons/ionicons-md/md-person.svg" +#define SAORI_ICONS_PERSONS ":/icons/ionicons-md/md-people.svg" +#define SAORI_ICONS_PERSONADD ":/icons/ionicons-md/md-person-add.svg" +#define SAORI_ICONS_MAIL ":/icons/ionicons-md/md-mail.svg" +#define SAORI_ICONS_RELPY ":/icons/ionicons-md/md-share-alt.svg" +#define SAORI_ICONS_STAR ":/icons/ionicons-md/md-star.svg" +#define SAORI_ICONS_SHARE ":/icons/ionicons-md/md-share.svg" +#define SAORI_ICONS_CHAT ":/icons/ionicons-md/md-chatbubbles.svg" +#define SAORI_ICONS_SEND ":/icons/ionicons-md/md-send.svg" +#define SAORI_ICONS_TRASH ":/icons/ionicons-md/md-trash.svg" +#define SAORI_ICONS_TEXT ":/icons/ionicons-md/md-text.svg" +#define SAORI_ICONS_NOTIFICATIONS ":/icons/ionicons-md/md-notifications.svg" #endif // SAORIDEF_H diff --git a/saoriview.cpp b/saoriview.cpp index 70a40a2..e70ccd8 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -222,16 +222,16 @@ vl << "public" << "unlisted" << "private" << "direct"; switch (vl.indexOf(json["visibility"].toString())) { case 0: - visibility = htmlImg("icon",":/icons/ionicons-md/md-planet.svg"); + visibility = htmlImg("icon",SAORI_ICONS_GLOBAL); break; case 1: - visibility = htmlImg("icon",":/icons/ionicons-md/md-unlock.svg"); + visibility = htmlImg("icon",SAORI_ICONS_UNLOCK); break; case 2: - visibility = htmlImg("icon",":/icons/ionicons-md/md-lock.svg"); + visibility = htmlImg("icon",SAORI_ICONS_LOCK); break; case 3: - visibility = htmlImg("icon",":/icons/ionicons-md/md-person.svg"); + visibility = htmlImg("icon",SAORI_ICONS_PERSON); break; default: break; @@ -239,12 +239,12 @@ result += htmlDiv("tools", visibility + " " + htmlAnc("reply:" + json["id"].toString(), - htmlImg("icon",":/icons/ionicons-md/md-share-alt.svg")) + " " + + htmlImg("icon",SAORI_ICONS_RELPY)) + " " + htmlAnc("boost:" + json["id"].toString(), - htmlImg("icon",":/icons/ionicons-md/md-share.svg")) + + htmlImg("icon",SAORI_ICONS_SHARE)) + QString::number(json["reblogs_count"].toInt()) + htmlAnc("fav:" + json["id"].toString(), - htmlImg("icon",":/icons/ionicons-md/md-star.svg")) + + htmlImg("icon",SAORI_ICONS_STAR)) + QString::number(json["favourites_count"].toInt()) ); } @@ -331,19 +331,19 @@ QString title; switch (type.indexOf(json["type"].toString())) { case 0: - title += htmlImg("mavatar",":/icons/ionicons-md/md-chatbubbles.svg"); + title += htmlImg("mavatar",SAORI_ICONS_CHAT); title += tr("%1 mentioned your status.").arg(json["account"].toObject()["display_name"].toString()); break; case 1: - title += htmlImg("mavatar",":/icons/ionicons-md/md-share.svg"); + title += htmlImg("mavatar",SAORI_ICONS_SHARE); title += tr("%1 boosted your status.").arg(json["account"].toObject()["display_name"].toString()); break; case 2: - title += htmlImg("mavatar",":/icons/ionicons-md/md-star.svg"); + title += htmlImg("mavatar",SAORI_ICONS_STAR); title += tr("%1 favourited your status.").arg(json["account"].toObject()["display_name"].toString()); break; case 3: - title += htmlImg("mavatar",":/icons/ionicons-md/md-person-add.svg"); + title += htmlImg("mavatar",SAORI_ICONS_PERSONADD); title += tr("%1 followed you.").arg(json["account"].toObject()["display_name"].toString()); break; default: diff --git a/saoriviewentry.cpp b/saoriviewentry.cpp index b44e4e9..91a5e98 100644 --- a/saoriviewentry.cpp +++ b/saoriviewentry.cpp @@ -92,7 +92,7 @@ auto type = i.split(':')[0]; if (((type == "icon") || (type == "avatar") || (type == "mavatar")) && (imageurl.left(2) != ":/")) m_imagecache_g[i] = img; - else if (imageurl != ":/icons/ionicons-md/md-hourglass.svg") m_imagecache_l[i] = img; + else if (imageurl != SAORI_ICONS_LOADING) m_imagecache_l[i] = img; } } setText(designedText(cw)); @@ -195,7 +195,7 @@ } for(auto i:m_urlmap) { - if (i == ":/icons/ionicons-md/md-hourglass.svg") return; + if (i == SAORI_ICONS_LOADING) return; } disconnect(SaoriApplication::saori()->cache(),&SaoriCache::downloaded,this,&SaoriViewEntry::downloaded); diff --git a/saoriwindow.cpp b/saoriwindow.cpp index 2d3c812..a7832d1 100644 --- a/saoriwindow.cpp +++ b/saoriwindow.cpp @@ -62,27 +62,27 @@ switch (trtl.indexOf(t[0])) { case 0: tlText = tr("home"); - icon = ":/icons/ionicons-md/md-chatbubbles.svg"; + icon = SAORI_ICONS_CHAT; break; case 1: tlText = tr("local"); - icon = ":/icons/ionicons-md/md-text.svg"; + icon = SAORI_ICONS_TEXT; break; case 2: tlText = tr("public"); - icon = ":/icons/ionicons-md/md-planet.svg"; + icon = SAORI_ICONS_GLOBAL; break; case 3: tlText = tr("notifications"); - icon = ":/icons/ionicons-md/md-notifications.svg"; + icon = SAORI_ICONS_NOTIFICATIONS; break; case 4: tlText = tr("instance"); - icon = ":/icons/ionicons-md/md-planet.svg"; + icon = SAORI_ICONS_GLOBAL; break; case 5: tlText = tr("accounts"); - icon = ":/icons/ionicons-md/md-person.svg"; + icon = SAORI_ICONS_PERSON; break; default: tlText = timeline; @@ -160,10 +160,10 @@ { ui->timelineTree->clear(); auto *accountItem = new QTreeWidgetItem(ui->timelineTree,QStringList() << tr("Accounts")); - accountItem->setIcon(0,QIcon(":/icons/ionicons-md/md-people.svg")); + accountItem->setIcon(0,QIcon(SAORI_ICONS_PERSONS)); for (int i = 0;i < SaoriApplication::getAccountList()->count();i ++) { auto *item = new QTreeWidgetItem(accountItem,QStringList() << SaoriApplication::getAccountList()->at(i)->name()); - item->setIcon(0,QIcon(":/icons/ionicons-md/md-person.svg")); + item->setIcon(0,QIcon(SAORI_ICONS_PERSON)); accountItem->addChild(item); for (auto tl:SaoriApplication::getAccountList()->at(i)->timelineList()) { auto title = getTimelineTitle(tl); @@ -175,11 +175,11 @@ } } auto *instanceItem = new QTreeWidgetItem(ui->timelineTree,QStringList() << tr("Instances")); - instanceItem->setIcon(0,QIcon(":/icons/ionicons-md/md-planet.svg")); + instanceItem->setIcon(0,QIcon(SAORI_ICONS_GLOBAL)); for (int i = 0;i < SaoriApplication::getInstanceList()->count();i ++) { auto *item = new QTreeWidgetItem(instanceItem,QStringList() << SaoriApplication::getInstanceList()->at(i)->instance().toString()); - item->setIcon(0,QIcon(":/icons/ionicons-md/md-planet.svg")); + item->setIcon(0,QIcon(SAORI_ICONS_GLOBAL)); instanceItem->addChild(item); } }