summaryrefslogtreecommitdiff
path: root/OSSpecific.cpp
blob: 60f5b92ff3295355668d3a67ba461f8cc35d6aa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "OSSpecific.h"
#include "ui_OSSpecific.h"

OSSpecific::OSSpecific(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::OSSpecific)
{
    ui->setupUi(this);
    if(!QIcon::fromTheme(QStringLiteral("dialog-warning")).isNull())
        setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
    updateText();
    #if defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE) || defined(ULTRACOPIER_MODE_SUPERCOPIER)
    setMinimumWidth(0);
    ui->widgetStyle->setVisible(false);
    #endif
    updateGeometry();
    adjustSize();
}

OSSpecific::~OSSpecific()
{
    delete ui;
}

void OSSpecific::updateText()
{
    QString text;
    #if defined(Q_OS_LINUX)
    text=tr("The replacement of default copy/move system is not supported by the file manager (Dolphin, Nautilus, ...).<br />Ask the developer of your file manager to support it.<br />You need do the copy/move manually.");
    #elif defined(Q_OS_WIN32)
    text=tr("Reboot the system if previously had similar software installed (like Teracopy, Supercopier or an earlier version of Ultracopier).");
    #elif defined(Q_OS_MAC)
    text=tr("The replacement of default copy/move system is not supported and blocked by finder of Mac OS X.<br />You need do the copy/move manually by right clicking on the system tray icon near the clock (not the dock icon).");
    #else
    text=tr("The replacement of default copy/move system should be not supported by the file manager.<br />Ask to the developer to support it.<br />You need do the copy/move manually.");
    #endif
    #ifdef ULTRACOPIER_MODE_SUPERCOPIER
    text+=QStringLiteral("<br />")+tr("Consider Supercopier as deprecated, prefer Ultracopier");
    #endif
    ui->label->setText(text);
}

void OSSpecific::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        updateText();
        break;
    default:
        break;
    }
}

bool OSSpecific::dontShowAgain()
{
    return ui->dontShowAgain->isChecked();
}

QString OSSpecific::theme()
{
    #if defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE) || defined(ULTRACOPIER_MODE_SUPERCOPIER)
    return "classic";
    #else
    switch (ui->comboBox->currentIndex()) {
    default:
    case 0:
        return "classic";
    case 1:
        return "modern";
    case 2:
        return "supercopier";
    }
    #endif
}

void OSSpecific::on_pushButton_clicked()
{
    close();
}

void OSSpecific::on_comboBox_currentIndexChanged(int index)
{
    switch(index)
    {
        default:
        case 0:
        ui->themePreview->setPixmap(QPixmap(":/ultracopier-oxygen.png"));
        break;
        case 1:
        ui->themePreview->setPixmap(QPixmap(":/ultracopier-oxygen2.png"));
        break;
        case 2:
        ui->themePreview->setPixmap(QPixmap(":/ultracopier-supercopier.png"));
        break;
    }
}