Ejemplo n.º 1
0
void Application::init()
{
    #if defined Q_OS_WIN
    ProxyStyle *proxy=new ProxyStyle(ProxyStyle::VF_Side);
    #elif defined Q_OS_MAC
    ProxyStyle *proxy=new ProxyStyle(ProxyStyle::VF_Side|ProxyStyle::VF_Top);
    #else
    ProxyStyle *proxy=new ProxyStyle(0);
    #endif
    QString theme = Settings::self()->style();
    if (!theme.isEmpty()) {
        QStyle *s=QApplication::setStyle(theme);
        if (s) {
            proxy->setBaseStyle(s);
        }
    }
    qApp->setStyle(proxy);

    #ifdef Q_OS_WIN
    // Qt does not seem to consistently apply the application font under Windows.
    // To work-around this, set the application font to that used for a listview.
    // Issues #1097 and #1109
    QListView view;
    view.ensurePolished();
    QApplication::setFont(view.font());
    #endif

    // Ensure these objects are created in the GUI thread...
    ThreadCleaner::self();
    MPDStatus::self();
    MPDStats::self();
    #ifdef ENABLE_TAGLIB
    TagHelperIface::self();
    #endif
    Scrobbler::self();
    MpdLibraryModel::self();

    // Ensure this is started before any MPD connection
    HttpServer::self();

    Utils::initRand();
    Song::initTranslations();

    // Init sizes (before any widgets constructed!)
    ItemView::setup();
    FancyTabWidget::setup();
    GroupedView::setup();
    ActionItemDelegate::setup();
}