Browse Source

Improved status widget and partly implemented its children widgets (weeklycode, newslistwidget, newspiece)

Ivan Arkhipov 5 years ago
parent
commit
78161c2535

+ 3 - 0
Legacy_v2.pro

@@ -19,3 +19,6 @@ SUBDIRS += \
     src/Legacy-advanced \
     src/Legacy-advanced \
     src/Launcher
+
+RESOURCES += \
+    src/Legacy/common.qrc

+ 4 - 4
src/Legacy-advanced/models/lotromanager.cpp

@@ -156,11 +156,11 @@ void LotroManager::importFile(long long file_id, QString file_path) {
         return;
     }
 
-    LOTRO_DAT::SubFile subfile = *(getfile_op.value);
-    data.options["ext"] = subfile.Extension();
-    data.options["cat"] = subfile.category;
+    std::shared_ptr<LOTRO_DAT::SubFile> subfile = getfile_op.value;
+    data.options["ext"] = subfile->Extension();
+    data.options["cat"] = subfile->category;
 
-    if (subfile.FileType() == LOTRO_DAT::TEXT) {
+    if (subfile->FileType() == LOTRO_DAT::TEXT) {
         std::basic_ifstream<char16_t> input_stream(file_path.toStdString(), std::ios::in);
         if (!input_stream.is_open()) {
             emit caughtError("importFile", {QString("Ошибка импорта!"), QString("Текстовый файл ") + file_path + QString(" не удаётся открыть!")});

+ 37 - 9
src/Legacy-advanced/widgets/lotroprogresswidget.ui

@@ -54,14 +54,39 @@
         <property name="minimumSize">
          <size>
           <width>400</width>
-          <height>0</height>
+          <height>35</height>
          </size>
         </property>
         <property name="styleSheet">
-         <string notr="true">color: white;</string>
+         <string notr="true">QProgressBar {
+    border: 0px solid grey;
+	border-image: url(:/per.png);
+	text-align: right;
+}
+
+QProgressBar::chunk {
+background-image: url(:/letters.png);
+margin-left:8px;
+margin-right:40px;
+margin-top:7px;
+margin-bottom:7px;
+}
+</string>
+        </property>
+        <property name="maximum">
+         <number>100</number>
         </property>
         <property name="value">
-         <number>0</number>
+         <number>100</number>
+        </property>
+        <property name="invertedAppearance">
+         <bool>false</bool>
+        </property>
+        <property name="textDirection">
+         <enum>QProgressBar::TopToBottom</enum>
+        </property>
+        <property name="format">
+         <string>%p%  </string>
         </property>
        </widget>
       </item>
@@ -84,8 +109,8 @@
         </property>
        </widget>
       </item>
-      <item row="1" column="2">
-       <spacer name="horizontalSpacer_2">
+      <item row="1" column="0" rowspan="2">
+       <spacer name="horizontalSpacer">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
@@ -97,10 +122,10 @@
         </property>
        </spacer>
       </item>
-      <item row="2" column="1" colspan="2">
+      <item row="2" column="1">
        <widget class="QLabel" name="debug_info_common">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -116,10 +141,13 @@
         <property name="text">
          <string>TextLabel</string>
         </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
        </widget>
       </item>
-      <item row="1" column="0" rowspan="2">
-       <spacer name="horizontalSpacer">
+      <item row="1" column="2" rowspan="2">
+       <spacer name="horizontalSpacer_2">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>

+ 12 - 6
src/Legacy/Legacy.pro

@@ -21,11 +21,14 @@ SOURCES += \
     widgets/helpwidget.cpp \
     widgets/mainwindow.cpp \
     widgets/menuentry.cpp \
-    widgets/newswidget.cpp \
     widgets/rusificationtreeitem.cpp \
     widgets/rusificationwidget.cpp \
     widgets/settingswidget.cpp \
-    widgets/statuswidget.cpp
+    widgets/statuswidget.cpp \
+    widgets/serverstatuswidget.cpp \
+    widgets/weeklycodewidget.cpp \
+    widgets/newslistwidget.cpp \
+    widgets/newspiece.cpp
 
 HEADERS += \
     models/downloader.h \
@@ -34,19 +37,22 @@ HEADERS += \
     widgets/helpwidget.h \
     widgets/mainwindow.h \
     widgets/menuentry.h \
-    widgets/newswidget.h \
     widgets/rusificationtreeitem.h \
     widgets/rusificationwidget.h \
     widgets/settingswidget.h \
-    widgets/statuswidget.h
+    widgets/statuswidget.h \
+    widgets/serverstatuswidget.h \
+    widgets/weeklycodewidget.h \
+    widgets/newslistwidget.h \
+    widgets/newspiece.h
 
 FORMS += \
     widgets/helpwidget.ui \
     widgets/mainwindow.ui \
-    widgets/newswidget.ui \
     widgets/rusificationwidget.ui \
     widgets/settingswidget.ui \
-    widgets/statuswidget.ui
+    widgets/statuswidget.ui \
+    widgets/newspiece.ui
 
 win32:RC_ICONS = $${PROJECT_ROOT_PATH}/resources/appicon.ico
 

+ 8 - 2
src/Legacy/object_script.Legacy.Debug

@@ -8,11 +8,14 @@ INPUT(
 ./..\..\build\debug\Legacy\obj\helpwidget.o
 ./..\..\build\debug\Legacy\obj\mainwindow.o
 ./..\..\build\debug\Legacy\obj\menuentry.o
-./..\..\build\debug\Legacy\obj\newswidget.o
 ./..\..\build\debug\Legacy\obj\rusificationtreeitem.o
 ./..\..\build\debug\Legacy\obj\rusificationwidget.o
 ./..\..\build\debug\Legacy\obj\settingswidget.o
 ./..\..\build\debug\Legacy\obj\statuswidget.o
+./..\..\build\debug\Legacy\obj\serverstatuswidget.o
+./..\..\build\debug\Legacy\obj\weeklycodewidget.o
+./..\..\build\debug\Legacy\obj\newslistwidget.o
+./..\..\build\debug\Legacy\obj\newspiece.o
 ./..\..\build\debug\Legacy\obj\legacy_plugin_import.o
 ./..\..\build\debug\Legacy\obj\moc_downloader.o
 ./..\..\build\debug\Legacy\obj\moc_filesystem.o
@@ -20,8 +23,11 @@ INPUT(
 ./..\..\build\debug\Legacy\obj\moc_helpwidget.o
 ./..\..\build\debug\Legacy\obj\moc_mainwindow.o
 ./..\..\build\debug\Legacy\obj\moc_menuentry.o
-./..\..\build\debug\Legacy\obj\moc_newswidget.o
 ./..\..\build\debug\Legacy\obj\moc_rusificationwidget.o
 ./..\..\build\debug\Legacy\obj\moc_settingswidget.o
 ./..\..\build\debug\Legacy\obj\moc_statuswidget.o
+./..\..\build\debug\Legacy\obj\moc_serverstatuswidget.o
+./..\..\build\debug\Legacy\obj\moc_weeklycodewidget.o
+./..\..\build\debug\Legacy\obj\moc_newslistwidget.o
+./..\..\build\debug\Legacy\obj\moc_newspiece.o
 );

+ 8 - 2
src/Legacy/object_script.Legacy.Release

@@ -6,11 +6,14 @@ INPUT(
 ./..\..\build\release\Legacy\obj\helpwidget.o
 ./..\..\build\release\Legacy\obj\mainwindow.o
 ./..\..\build\release\Legacy\obj\menuentry.o
-./..\..\build\release\Legacy\obj\newswidget.o
 ./..\..\build\release\Legacy\obj\rusificationtreeitem.o
 ./..\..\build\release\Legacy\obj\rusificationwidget.o
 ./..\..\build\release\Legacy\obj\settingswidget.o
 ./..\..\build\release\Legacy\obj\statuswidget.o
+./..\..\build\release\Legacy\obj\serverstatuswidget.o
+./..\..\build\release\Legacy\obj\weeklycodewidget.o
+./..\..\build\release\Legacy\obj\newslistwidget.o
+./..\..\build\release\Legacy\obj\newspiece.o
 ./..\..\build\release\Legacy\obj\legacy_plugin_import.o
 ./..\..\build\release\Legacy\obj\moc_downloader.o
 ./..\..\build\release\Legacy\obj\moc_filesystem.o
@@ -18,8 +21,11 @@ INPUT(
 ./..\..\build\release\Legacy\obj\moc_helpwidget.o
 ./..\..\build\release\Legacy\obj\moc_mainwindow.o
 ./..\..\build\release\Legacy\obj\moc_menuentry.o
-./..\..\build\release\Legacy\obj\moc_newswidget.o
 ./..\..\build\release\Legacy\obj\moc_rusificationwidget.o
 ./..\..\build\release\Legacy\obj\moc_settingswidget.o
 ./..\..\build\release\Legacy\obj\moc_statuswidget.o
+./..\..\build\release\Legacy\obj\moc_serverstatuswidget.o
+./..\..\build\release\Legacy\obj\moc_weeklycodewidget.o
+./..\..\build\release\Legacy\obj\moc_newslistwidget.o
+./..\..\build\release\Legacy\obj\moc_newspiece.o
 );

File diff suppressed because it is too large
+ 577 - 571
src/Legacy/widgets/helpwidget.ui


+ 7 - 16
src/Legacy/widgets/mainwindow.cpp

@@ -23,13 +23,11 @@ MainWindow::MainWindow(QWidget *parent) :
     status_widget = new StatusWidget(this);
     rusification_widget = new RusificationWidget(this);
     settings_widget = new SettingsWidget(this);
-    news_widget = new NewsWidget(this);
     help_widget = new HelpWidget(this);
 
     ui->content_layout->addWidget(status_widget);
     ui->content_layout->addWidget(rusification_widget);
     ui->content_layout->addWidget(settings_widget);
-    ui->content_layout->addWidget(news_widget);
     ui->content_layout->addWidget(help_widget);
 
     ui->centralWidget->setStyleSheet("");
@@ -83,11 +81,11 @@ void MainWindow::resizeEvent(QResizeEvent * event)
     int width = event->size().width();
     int height = event->size().height();
 
-    ui->menu_widget->move(width * 675 / 2000, height * 80 / 1296);
-    ui->menu_widget->resize(width * 1260 / 2000, height * 90 / 1296);
+    ui->menu_widget->move(width * 293 / 900, height * 35 / 650);
+    ui->menu_widget->resize(width * 571 / 900, height * 51 / 650);
 
-    ui->content_area->move(width * 25 / 2000, height * 250 / 1296);
-    ui->content_area->resize(width * 1950 / 2000, height * 1000 / 1296);
+    ui->content_area->move(0, height * 110 / 650);
+    ui->content_area->resize(width * 900 / 900, height * 515 / 650);
     setupWindowBackgroundAndMask(current_bg);
 }
 
@@ -155,17 +153,12 @@ void MainWindow::on_menuentry_3_common_clicked()
 }
 
 void MainWindow::on_menuentry_4_common_clicked()
-{
-    hideAllContentWidgets();
-    news_widget->show();
-}
-
-void MainWindow::on_menuentry_5_common_clicked()
 {
     hideAllContentWidgets();
     help_widget->show();
 }
 
+
 void MainWindow::onHoverMenuentry()
 {
     moveMenuHoverWidget(MenuEntry::getHoverLabel());
@@ -198,7 +191,6 @@ void MainWindow::setupMenuHoverWidget()
     connect(ui->menuentry_2_common, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
     connect(ui->menuentry_3_common, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
     connect(ui->menuentry_4_common, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
-    connect(ui->menuentry_5_common, &MenuEntry::hover_label_changed, this, &MainWindow::onHoverMenuentry);
 
     MenuEntry::setActiveLabel(ui->menuentry_1_common);
     menu_hover_checker_timer.setInterval(500);
@@ -227,8 +219,6 @@ void MainWindow::moveMenuHoverWidget(MenuEntry *target)
     ui->menuentry_2_common->raise();
     ui->menuentry_3_common->raise();
     ui->menuentry_4_common->raise();
-    ui->menuentry_5_common->raise();
-
 }
 
 void MainWindow::checkMenuIsHovered()
@@ -247,7 +237,6 @@ void MainWindow::hideAllContentWidgets()
     status_widget->hide();
     rusification_widget->hide();
     settings_widget->hide();
-    news_widget->hide();
     help_widget->hide();
 }
 
@@ -258,6 +247,8 @@ void MainWindow::changeFontSizeRecursive(size_t percent, QWidget *widget)
     QFont widget_font = widget->font();
     QString widget_name = widget->objectName();
 
+    if (widget_name.contains("_small"))
+        widget_font.setPixelSize(small_font_size * percent / 100);
     if (widget_name.contains("_common"))
         widget_font.setPixelSize(common_font_size * percent / 100);
     if (widget_name.contains("_title"))

+ 2 - 5
src/Legacy/widgets/mainwindow.h

@@ -10,7 +10,6 @@
 #include "statuswidget.h"
 #include "rusificationwidget.h"
 #include "settingswidget.h"
-#include "newswidget.h"
 #include "helpwidget.h"
 
 namespace Ui {
@@ -48,8 +47,6 @@ private slots:
 
     void on_menuentry_4_common_clicked();
 
-    void on_menuentry_5_common_clicked();
-
     void onHoverMenuentry();
 
     void on_closeButton_clicked();
@@ -75,7 +72,6 @@ private:
     StatusWidget *status_widget;
     RusificationWidget *rusification_widget;
     SettingsWidget *settings_widget;
-    NewsWidget *news_widget;
     HelpWidget *help_widget;
 
     QWidget* menuHoverWidget;
@@ -92,7 +88,8 @@ private:
 
     const int MAX_PIXMAP_ID = 14;
 
-    const size_t common_font_size = 15;
+    const size_t small_font_size = 13;
+    const size_t common_font_size = 14;
     const size_t title_font_size = 17;
     const size_t supertitle_font_size = 32;
     const size_t bigbutton_font_size = 22;

+ 17 - 49
src/Legacy/widgets/mainwindow.ui

@@ -45,9 +45,9 @@
     <property name="geometry">
      <rect>
       <x>0</x>
-      <y>129</y>
-      <width>901</width>
-      <height>501</height>
+      <y>110</y>
+      <width>900</width>
+      <height>515</height>
      </rect>
     </property>
     <property name="sizePolicy">
@@ -67,24 +67,31 @@
       <number>20</number>
      </property>
      <property name="topMargin">
-      <number>10</number>
+      <number>0</number>
      </property>
      <property name="rightMargin">
       <number>20</number>
      </property>
      <property name="bottomMargin">
-      <number>10</number>
+      <number>0</number>
+     </property>
+     <property name="spacing">
+      <number>0</number>
      </property>
      <item row="0" column="0">
-      <layout class="QGridLayout" name="content_layout"/>
+      <layout class="QGridLayout" name="content_layout">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+      </layout>
      </item>
     </layout>
    </widget>
    <widget class="QWidget" name="menu_widget" native="true">
     <property name="geometry">
      <rect>
-      <x>300</x>
-      <y>40</y>
+      <x>293</x>
+      <y>35</y>
       <width>571</width>
       <height>51</height>
      </rect>
@@ -101,7 +108,7 @@
     <property name="styleSheet">
      <string notr="true">border-image:transparent;</string>
     </property>
-    <layout class="QHBoxLayout" name="horizontalLayout" stretch="6,7,13,7,6,0">
+    <layout class="QHBoxLayout" name="horizontalLayout" stretch="6,7,13,6,0">
      <property name="spacing">
       <number>10</number>
      </property>
@@ -245,45 +252,6 @@
      </item>
      <item>
       <widget class="MenuEntry" name="menuentry_4_common">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="minimumSize">
-        <size>
-         <width>0</width>
-         <height>0</height>
-        </size>
-       </property>
-       <property name="font">
-        <font>
-         <family>Constantia</family>
-        </font>
-       </property>
-       <property name="mouseTracking">
-        <bool>true</bool>
-       </property>
-       <property name="styleSheet">
-        <string notr="true">color:rgb(255, 255, 255);</string>
-       </property>
-       <property name="text">
-        <string> НОВОСТИ </string>
-       </property>
-       <property name="scaledContents">
-        <bool>true</bool>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignCenter</set>
-       </property>
-       <property name="flat" stdset="0">
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="MenuEntry" name="menuentry_5_common">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
          <horstretch>0</horstretch>
@@ -311,7 +279,7 @@
         <string notr="true">color:rgb(255, 255, 255);</string>
        </property>
        <property name="text">
-        <string>  ПОМОЩЬ  </string>
+        <string>О НАСЛЕДИИ</string>
        </property>
        <property name="scaledContents">
         <bool>true</bool>

+ 94 - 0
src/Legacy/widgets/newslistwidget.cpp

@@ -0,0 +1,94 @@
+#include "newslistwidget.h"
+#include <QtConcurrent/QtConcurrent>
+#include <QLabel>
+#include <QStringList>
+#include <QSpacerItem>
+#include <widgets/newspiece.h>
+
+NewsListWidget::NewsListWidget(QWidget *parent) : QWidget(parent)
+{
+    news_downloader.targetBytearray = &news_data;
+    news_downloader.setUrl(QUrl("http://translate.lotros.ru/groupware/launcher_news"));
+
+    news_layout = new QVBoxLayout(this);
+    news_layout->setSpacing(7);
+    news_layout->setObjectName(QStringLiteral("news_layout"));
+    news_layout->setContentsMargins(11, 11, 11, 11);
+
+    connect(&news_update_timer, &QTimer::timeout, &news_downloader, &Downloader::start);
+    connect(&news_downloader, &Downloader::downloadFinished, this, &NewsListWidget::updateNews);
+    emit news_downloader.start();
+    news_update_timer.setInterval(1000 * 60); // 60 seconds;
+    news_update_timer.start();
+}
+
+NewsListWidget::~NewsListWidget()
+{
+    news_update_timer.stop();
+}
+
+void NewsListWidget::updateNews()
+{
+    if (!qApp)
+        return;
+
+    if (news_data.size() == 0) {
+        constructNewsPiece(0, "Не могу загрузить новости", "Загрузка новостей не удалась. Чтобы просмотреть новости, перейдите на <a href='http://translate.lotros.ru/news'>http://translate.lotros.ru/news</a>", "http://translate.lotros.ru/news");
+        return;
+    }
+
+    QStringList news_list = QString(news_data).split(":::");
+    news_data.clear();
+
+    for (int i = 0; i < news_list.size(); i++) {
+        QStringList news_piece = news_list[i].split("|");
+
+        QString img_src = news_piece[0];
+        QString news_title = news_piece[1];
+        QString news_desrc = news_piece[2];
+        QString news_src = news_piece[3];
+
+        constructNewsPiece(i, news_title, news_desrc, news_src);
+
+        QtConcurrent::run([i, this, img_src](){
+            Downloader img_dwnld;
+            QByteArray img;
+            img_dwnld.setUrl(QUrl(img_src));
+            img_dwnld.targetBytearray = &img;
+            img_dwnld.start();
+            img_dwnld.waitForDownloaded();
+            QPixmap img_pixmap;
+            img_pixmap.loadFromData(img);
+            setImgToNewsPiece(i, img_pixmap);
+        });
+    }
+
+    QSpacerItem* verticalSpacer = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
+    news_layout->addItem(verticalSpacer);
+}
+
+void NewsListWidget::constructNewsPiece(int piece_id, QString title, QString text, QString news_src)
+{
+    NewsPiece* old_piece = findChild<NewsPiece*>("news_piece_" + QString::number(piece_id));
+
+    if (old_piece) {
+        news_layout->removeWidget(old_piece);
+        old_piece->deleteLater();
+    }
+
+    NewsPiece* news_piece = new NewsPiece(this);
+    news_piece->setObjectName(QStringLiteral("news_piece_") + QString::number(piece_id));
+    news_piece->setIcon(QPixmap(QString::fromUtf8(":/appicon.ico")).scaled(40, 40));
+    news_piece->setTitle(title, news_src);
+    news_piece->setContents(text);
+
+    news_layout->addWidget(news_piece, piece_id, 0);
+}
+
+void NewsListWidget::setImgToNewsPiece(int piece_id, QPixmap img)
+{
+    NewsPiece* piece = findChild<NewsPiece*>("news_piece_" + QString::number(piece_id));
+    if (!piece)
+        return;
+    piece->setIcon(img);
+}

+ 16 - 13
src/Legacy/widgets/newswidget.h → src/Legacy/widgets/newslistwidget.h

@@ -1,21 +1,20 @@
-#ifndef NEWSWIDGET_H
-#define NEWSWIDGET_H
+#ifndef NEWSLISTWIDGET_H
+#define NEWSLISTWIDGET_H
 
 #include <QWidget>
-#include <QTimer>
+#include <QVBoxLayout>
 #include "models/downloader.h"
+#include <QTimer>
 
-namespace Ui {
-class NewsWidget;
-}
-
-class NewsWidget : public QWidget
+class NewsListWidget : public QWidget
 {
     Q_OBJECT
-
 public:
-    explicit NewsWidget(QWidget *parent = 0);
-    ~NewsWidget();
+    explicit NewsListWidget(QWidget *parent = nullptr);
+    ~NewsListWidget();
+
+signals:
+    void newsUpdated();
 
 public slots:
     void updateNews();
@@ -25,10 +24,14 @@ private:
     void setImgToNewsPiece(int piece_id, QPixmap img);
 
 private:
-    Ui::NewsWidget *ui;
+    QVBoxLayout* news_layout;
     QTimer news_update_timer;
     QByteArray news_data;
     Downloader news_downloader;
+
+signals:
+
+public slots:
 };
 
-#endif // NEWSWIDGET_H
+#endif // NEWSLISTWIDGET_H

+ 62 - 0
src/Legacy/widgets/newspiece.cpp

@@ -0,0 +1,62 @@
+#include "newspiece.h"
+#include "ui_newspiece.h"
+#include <QDebug>
+
+NewsPiece::NewsPiece(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::NewsPiece)
+{
+    ui->setupUi(this);
+}
+
+void NewsPiece::setTitle(const QString &title, const QString &url)
+{
+    _title = title;
+    _url = url;
+    ui->news_head_small->setText("<a style=\"color: #cfa644; text-decoration:none;\" href = '" + url + "'>" + title + "</a>");
+}
+
+void NewsPiece::setDate(const QString &date)
+{
+    ui->news_date_small->setText(date);
+}
+
+void NewsPiece::setContents(const QString &contents)
+{
+    ui->news_content_small->setText(contents);
+}
+
+void NewsPiece::setIcon(const QPixmap &pixmap)
+{
+    ui->news_icon->setPixmap(pixmap.scaled(ui->news_icon->sizeHint()));
+}
+
+QString NewsPiece::getTitle()
+{
+    return _title;
+}
+
+QString NewsPiece::getUrl()
+{
+    return _url;
+}
+
+QString NewsPiece::getDate()
+{
+    return ui->news_date_small->text();
+}
+
+QString NewsPiece::getContents()
+{
+    return ui->news_content_small->text();
+}
+
+QPixmap NewsPiece::getIcon()
+{
+    return *ui->news_icon->pixmap();
+}
+
+NewsPiece::~NewsPiece()
+{
+    delete ui;
+}

+ 36 - 0
src/Legacy/widgets/newspiece.h

@@ -0,0 +1,36 @@
+#ifndef NEWSPIECE_H
+#define NEWSPIECE_H
+
+#include <QWidget>
+
+namespace Ui {
+class NewsPiece;
+}
+
+class NewsPiece : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit NewsPiece(QWidget *parent = 0);
+
+    void setTitle(const QString &title, const QString &url);
+    void setDate(const QString &date);
+    void setContents(const QString &contents);
+    void setIcon(const QPixmap &pixmap);
+
+    QString getTitle();
+    QString getUrl();
+    QString getDate();
+    QString getContents();
+    QPixmap getIcon();
+
+    ~NewsPiece();
+
+private:
+    QString _title;
+    QString _url;
+    Ui::NewsPiece *ui;
+};
+
+#endif // NEWSPIECE_H

+ 173 - 0
src/Legacy/widgets/newspiece.ui

@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NewsPiece</class>
+ <widget class="QWidget" name="NewsPiece">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>471</width>
+    <height>131</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_2">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QWidget" name="piece_widget" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="styleSheet">
+      <string notr="true">QWidget{
+border-radius: 20px;
+background-color: rgba(30, 0, 0, 100);
+color: white;
+}
+
+QLabel{
+border-radius: 2px;
+background-color:rgba(0,0,0,0);
+}</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <property name="spacing">
+       <number>7</number>
+      </property>
+      <item row="0" column="0" rowspan="2">
+       <widget class="QLabel" name="news_icon">
+        <property name="minimumSize">
+         <size>
+          <width>40</width>
+          <height>40</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>40</width>
+          <height>40</height>
+         </size>
+        </property>
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLabel" name="news_head_small">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>8</pointsize>
+          <weight>75</weight>
+          <bold>true</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true"/>
+        </property>
+        <property name="text">
+         <string>LOOTBOX WEEKEND</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+        <property name="openExternalLinks">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLabel" name="news_date_small">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>8</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true"/>
+        </property>
+        <property name="text">
+         <string>15 ноября 2018 - 19 ноября 2018</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0" colspan="2">
+       <widget class="QLabel" name="news_content_small">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>8</pointsize>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true"/>
+        </property>
+        <property name="text">
+         <string>Уикенд сундуков! Шансы найти окованные ларцы заметно увеличены.</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+        <property name="openExternalLinks">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 0 - 160
src/Legacy/widgets/newswidget.cpp

@@ -1,160 +0,0 @@
-#include "widgets/newswidget.h"
-#include "ui_newswidget.h"
-
-#include "models/downloader.h"
-#include <QtConcurrent/QtConcurrent>
-#include <QLabel>
-
-NewsWidget::NewsWidget(QWidget *parent) :
-    QWidget(parent),
-    ui(new Ui::NewsWidget),
-    news_downloader(this)
-{
-    ui->setupUi(this);
-    ui->test_news_piece->hide();
-
-    news_downloader.targetBytearray = &news_data;
-    news_downloader.setUrl(QUrl("http://translate.lotros.ru/groupware/launcher_news"));
-
-    connect(&news_update_timer, &QTimer::timeout, &news_downloader, &Downloader::start);
-    connect(&news_downloader, &Downloader::downloadFinished, this, &NewsWidget::updateNews);
-    emit news_downloader.start();
-    news_update_timer.setInterval(1000 * 60); // 10 minutes;
-    news_update_timer.start();
-}
-
-NewsWidget::~NewsWidget()
-{
-    news_update_timer.stop();
-    delete ui;
-}
-
-void NewsWidget::updateNews()
-{
-    if (!qApp)
-        return;
-
-    if (news_data.size() == 0) {
-        constructNewsPiece(0, "Не могу загрузить новости", "Загрузка новостей не удалась. Чтобы просмотреть новости, перейдите на <a href='http://translate.lotros.ru/news'>http://translate.lotros.ru/news</a>", "http://translate.lotros.ru/news");
-        return;
-    }
-
-    QStringList news_list = QString(news_data).split(":::");
-    news_data.clear();
-
-    for (int i = 0; i < news_list.size(); i++) {
-        QStringList news_piece = news_list[i].split("|");
-
-        QString img_src = news_piece[0];
-        QString news_title = news_piece[1];
-        QString news_desrc = news_piece[2];
-        QString news_src = news_piece[3];
-
-        constructNewsPiece(i, news_title, news_desrc, news_src);
-
-        QtConcurrent::run([i, this, img_src](){
-            Downloader img_dwnld;
-            QByteArray img;
-            img_dwnld.setUrl(QUrl(img_src));
-            img_dwnld.targetBytearray = &img;
-            img_dwnld.start();
-            img_dwnld.waitForDownloaded();
-            QPixmap img_pixmap;
-            img_pixmap.loadFromData(img);
-            setImgToNewsPiece(i, img_pixmap);
-        });
-    }
-
-    QSpacerItem* verticalSpacer = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
-    ui->news_layout->addItem(verticalSpacer, news_list.size(), 0);
-}
-
-void NewsWidget::constructNewsPiece(int piece_id, QString title, QString text, QString news_src)
-{
-    QWidget* old_piece = findChild<QWidget*>("news_piece_" + QString::number(piece_id));
-
-    if (old_piece) {
-        ui->news_layout->removeWidget(old_piece);
-        old_piece->deleteLater();
-    }
-
-    QWidget* news_piece = new QWidget(this);
-
-    news_piece->setObjectName(QStringLiteral("news_piece_") + QString::number(piece_id));
-    QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
-    sizePolicy.setHorizontalStretch(0);
-    sizePolicy.setVerticalStretch(0);
-    sizePolicy.setHeightForWidth(news_piece->sizePolicy().hasHeightForWidth());
-
-    news_piece->setSizePolicy(sizePolicy);
-    news_piece->setStyleSheet(QLatin1String("QWidget{\n"
-                                            "border-radius: 20px;\n"
-                                            "background-color: rgba(30, 0, 0, 100);\n"
-                                            "color: white;\n"
-                                            "}\n"
-                                            "\n"
-                                            "QLabel{\n"
-                                            "border-radius: 2px;\n"
-                                            "background-color:rgba(0,0,0,0);\n"
-                                            "}"));
-
-    QGridLayout* news_piece_layout = new QGridLayout(news_piece);
-    news_piece_layout->setObjectName(QStringLiteral("news_piece_layout"));
-    news_piece_layout->setContentsMargins(11, 11, 11, 11);
-    news_piece_layout->setSpacing(15);
-
-    QLabel* iconLabel = new QLabel(news_piece);
-    iconLabel->setObjectName(QStringLiteral("news_icon_") + QString::number(piece_id));
-    QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
-    sizePolicy1.setHorizontalStretch(0);
-    sizePolicy1.setVerticalStretch(0);
-    sizePolicy1.setHeightForWidth(iconLabel->sizePolicy().hasHeightForWidth());
-
-    iconLabel->setSizePolicy(sizePolicy1);
-    iconLabel->setMinimumSize(QSize(60, 60));
-    iconLabel->setMaximumSize(QSize(60, 60));
-    iconLabel->setPixmap(QPixmap(QString::fromUtf8(":/assets/appicon.ico")).scaled(60, 60));
-
-    iconLabel->setStyleSheet("border-radius: 10px;");
-
-    news_piece_layout->addWidget(iconLabel, 0, 0, 2, 1);
-
-    QLabel* titleLabel = new QLabel(news_piece);
-    titleLabel->setObjectName(QStringLiteral("titleLabel_title"));
-    sizePolicy.setHeightForWidth(titleLabel->sizePolicy().hasHeightForWidth());
-    titleLabel->setSizePolicy(sizePolicy);
-
-    QFont font;
-    font.setFamily(QStringLiteral("Trajan Pro 3"));
-    font.setPixelSize(12);
-    font.setBold(false);
-    font.setUnderline(false);
-
-    titleLabel->setFont(font);
-    titleLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
-    titleLabel->setWordWrap(true);
-    titleLabel->setText("<a style=\"color: #cfa644; text-decoration:none;\" href = '" + news_src + "'>" + title + "</a>");
-    titleLabel->setOpenExternalLinks(true);
-
-    news_piece_layout->addWidget(titleLabel, 0, 1, 1, 1);
-
-    QLabel* contentLabel = new QLabel(news_piece);
-    contentLabel->setObjectName(QStringLiteral("contentLabel_common"));
-    contentLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
-    contentLabel->setWordWrap(true);
-    contentLabel->setText(text);
-    contentLabel->setSizePolicy(sizePolicy);
-
-    news_piece_layout->addWidget(contentLabel, 1, 1, 1, 1);
-//    app->window.changeFontSizeRecursive(app->properties.value("settings/ui_scale", 100).toInt(), news_piece);
-
-    ui->news_layout->addWidget(news_piece, piece_id, 0);
-}
-
-void NewsWidget::setImgToNewsPiece(int piece_id, QPixmap img)
-{
-    QLabel* old_piece = findChild<QLabel*>("news_icon_" + QString::number(piece_id));
-    if (!old_piece)
-        return;
-    old_piece->setPixmap(img.scaled(60, 60));
-}

+ 0 - 261
src/Legacy/widgets/newswidget.ui

@@ -1,261 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>NewsWidget</class>
- <widget class="QWidget" name="NewsWidget">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>860</width>
-    <height>491</height>
-   </rect>
-  </property>
-  <property name="sizePolicy">
-   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-    <horstretch>0</horstretch>
-    <verstretch>0</verstretch>
-   </sizepolicy>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <widget class="QScrollArea" name="scrollArea">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="autoFillBackground">
-      <bool>false</bool>
-     </property>
-     <property name="styleSheet">
-      <string notr="true">QScrollArea{
-	background: transparent;
-}
-
-QScrollArea &gt; QWidget &gt; QWidget { background: transparent; }
-
-QScrollBar:vertical {
-     border: 0px solid grey;
-     background: transparent;
-     width: 10px;
-     margin: 22px 0 22px 0;
- }
-
- QScrollBar::handle:vertical {
-	background-color: rgba(129, 129, 129, 150);	
-    min-height: 10px;
-	border-radius: 5px;
- }
- QScrollBar::add-line:vertical {
-     border: 0px solid grey;
-     background: transparent;
-     height: 1px;
-     subcontrol-position: bottom;
-     subcontrol-origin: margin;
- }
-
- QScrollBar::sub-line:vertical {
-     border: 0px solid grey;
-     background: transparent;
-     height: 1px;
-     subcontrol-position: top;
-     subcontrol-origin: margin;
- }
- QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
-     border: 0px;
-     width: 3px;
-     height: 3px;
-     background: transparent;
- }
-
- QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
-     background: none;
- }</string>
-     </property>
-     <property name="frameShape">
-      <enum>QFrame::NoFrame</enum>
-     </property>
-     <property name="frameShadow">
-      <enum>QFrame::Plain</enum>
-     </property>
-     <property name="lineWidth">
-      <number>0</number>
-     </property>
-     <property name="horizontalScrollBarPolicy">
-      <enum>Qt::ScrollBarAlwaysOff</enum>
-     </property>
-     <property name="sizeAdjustPolicy">
-      <enum>QAbstractScrollArea::AdjustIgnored</enum>
-     </property>
-     <property name="widgetResizable">
-      <bool>true</bool>
-     </property>
-     <property name="alignment">
-      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
-     </property>
-     <widget class="QWidget" name="scrollAreaWidgetContents">
-      <property name="geometry">
-       <rect>
-        <x>0</x>
-        <y>0</y>
-        <width>838</width>
-        <height>469</height>
-       </rect>
-      </property>
-      <property name="autoFillBackground">
-       <bool>false</bool>
-      </property>
-      <layout class="QGridLayout" name="news_layout">
-       <property name="leftMargin">
-        <number>11</number>
-       </property>
-       <property name="topMargin">
-        <number>11</number>
-       </property>
-       <property name="rightMargin">
-        <number>11</number>
-       </property>
-       <property name="bottomMargin">
-        <number>11</number>
-       </property>
-       <property name="spacing">
-        <number>7</number>
-       </property>
-       <item row="0" column="0">
-        <widget class="QWidget" name="test_news_piece" native="true">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="styleSheet">
-          <string notr="true">QWidget{
-border-radius: 20px;
-background-color: rgba(30, 0, 0, 100);
-color: white;
-}
-
-QLabel{
-border-radius: 2px;
-background-color:rgba(0,0,0,0);
-}</string>
-         </property>
-         <layout class="QGridLayout" name="news_piece_layout">
-          <property name="leftMargin">
-           <number>11</number>
-          </property>
-          <property name="topMargin">
-           <number>11</number>
-          </property>
-          <property name="rightMargin">
-           <number>11</number>
-          </property>
-          <property name="bottomMargin">
-           <number>11</number>
-          </property>
-          <property name="spacing">
-           <number>4</number>
-          </property>
-          <item row="0" column="0" rowspan="2">
-           <widget class="QLabel" name="iconLabel">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="minimumSize">
-             <size>
-              <width>60</width>
-              <height>60</height>
-             </size>
-            </property>
-            <property name="maximumSize">
-             <size>
-              <width>60</width>
-              <height>60</height>
-             </size>
-            </property>
-            <property name="styleSheet">
-             <string notr="true">QWidget{
-border-radius: 10px;
-}</string>
-            </property>
-            <property name="frameShape">
-             <enum>QFrame::NoFrame</enum>
-            </property>
-            <property name="text">
-             <string/>
-            </property>
-            <property name="pixmap">
-             <pixmap resource="../common.qrc">:/assets/buttons/question.png</pixmap>
-            </property>
-           </widget>
-          </item>
-          <item row="0" column="1">
-           <widget class="QLabel" name="titleLabel_title">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="font">
-             <font>
-              <family>Trebuchet MS</family>
-              <pointsize>11</pointsize>
-             </font>
-            </property>
-            <property name="styleSheet">
-             <string notr="true">color: white;
-text-decoration: none;</string>
-            </property>
-            <property name="text">
-             <string>Тестовая новость - Название</string>
-            </property>
-            <property name="alignment">
-             <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-            </property>
-            <property name="wordWrap">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-          <item row="1" column="1">
-           <widget class="QLabel" name="contentLabel">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="text">
-             <string>Контент контент контент контент контент контент контент контент контент контент контент контент</string>
-            </property>
-            <property name="alignment">
-             <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
-            </property>
-            <property name="wordWrap">
-             <bool>false</bool>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources>
-  <include location="../common.qrc"/>
- </resources>
- <connections/>
-</ui>

+ 72 - 0
src/Legacy/widgets/serverstatuswidget.cpp

@@ -0,0 +1,72 @@
+#include "serverstatuswidget.h"
+#include <QApplication>
+#include <QtConcurrent/QtConcurrent>
+#include <QPainter>
+#include <QPaintEvent>
+
+ServerStatusWidget::ServerStatusWidget(QWidget *parent) : QWidget(parent)
+{
+    setAttribute(Qt::WA_Hover);
+    setMouseTracking(true);
+    current_bg = QPixmap(":/flags/flag2.png");
+    changeImageSrc(":/flags/flag2.png");
+}
+
+void ServerStatusWidget::changeImageSrc(const QString &src)
+{
+    if (!qApp)
+        return;
+
+    img_src = src;
+    QPixmap *cur_bg = new QPixmap(current_bg);
+    QPixmap *new_bg= new QPixmap(QPixmap(src));
+
+    QtConcurrent::run([cur_bg, new_bg, src, this](){
+        const int iterations_num = 100;
+        const int iteration_sleep = 20;
+
+        for (int i = 0; i < iterations_num && qApp; i++) {
+            if (img_src != src)
+                break;
+
+            QPainter painter;
+            painter.begin(cur_bg);
+            painter.setOpacity(double(10 + i) / double(iterations_num));
+            painter.setCompositionMode(QPainter::CompositionMode_Source);
+            painter.drawPixmap(0,0, *new_bg);
+            painter.end();
+            bg_lock.lock();
+            current_bg = *cur_bg;
+            bg_lock.unlock();
+            QMetaObject::invokeMethod(this, "repaint", Qt::QueuedConnection);
+            QThread::msleep(iteration_sleep);
+        }
+        delete cur_bg;
+        delete new_bg;
+    });
+
+}
+
+void ServerStatusWidget::enterEvent(QEvent * event)
+{
+    qDebug() << Q_FUNC_INFO << this->objectName();
+    changeImageSrc(":/flags/flag2_hover.png");
+    QWidget::enterEvent(event);
+}
+
+void ServerStatusWidget::paintEvent(QPaintEvent *event)
+{
+    Q_UNUSED(event);
+    QPainter painter;
+    painter.begin(this);
+    painter.drawPixmap(0,0, current_bg);
+    painter.end();
+}
+
+void ServerStatusWidget::leaveEvent(QEvent * event)
+{
+    qDebug() << Q_FUNC_INFO << this->objectName();
+    changeImageSrc(":/flags/flag2.png");
+    QWidget::leaveEvent(event);
+}
+

+ 28 - 0
src/Legacy/widgets/serverstatuswidget.h

@@ -0,0 +1,28 @@
+#ifndef SERVERSTATUSWIDGET_H
+#define SERVERSTATUSWIDGET_H
+
+#include <QWidget>
+#include <QMutex>
+
+class ServerStatusWidget : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit ServerStatusWidget(QWidget *parent = nullptr);
+
+protected:
+    virtual void leaveEvent(QEvent * event) override;
+    virtual void enterEvent(QEvent * event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+signals:
+
+public slots:
+    void changeImageSrc(const QString& src);
+
+private:
+    QMutex bg_lock;
+    QString img_src;
+    QPixmap current_bg;
+};
+
+#endif // SERVERSTATUSWIDGET_H

+ 43 - 0
src/Legacy/widgets/statuswidget.cpp

@@ -1,14 +1,57 @@
 #include "statuswidget.h"
 #include "ui_statuswidget.h"
+#include "widgets/mainwindow.h"
+
+#include <QDesktopServices>
+#include <QUrl>
+#include <QDebug>
+#include <QMessageBox>
 
 StatusWidget::StatusWidget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::StatusWidget)
 {
     ui->setupUi(this);
+    connect(ui->announcements_list, &NewsListWidget::newsUpdated, this, &StatusWidget::invokeUpdateFontSize);
 }
 
 StatusWidget::~StatusWidget()
 {
     delete ui;
 }
+
+void StatusWidget::invokeUpdateFontSize()
+{
+    MainWindow* window = qobject_cast<MainWindow*>(parentWidget()->parentWidget()->parentWidget());
+    window->changeFontSizeRecursive(100, this);
+}
+
+void StatusWidget::on_site_link_button_clicked()
+{
+    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/"));
+}
+
+void StatusWidget::on_forum_link_button_clicked()
+{
+    QDesktopServices::openUrl(QUrl("http://lotros.ru/"));
+}
+
+void StatusWidget::on_guides_link_button_clicked()
+{
+    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/guides"));
+}
+
+void StatusWidget::on_addons_link_button_clicked()
+{
+    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/mathoms"));
+}
+
+void StatusWidget::on_bugreport_link_button_clicked()
+{
+    QDesktopServices::openUrl(QUrl("http://translate.lotros.ru/bugs/add"));
+}
+
+void StatusWidget::on_donate_link_button_clicked()
+{
+    QMessageBox::information(this, "Страницы не существует!", "Нужно создать страницу для доната!");
+}

+ 16 - 0
src/Legacy/widgets/statuswidget.h

@@ -15,6 +15,22 @@ public:
     explicit StatusWidget(QWidget *parent = 0);
     ~StatusWidget();
 
+private slots:
+
+    void invokeUpdateFontSize();
+
+    void on_site_link_button_clicked();
+
+    void on_forum_link_button_clicked();
+
+    void on_guides_link_button_clicked();
+
+    void on_addons_link_button_clicked();
+
+    void on_bugreport_link_button_clicked();
+
+    void on_donate_link_button_clicked();
+
 private:
     Ui::StatusWidget *ui;
 

+ 665 - 276
src/Legacy/widgets/statuswidget.ui

@@ -6,50 +6,99 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>688</width>
-    <height>456</height>
+    <width>860</width>
+    <height>533</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout_3" rowstretch="1,0,0">
-   <item row="2" column="0" colspan="2">
-    <widget class="QWidget" name="widget" native="true">
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <item>
-       <widget class="QLabel" name="label">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
+  <property name="styleSheet">
+   <string notr="true">QLabel {
+color: white;
+}</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_4">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <item row="4" column="1" colspan="2">
+    <widget class="QWidget" name="bottom_widget" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>0</number>
+      </property>
+      <property name="verticalSpacing">
+       <number>0</number>
+      </property>
+      <item row="1" column="0">
+       <widget class="QProgressBar" name="progressBar">
         <property name="minimumSize">
          <size>
           <width>0</width>
-          <height>20</height>
+          <height>25</height>
          </size>
         </property>
         <property name="maximumSize">
          <size>
           <width>16777215</width>
-          <height>20</height>
+          <height>39</height>
          </size>
         </property>
         <property name="styleSheet">
-         <string notr="true">	border-image: url(:/buttons/progressbar.png);
+         <string notr="true">QProgressBar {
+    border: 0px solid grey;
+	border-image: url(:/per.png);
+}
+
+QProgressBar::chunk {
+background-image: url(:/letters.png);
+margin-left:8px;
+margin-right:8px;
+margin-top:7px;
+margin-bottom:7px;
+}
 </string>
         </property>
-        <property name="text">
-         <string>&lt;img src=&quot;:/buttons/progressbar_chunk.png&quot; width=&quot;390&quot; height=&quot;20&quot;/&gt;</string>
+        <property name="maximum">
+         <number>100</number>
         </property>
-        <property name="margin">
-         <number>0</number>
+        <property name="value">
+         <number>50</number>
+        </property>
+        <property name="textVisible">
+         <bool>false</bool>
         </property>
        </widget>
       </item>
-      <item>
+      <item row="1" column="1">
        <widget class="QPushButton" name="game_button">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -118,307 +167,647 @@ QPushButton#game_button:pressed {
         </property>
        </widget>
       </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Установка чего-то - 50%</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
-   <item row="0" column="0" rowspan="2" colspan="2">
-    <widget class="QWidget" name="right_column_widget" native="true">
-     <layout class="QGridLayout" name="gridLayout_2">
-      <item row="1" column="1">
-       <widget class="QWidget" name="buttons_widget" native="true">
+   <item row="0" column="1" rowspan="4">
+    <widget class="QWidget" name="announcements_widget" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>11</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="announcements_title_common">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="font">
+         <font>
+          <family>Trajan Pro 3</family>
+          <pointsize>10</pointsize>
+          <weight>50</weight>
+          <bold>false</bold>
+          <kerning>true</kerning>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">color:white;</string>
+        </property>
+        <property name="text">
+         <string>Новости и события</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QScrollArea" name="announcements_scroll_list">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
           <horstretch>0</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
+        <property name="styleSheet">
+         <string notr="true">QScrollArea{
+	background: transparent;
+	border: 0px solid grey;
+	border-radius: 20px;
+}
+
+QScrollArea &gt; QWidget &gt; QWidget { background: transparent; }
+
+QScrollBar:vertical {
+     border: 0px solid grey;
+     background: transparent;
+     width: 10px;
+     margin: 22px 0 22px 0;
+ }
+
+ QScrollBar::handle:vertical {
+	background-color: rgba(129, 129, 129, 150);	
+    min-height: 10px;
+	border-radius: 5px;
+ }
+ QScrollBar::add-line:vertical {
+     border: 0px solid grey;
+     background: transparent;
+     height: 1px;
+     subcontrol-position: bottom;
+     subcontrol-origin: margin;
+ }
+
+ QScrollBar::sub-line:vertical {
+     border: 0px solid grey;
+     background: transparent;
+     height: 1px;
+     subcontrol-position: top;
+     subcontrol-origin: margin;
+ }
+ QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
+     border: 0px;
+     width: 3px;
+     height: 3px;
+     background: transparent;
+ }
+
+ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
+     background: none;
+ }</string>
+        </property>
+        <property name="sizeAdjustPolicy">
+         <enum>QAbstractScrollArea::AdjustIgnored</enum>
+        </property>
+        <property name="widgetResizable">
+         <bool>true</bool>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+        </property>
+        <widget class="NewsListWidget" name="announcements_list">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>0</y>
+           <width>564</width>
+           <height>429</height>
+          </rect>
+         </property>
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Ignored">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+        </widget>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="2" rowspan="3">
+    <widget class="QWidget" name="button_list" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>180</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_5">
+      <property name="spacing">
+       <number>6</number>
+      </property>
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QWidget" name="widget_2" native="true">
         <property name="minimumSize">
          <size>
-          <width>0</width>
-          <height>80</height>
+          <width>40</width>
+          <height>40</height>
          </size>
         </property>
-        <property name="styleSheet">
-         <string notr="true"/>
-        </property>
         <layout class="QHBoxLayout" name="horizontalLayout">
          <property name="spacing">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="leftMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="topMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="rightMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
          <property name="bottomMargin">
-          <number>1</number>
+          <number>0</number>
          </property>
-        </layout>
-       </widget>
-      </item>
-      <item row="0" column="0" colspan="2">
-       <widget class="QWidget" name="common_status_widget" native="true">
-        <property name="styleSheet">
-         <string notr="true"/>
-        </property>
-        <layout class="QVBoxLayout" name="verticalLayout">
          <item>
-          <widget class="QWidget" name="backup_status" native="true">
-           <property name="styleSheet">
-            <string notr="true">border-radius: 20px;
-background-color: rgba(30, 0, 0, 100);</string>
+          <widget class="QWidget" name="widget_4" native="true">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>32</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>32</width>
+             <height>32</height>
+            </size>
            </property>
-           <layout class="QHBoxLayout" name="horizontalLayout_4">
-            <item>
-             <widget class="QLabel" name="label_4_common">
-              <property name="font">
-               <font>
-                <family>Trajan Pro 3</family>
-                <pointsize>8</pointsize>
-                <weight>50</weight>
-                <bold>false</bold>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>РЕЗЕРВНАЯ КОПИЯ:</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QLabel" name="label_5_common">
-              <property name="font">
-               <font>
-                <family>Trebuchet MS</family>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(85, 170, 255); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>Создание... 50%</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QWidget" name="backup_help" native="true">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="minimumSize">
-               <size>
-                <width>30</width>
-                <height>30</height>
-               </size>
-              </property>
-              <property name="mouseTracking">
-               <bool>true</bool>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">border-image: url(:/assets/question.png); color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
-          </widget>
-         </item>
-         <item>
-          <widget class="QWidget" name="download_status" native="true">
            <property name="styleSheet">
-            <string notr="true">border-radius: 20px;
-background-color: rgba(30, 0, 0, 100);</string>
+            <string notr="true">border-image: url(:/icon_ring.png);</string>
            </property>
-           <layout class="QHBoxLayout" name="horizontalLayout_5">
-            <item>
-             <widget class="QLabel" name="label_8_common">
-              <property name="font">
-               <font>
-                <family>Trajan Pro 3</family>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>ЗАГРУЗКА:</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QLabel" name="label_9_common">
-              <property name="font">
-               <font>
-                <family>Trebuchet MS</family>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(0, 170, 0); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>Все данные загружены</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QWidget" name="download_help" native="true">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="minimumSize">
-               <size>
-                <width>30</width>
-                <height>30</height>
-               </size>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">border-image: url(:/assets/question.png); color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QWidget" name="rusification_status" native="true">
+          <widget class="QWidget" name="widget_5" native="true">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>32</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>32</width>
+             <height>32</height>
+            </size>
+           </property>
            <property name="styleSheet">
-            <string notr="true">border-radius: 20px;
-background-color: rgba(30, 0, 0, 100);</string>
+            <string notr="true">border-image: url(:/quest_icon.png);</string>
            </property>
-           <layout class="QHBoxLayout" name="horizontalLayout_6">
-            <item>
-             <widget class="QLabel" name="label_2_common">
-              <property name="font">
-               <font>
-                <family>Trajan Pro 3</family>
-                <pointsize>8</pointsize>
-                <weight>50</weight>
-                <bold>false</bold>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>РУСИФИКАЦИЯ:</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QLabel" name="label_3_common">
-              <property name="font">
-               <font>
-                <family>Trebuchet MS</family>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(85, 170, 255); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>Установка... (1/5) 50%</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QWidget" name="rusification_help" native="true">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="minimumSize">
-               <size>
-                <width>30</width>
-                <height>30</height>
-               </size>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">border-image: url(:/assets/question.png); color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
           </widget>
          </item>
          <item>
-          <widget class="QWidget" name="protection_status" native="true">
+          <widget class="QWidget" name="widget_3" native="true">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="minimumSize">
+            <size>
+             <width>32</width>
+             <height>32</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>32</width>
+             <height>32</height>
+            </size>
+           </property>
            <property name="styleSheet">
-            <string notr="true">border-radius: 20px;
-background-color: rgba(30, 0, 0, 100);</string>
+            <string notr="true">border-image: url(:/icon_eye.png);</string>
            </property>
-           <layout class="QHBoxLayout" name="horizontalLayout_7">
-            <item>
-             <widget class="QLabel" name="label_6_common">
-              <property name="font">
-               <font>
-                <family>Trajan Pro 3</family>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>ЗАЩИТА ИГРОВЫХ ДАННЫХ:</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QLabel" name="label_7_common">
-              <property name="font">
-               <font>
-                <family>Trebuchet MS</family>
-               </font>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">color: rgb(255, 85, 0); background-color:none;</string>
-              </property>
-              <property name="text">
-               <string>Выключена</string>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QWidget" name="protection_help" native="true">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="minimumSize">
-               <size>
-                <width>30</width>
-                <height>30</height>
-               </size>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">border-image: url(:/assets/question.png); color: rgb(255, 255, 255); background-color:none;</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
           </widget>
          </item>
         </layout>
        </widget>
       </item>
+      <item>
+       <widget class="QPushButton" name="site_link_button">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>20</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QPushButton{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(30, 0, 0, 220);
+color: white;
+}
+
+QPushButton:hover{
+border: 1px solid silver;
+border-radius: 7px;
+color: white;
+background-color: rgba(60, 25, 25, 220);
+}
+
+QPushButton:pressed{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(10, 0, 0, 220);
+color: white;
+}</string>
+        </property>
+        <property name="text">
+         <string>Сайт</string>
+        </property>
+        <property name="flat">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="forum_link_button">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>20</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QPushButton{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(30, 0, 0, 220);
+color: white;
+}
+
+QPushButton:hover{
+border: 1px solid silver;
+border-radius: 7px;
+color: white;
+background-color: rgba(60, 25, 25, 220);
+}
+
+QPushButton:pressed{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(10, 0, 0, 220);
+color: white;
+}</string>
+        </property>
+        <property name="text">
+         <string>Форум</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="guides_link_button">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>20</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QPushButton{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(30, 0, 0, 220);
+color: white;
+}
+
+QPushButton:hover{
+border: 1px solid silver;
+border-radius: 7px;
+color: white;
+background-color: rgba(60, 25, 25, 220);
+}
+
+QPushButton:pressed{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(10, 0, 0, 220);
+color: white;
+}</string>
+        </property>
+        <property name="text">
+         <string>Гайды</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="addons_link_button">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>20</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QPushButton{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(30, 0, 0, 220);
+color: white;
+}
+
+QPushButton:hover{
+border: 1px solid silver;
+border-radius: 7px;
+color: white;
+background-color: rgba(60, 25, 25, 220);
+}
+
+QPushButton:pressed{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(10, 0, 0, 220);
+color: white;
+}</string>
+        </property>
+        <property name="text">
+         <string>Дополнения</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="bugreport_link_button">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>20</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QPushButton{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(30, 0, 0, 220);
+color: white;
+}
+
+QPushButton:hover{
+border: 1px solid silver;
+border-radius: 7px;
+color: white;
+background-color: rgba(60, 25, 25, 220);
+}
+
+QPushButton:pressed{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(10, 0, 0, 220);
+color: white;
+}</string>
+        </property>
+        <property name="text">
+         <string>  Сообщить об ошибке  </string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="donate_link_button">
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>20</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QPushButton{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(30, 0, 0, 220);
+color: white;
+}
+
+QPushButton:hover{
+border: 1px solid silver;
+border-radius: 7px;
+color: white;
+background-color: rgba(60, 25, 25, 220);
+}
+
+QPushButton:pressed{
+border: 1px solid silver;
+border-radius: 7px;
+background-color: rgba(10, 0, 0, 220);
+color: white;
+}</string>
+        </property>
+        <property name="text">
+         <string>Поддержать проект</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="verticalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>20</width>
+          <height>40</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
      </layout>
     </widget>
    </item>
+   <item row="3" column="0">
+    <widget class="ServerStatusWidget" name="server_status_flag" native="true">
+     <property name="minimumSize">
+      <size>
+       <width>124</width>
+       <height>276</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>124</width>
+       <height>276</height>
+      </size>
+     </property>
+     <property name="cursor">
+      <cursorShape>PointingHandCursor</cursorShape>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="WeeklyCodeWidget" name="weekly_code">
+     <property name="minimumSize">
+      <size>
+       <width>130</width>
+       <height>130</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>130</width>
+       <height>130</height>
+      </size>
+     </property>
+     <property name="font">
+      <font>
+       <family>a_AlgeriusNr</family>
+       <pointsize>12</pointsize>
+       <weight>50</weight>
+       <bold>false</bold>
+      </font>
+     </property>
+     <property name="cursor">
+      <cursorShape>PointingHandCursor</cursorShape>
+     </property>
+     <property name="styleSheet">
+      <string notr="true">color: rgb(255, 180, 0);</string>
+     </property>
+     <property name="text">
+      <string>hjb</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="2">
+    <spacer name="verticalSpacer_3">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>30</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="2" column="0">
+    <spacer name="verticalSpacer_4">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="0">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>30</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>ServerStatusWidget</class>
+   <extends>QWidget</extends>
+   <header>widgets/serverstatuswidget.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>WeeklyCodeWidget</class>
+   <extends>QLabel</extends>
+   <header>widgets/weeklycodewidget.h</header>
+  </customwidget>
+  <customwidget>
+   <class>NewsListWidget</class>
+   <extends>QWidget</extends>
+   <header>widgets/newslistwidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>

+ 102 - 0
src/Legacy/widgets/weeklycodewidget.cpp

@@ -0,0 +1,102 @@
+#include "weeklycodewidget.h"
+#include <QApplication>
+#include <QtConcurrent/QtConcurrent>
+#include <QPainter>
+#include <QPaintEvent>
+#include <QClipboard>
+
+WeeklyCodeWidget::WeeklyCodeWidget(QWidget *parent) : QLabel(parent)
+{
+    setAttribute(Qt::WA_Hover);
+    setMouseTracking(true);
+    current_bg = QPixmap(":/buttons/lotr_circle.png").scaled(130, 130);
+    changeImageSrc(":/buttons/lotr_circle.png");
+    setText("ЗАГРУЗКА");
+    code_data = "";
+
+    code_downloader.targetBytearray = &code_data;
+    code_downloader.setUrl(QUrl("http://translate.lotros.ru/coupon.txt"));
+
+    connect(&code_update_timer, &QTimer::timeout, &code_downloader, &Downloader::start);
+    connect(&code_downloader, &Downloader::downloadFinished, this, &WeeklyCodeWidget::updateCode, Qt::QueuedConnection);
+    emit code_downloader.start();
+    code_update_timer.setInterval(1000 * 60); // 1 minute;
+    code_update_timer.start();
+}
+
+void WeeklyCodeWidget::changeImageSrc(const QString &src)
+{
+    if (!qApp)
+        return;
+
+    img_src = src;
+    QPixmap *cur_bg = new QPixmap(current_bg.scaled(130, 130));
+    QPixmap *new_bg= new QPixmap(QPixmap(src).scaled(130, 130));
+
+    QtConcurrent::run([cur_bg, new_bg, src, this](){
+        const int iterations_num = 50;
+        const int iteration_sleep = 40;
+
+        for (int i = 0; i < iterations_num && qApp; i++) {
+            if (img_src != src)
+                break;
+
+            QPainter painter;
+            painter.begin(cur_bg);
+            painter.setOpacity(double(10 + i) / double(iterations_num));
+            painter.setCompositionMode(QPainter::CompositionMode_Source);
+            painter.drawPixmap(0,0, *new_bg);
+            painter.end();
+            bg_lock.lock();
+            current_bg = *cur_bg;
+            bg_lock.unlock();
+            QMetaObject::invokeMethod(this, "repaint", Qt::QueuedConnection);
+            QThread::msleep(iteration_sleep);
+        }
+        delete cur_bg;
+        delete new_bg;
+    });
+
+}
+
+void WeeklyCodeWidget::enterEvent(QEvent * event)
+{
+    changeImageSrc(":/buttons/lotr_circle_hover.png");
+    QWidget::enterEvent(event);
+}
+
+void WeeklyCodeWidget::paintEvent(QPaintEvent *event)
+{
+    QPainter painter;
+    painter.begin(this);
+    painter.drawPixmap(0,0, current_bg);
+    painter.end();
+    QLabel::paintEvent(event);
+}
+
+void WeeklyCodeWidget::mousePressEvent(QMouseEvent *ev)
+{
+    setStyleSheet("color: rgb(255, 150, 0);");
+}
+
+void WeeklyCodeWidget::mouseReleaseEvent(QMouseEvent *ev)
+{
+    setStyleSheet("color: rgb(255, 180, 0);");
+    QApplication::clipboard()->setText(text());
+}
+
+void WeeklyCodeWidget::updateCode()
+{
+    qDebug() << "New code: " << code_data;
+    setText(code_data);
+    repaint();
+    code_data = "";
+}
+
+void WeeklyCodeWidget::leaveEvent(QEvent * event)
+{
+    qDebug() << Q_FUNC_INFO << this->objectName();
+    changeImageSrc(":/buttons/lotr_circle.png");
+    QWidget::leaveEvent(event);
+}
+

+ 41 - 0
src/Legacy/widgets/weeklycodewidget.h

@@ -0,0 +1,41 @@
+#ifndef WEEKLYCODEWIDGET_H
+#define WEEKLYCODEWIDGET_H
+
+#include <QLabel>
+#include <QMutex>
+#include <QTimer>
+
+#include "models/downloader.h"
+
+class WeeklyCodeWidget : public QLabel
+{
+    Q_OBJECT
+public:
+    explicit WeeklyCodeWidget(QWidget* parent = nullptr);
+
+protected:
+    virtual void leaveEvent(QEvent * event) override;
+    virtual void enterEvent(QEvent * event) override;
+    virtual void paintEvent(QPaintEvent *event) override;
+    virtual void mousePressEvent(QMouseEvent *ev) override;
+    virtual void mouseReleaseEvent(QMouseEvent *ev) override;
+signals:
+
+public slots:
+    void updateCode();
+
+private slots:
+    void changeImageSrc(const QString& src);
+
+private:
+    QMutex bg_lock;
+    QString img_src;
+    QPixmap current_bg;
+
+    QByteArray code_data;
+    QTimer code_update_timer;
+    Downloader code_downloader;
+
+};
+
+#endif // WEEKLYCODEWIDGET_H

Some files were not shown because too many files changed in this diff