| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr Krzemiński <[email protected]> |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or modify |
| 6 | ** it under the terms of the GNU General Public License as published by |
| 7 | ** the Free Software Foundation; either version 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #include "frmsummary.h"cxx . . $ `<file>/gui/src/forms/frmsummary.h`/ |
| 16 | #include "libqnapi.h"cxx . . $ `<file>/libqnapi/src/libqnapi.h`/ |
| 17 | |
| 18 | #include "subdatawidget.h"cxx . . $ `<file>/gui/src/forms/subdatawidget.h`/ |
| 19 | |
| 20 | #include <QDesktopWidget> |
| 21 | #include <QListWidget> |
| 22 | |
| 23 | frmSummarycxx . . $ frmSummary#::frmSummarycxx . . $ frmSummary#frmSummary(872e7b0c281abd8d).(QWidgetcxx . . $ QWidget# *parent, Qtcxx . . $ Qt/::WindowFlagscxx . . $ Qt/WindowFlags# f) |
| 24 | : QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(parent, f) { |
| 25 | uicxx . . $ frmSummary#ui..setupUicxx . . $ Ui_frmSummary#setupUi(d194de0c0f68c28b).(this); |
| 26 | |
| 27 | setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).(Qtcxx . . $ Qt/::WA_QuitOnClosecxx . . $ Qt/WA_QuitOnClose., false); |
| 28 | |
| 29 | QRectcxx . . $ QRect# position = frameGeometrycxx . . $ QWidget#frameGeometry(d857385bac04cbf7).(); |
| 30 | position.moveCentercxx . . $ QRect#moveCenter(4f9e9534be445c03).(QDesktopWidgetcxx . . $ QDesktopWidget#QDesktopWidget(49f6e7a06ebc5aa8).().availableGeometrycxx . . $ QDesktopWidget#availableGeometry(b336661e7197c5cf).().centercxx . . $ QRect#center(75d69cfbd3c4b2dd).()); |
| 31 | movecxx . . $ QWidget#move(4f9e9534be445c03).(position.topLeftcxx . . $ QRect#topLeft(75d69cfbd3c4b2dd).()); |
| 32 | } |
| 33 | |
| 34 | void frmSummarycxx . . $ frmSummary#::setSummaryListcxx . . $ frmSummary#setSummaryList(c7147d9aa3ca1a89).(QListcxx . . $ QList#<SubtitleInfocxx . . $ SubtitleInfo#> list) { |
| 35 | stdcxx . . $ std/::sortcxx . . $ std/sort(249673c20e2b8d5).(listcxx . . $ QList#iterator#iterator(fe70663a9b8f3744)..begincxx . . $ QList#begin(ca2520f641887418).(), listcxx . . $ QList#iterator#iterator(fe70663a9b8f3744)..endcxx . . $ QList#end(ca2520f641887418).()); |
| 36 | |
| 37 | QIconcxx . . $ QIcon# succIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/ui/accept.png"cxx . . $ QString#QString(85c52e162fed56f9).), failIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/ui/exclamation.png"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 38 | |
| 39 | uicxx . . $ frmSummary#ui..lwSummarycxx . . $ Ui_frmSummary#lwSummary.->clearcxx . . $ QListWidget#clear(49f6e7a06ebc5aa8).(); |
| 40 | uicxx . . $ frmSummary#ui..lwSummarycxx . . $ Ui_frmSummary#lwSummary.->setFocusPolicycxx . . $ QWidget#setFocusPolicy(84f385f4ea7c1696).(Qtcxx . . $ Qt/::NoFocuscxx . . $ Qt/NoFocus.); |
| 41 | |
| 42 | int i = 0, goodCount = 0, badCount = 0; |
| 43 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (SubtitleInfo s, list) { |
| 44 | bool isGood = s.resolutioncxx . . $ SubtitleInfo#resolution. != SUBTITLE_NONEcxx . . $ SUBTITLE_NONE.; |
| 45 | |
| 46 | QListWidgetItemcxx . . $ QListWidgetItem# *listItem = new QListWidgetItemcxx . . $ QListWidgetItem#(); |
| 47 | |
| 48 | uicxx . . $ frmSummary#ui..lwSummarycxx . . $ Ui_frmSummary#lwSummary.->addItemcxx . . $ QListWidget#addItem(13c1c8ad030616f4).(listItem); |
| 49 | |
| 50 | subDataWidgetcxx . . $ subDataWidget# *subData = new subDataWidgetcxx . . $ subDataWidget#(); |
| 51 | |
| 52 | if (isGood) { |
| 53 | ++goodCount; |
| 54 | QStringcxx . . $ QString# lang_path = QStringcxx . . $ QString#QString(3520e46b33348bf6).(":/languages/") +cxx . . $ operator+(fab9b4f80031f353). s.langcxx . . $ SubtitleInfo#lang. +cxx . . $ operator+(3d22f08efddf8107). ".png"; |
| 55 | QIconcxx . . $ QIcon# engineIcon = |
| 56 | QIconcxx . . $ QIcon#QIcon(47c487586538d025).(QPixmapcxx . . $ QPixmap#QPixmap(ac4b840ac9fbb56d).(enginesRegistrycxx . . $ frmSummary#enginesRegistry.->cxx . . $ QSharedPointer#`operator->`(5a2a78a048fb49a8).enginePixmapDatacxx . . $ SubtitleDownloadEnginesRegistry#enginePixmapData(9d6760e3d9ac89d6).(s.enginecxx . . $ SubtitleInfo#engine.))); |
| 57 | subData->setSubDatacxx . . $ subDataWidget#setSubData(b35e717811addf08).(succIcon, scxx . . $ QString#QString(3520e46b33348bf6)..namecxx . . $ SubtitleInfo#name., QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(lang_path), engineIcon); |
| 58 | } else { |
| 59 | ++badCount; |
| 60 | subData->setSubDatacxx . . $ subDataWidget#setSubData(13e59de15fd6a62b).(failIcon, scxx . . $ QString#QString(3520e46b33348bf6)..namecxx . . $ SubtitleInfo#name.); |
| 61 | } |
| 62 | |
| 63 | uicxx . . $ frmSummary#ui..lwSummarycxx . . $ Ui_frmSummary#lwSummary.->setItemWidgetcxx . . $ QListWidget#setItemWidget(52e0224c3872482c).(listItem, subData); |
| 64 | listItem->setSizeHintcxx . . $ QListWidgetItem#setSizeHint(1c5f201b4c2f0aba).(subData->sizeHintcxx . . $ QWidget#sizeHint(4b3b776e5ee2b367).()); |
| 65 | |
| 66 | ++i; |
| 67 | } |
| 68 | |
| 69 | uicxx . . $ frmSummary#ui..lwSummarycxx . . $ Ui_frmSummary#lwSummary.->setMinimumWidthcxx . . $ QWidget#setMinimumWidth(d4f767463ce0a6b3).(uicxx . . $ frmSummary#ui..lwSummarycxx . . $ Ui_frmSummary#lwSummary.->sizeHintForColumncxx . . $ QAbstractItemView#sizeHintForColumn(7ccb52b1bfe01045).(0) + 20); |
| 70 | this->adjustSizecxx . . $ QWidget#adjustSize(49f6e7a06ebc5aa8).(); |
| 71 | |
| 72 | uicxx . . $ frmSummary#ui..lbSuccesscxx . . $ Ui_frmSummary#lbSuccess.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(goodCount != 0); |
| 73 | uicxx . . $ frmSummary#ui..lbFailcxx . . $ Ui_frmSummary#lbFail.->setVisiblecxx . . $ QWidget#setVisible(b45ddcbc8423892c).(badCount != 0); |
| 74 | |
| 75 | uicxx . . $ frmSummary#ui..lbSuccesscxx . . $ Ui_frmSummary#lbSuccess.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ frmSummary#tr(75d9f1c324b4579d).("Subtitles downloaded for %1 %2") |
| 76 | .argcxx . . $ QString#arg(64ab2ed17cc11715).(goodCount) |
| 77 | .argcxx . . $ QString#arg(bc823072288cbbb5).(goodCount > 1 ? trcxx . . $ QString#QString(e1217c004a86c950).("files") : trcxx . . $ QString#QString(e1217c004a86c950).("file"))); |
| 78 | uicxx . . $ frmSummary#ui..lbFailcxx . . $ Ui_frmSummary#lbFail.->setTextcxx . . $ QLabel#setText(3520e46b33348bf6).(trcxx . . $ frmSummary#tr(75d9f1c324b4579d).("Could not download subtitles for %1 %2") |
| 79 | .argcxx . . $ QString#arg(64ab2ed17cc11715).(badCount) |
| 80 | .argcxx . . $ QString#arg(bc823072288cbbb5).(badCount > 1 ? trcxx . . $ QString#QString(e1217c004a86c950).("files") : trcxx . . $ QString#QString(e1217c004a86c950).("file"))); |
| 81 | } |