MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    StringProvider::loadTemplate();

    ui->setupUi(this);

    initLayout();

    sqlLiteProvider = new SqlLiteProvider();
    connect(sqlLiteProvider, SIGNAL(updateEventLogUI(QList<EventLog>)),
            this, SLOT(sloUpdateEventLogUI(QList<EventLog>)));
    sqlLiteProvider->loadDatabase();

    httpProvider = new HttpProvider();
    connect(httpProvider, SIGNAL(sigHttpFinished(QNetworkReply*)),
            this, SLOT(sloHttpFinished(QNetworkReply*)));

    connect(ui->tableScan, SIGNAL(signalInsertLog(EventLog)),
            this, SLOT(slotInsertLog(EventLog)));

    // Load metascan online key
    QSettings qs(SETTINGS_DOMAIN, SETTINGS_USER);
    QString moKey = qs.value(SETTINGS_MO_KEY).toString();
    StringProvider::METASCAN_ONLINE_KEY = moKey;
    if(moKey.isEmpty()) {
        qDebug() << "moKey = NULLLLL";
        SettingsDialog* dialogSettings = new SettingsDialog(this);
        dialogSettings->setModal(true);
        dialogSettings->show();
    } else {
        qDebug() << "moKey = " << moKey;
    }
}
Ejemplo n.º 2
0
void BalanceWindow::on_settingsAction_triggered()
{
    SettingsDialog *d = new SettingsDialog(settings, this);
    connect(d,SIGNAL(testEmail()), this, SLOT(sendEmail()));
    d->setModal(true);
    d->show();
}
Ejemplo n.º 3
0
/**
 * Show Settings dialog.
 */
void KAudioCreator::showSettings(){
    if(KConfigDialog::showDialog("settings"))
        return;

    SettingsDialog *dialog = new SettingsDialog(this, "settings", Prefs::self());
    connect(dialog, SIGNAL(settingsChanged()), ripper, SLOT(loadSettings()));
    connect(dialog, SIGNAL(settingsChanged()), encoder, SLOT(loadSettings()));
    connect(dialog, SIGNAL(settingsChanged()), tracks, SLOT(loadSettings()));
    connect(dialog->encoderConfigImp, SIGNAL(encoderUpdated()), encoder, SLOT(loadSettings()));
    dialog->show();
}
Ejemplo n.º 4
0
int main( int argc, char** argv )
{
    TDEApplication app(argc, argv, "KSpell2Test");

    SettingsDialog *dialog = new SettingsDialog( 0 );

    dialog->show();

    app.setMainWidget( dialog );

    return app.exec();
}
Ejemplo n.º 5
0
void MainWindow::showSettings() {
  SettingsDialog *s = new SettingsDialog(this);

  s->show();

  connect(s, &QDialog::accepted, [&, s, this]() {  // NOLINT
    Settings set;
    toggleAnimeRecognition(
        set.getValue(Settings::AnimeRecognitionEnabled, D_ANIME_RECOGNITION)
            .toBool());

    torrents_enabled =
        set.getValue(Settings::TorrentsEnabled, D_TORRENTS_ENABLED).toBool();

    reloadSmartTitles();
    reloadRules();
  });
}
Ejemplo n.º 6
0
void MainWindow::setupMenu()
{
    //Setup menu
    menuBar = new QMenuBar(centralWidget());
    this->setMenuBar(menuBar);

    QMenu* fileMenu = new QMenu(tr("File"), menuBar);

    QAction *exitAction = new QAction(tr("Exit"), this);
    connect(exitAction, &QAction::triggered, this, &MainWindow::close);

    fileMenu->addAction(exitAction);

    // Profiles

    QMenu* profilesMenu = new QMenu(tr("Profiles"));

    QAction *backToMainPage = new QAction(tr("Back to main page"), this);
    connect(backToMainPage, &QAction::triggered, []() {
        SDK::ProfileManager::instance()->backToMainPage();
    });

    profilesMenu->addAction(backToMainPage);
    profilesMenu->addSection(tr("Profiles"));

    connect(profilesMenu, &QMenu::triggered, [=](QAction* action) {
        SDK::Profile* profile = SDK::ProfileManager::instance()->findById(action->data().toString());
        if(profile != NULL)
            SDK::ProfileManager::instance()->setActiveProfile(profile);
        else
            WARN() << qPrintable(QString("Can't load profile %1 from profiles menu!").arg(action->data().toString()));
    });

    connect(SDK::ProfileManager::instance(), &SDK::ProfileManager::profileChanged, [=](SDK::Profile* profile){
        for(QAction* action: profilesMenu->actions())
        {
            if(action->data().toString() == profile->getId())
            {
                action->setChecked(true);
                profilesMenu->setActiveAction(action);
            }
            else
            {
                action->setChecked(false);
            }
        }
    });

    for(const SDK::Profile* profile: SDK::ProfileManager::instance()->getProfiles())
    {
        if(!profile->hasFlag(SDK::Profile::HIDDEN))
        {
            QAction* loadProfile = new QAction(profile->getName(), profilesMenu);
            loadProfile->setData(profile->getId());
            loadProfile->setCheckable(true);
            loadProfile->setChecked(false);
            profilesMenu->addAction(loadProfile);
        }
    }

    // Video menu
    QMenu* videoMenu = new QMenu(tr("Video"), menuBar);

    QMenu* aspectRatioMenu = new QMenu(tr("Aspect ratio"), videoMenu);

    connect(aspectRatioMenu, &QMenu::triggered, [=](QAction* action){
        if(player())
            player()->setAspectRatio((SDK::AspectRatio) action->data().toInt());
        aspectRatioMenu->setActiveAction(action);
        for(QAction* a: aspectRatioMenu->actions())
        {
            a->setChecked(a == action && player());
        }

    });

    connect(aspectRatioMenu, &QMenu::aboutToShow, [=]{
        if(!player())
            return;

        SDK::AspectRatio current_ratio = player()->getAspectRatio();
        for(QAction* action: aspectRatioMenu->actions())
        {
            SDK::AspectRatio ratio = (SDK::AspectRatio) action->data().toInt();
            if(ratio == current_ratio)
            {
                action->setChecked(true);
            }
            else
            {
                action->setChecked(false);
            }
        }
    });

    QList<QPair<QString, SDK::AspectRatio>> ratios;
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("Auto"),     SDK::ASPECT_RATIO_AUTO));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("1:1"),      SDK::ASPECT_RATIO_1_1));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("5:4"),      SDK::ASPECT_RATIO_5_4));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("4:3"),      SDK::ASPECT_RATIO_4_3));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("11:8"),     SDK::ASPECT_RATIO_11_8));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("14:10"),    SDK::ASPECT_RATIO_14_10));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("3:2"),      SDK::ASPECT_RATIO_3_2));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("14:9"),     SDK::ASPECT_RATIO_14_9));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("16:10"),    SDK::ASPECT_RATIO_16_10));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("16:9"),     SDK::ASPECT_RATIO_16_9));
    ratios.append(QPair<QString, SDK::AspectRatio>(tr("2.35:1"),   SDK::ASPECT_RATIO_2_35_1));

    for(QPair<QString, SDK::AspectRatio> pair: ratios)
    {
        QString name = pair.first;
        SDK::AspectRatio ratio = pair.second;
        QAction* action = new QAction(name, aspectRatioMenu);
        action->setData(ratio);
        action->setCheckable(true);
        action->setChecked(false);
        aspectRatioMenu->addAction(action);
    }

    videoMenu->addMenu(aspectRatioMenu);

    // Audio menu
    QMenu* audioMenu = new QMenu(tr("Audio"), menuBar);
    QMenu* audioTrackMenu = new QMenu(tr("Track"), audioMenu);

    connect(audioTrackMenu, &QMenu::triggered, [=](QAction* action){
        if(!player())
            return;

        player()->setAudioLanguage(action->data().toInt());
        audioTrackMenu->setActiveAction(action);
        for(QAction* a: audioTrackMenu->actions())
        {
            action->setChecked(a == action);
        }
    });

    connect(audioTrackMenu, &QMenu::aboutToShow, [=]{
        audioTrackMenu->clear();
        if(!player())
            return;

        int index = player()->getAudioPID();
        QList<AudioLangInfo> languages = player()->getAudioLanguages();
        for(const AudioLangInfo &lang: languages)
        {
            QAction* action = new QAction(lang.m_code3, audioTrackMenu);
            action->setData(lang.m_pid);
            action->setCheckable(true);
            action->setChecked(lang.m_pid == index);
            audioTrackMenu->addAction(action);
        }
    });

    audioMenu->addMenu(audioTrackMenu);

    // Settings

    QMenu* settingsMenu = new QMenu(tr("Settings"));
    QAction* settingsAction = new QAction(tr("Settings..."), settingsMenu);
    settingsAction->setMenuRole(QAction::PreferencesRole);
    connect(settingsAction, &QAction::triggered, [=]() {
        SettingsDialog* dialog = new SettingsDialog(this);
        dialog->setAttribute( Qt::WA_DeleteOnClose, true );
        dialog->show();
    });
    settingsMenu->addAction(settingsAction);

    QAction* showDevTools = new QAction(tr("Developer tools..."), settingsMenu);
    connect(showDevTools, &QAction::triggered, SDK::Browser::instance(), &SDK::Browser::showDeveloperTools);
    settingsMenu->addAction(showDevTools);

    QAction* toggleFullscreenAction = new QAction(tr("Fullscreen mode"), settingsMenu);
    toggleFullscreenAction->setCheckable(true);
    connect(this, &MainWindow::fullScreenModeToggled, [=](bool fullscreen){
        toggleFullscreenAction->setChecked(fullscreen);
    });
    connect(toggleFullscreenAction, &QAction::triggered, [=]() {
         setAppFullscreen(!isFullScreen());
    });
    settingsMenu->addAction(toggleFullscreenAction);

    //About

    QMenu* aboutMenu = new QMenu(tr("About"));

    QAction* aboutAppAction = new QAction(tr("About application..."), aboutMenu);
    aboutAppAction->setMenuRole(QAction::AboutRole);
    connect(aboutAppAction, &QAction::triggered, [=]() {
       AboutAppDialog dialog;
       dialog.exec();
       dialog.show();
    });


    QAction* aboutPluginsAction = new QAction(tr("About plugins..."), aboutMenu);
    aboutPluginsAction->setMenuRole(QAction::ApplicationSpecificRole);
    connect(aboutPluginsAction, &QAction::triggered, [=]() {
       PluginsDialog dialog;
       dialog.exec();
       dialog.show();
    });

    aboutMenu->addAction(aboutAppAction);
    aboutMenu->addAction(aboutPluginsAction);

    menuBar->addMenu(fileMenu);
    menuBar->addMenu(videoMenu);
    menuBar->addMenu(audioMenu);
    menuBar->addMenu(profilesMenu);
    menuBar->addMenu(settingsMenu);
    menuBar->addMenu(aboutMenu);

    m_menuItems.append(fileMenu);
    m_menuItems.append(videoMenu);
    m_menuItems.append(audioMenu);
    m_menuItems.append(profilesMenu);
    m_menuItems.append(settingsMenu);
}
Ejemplo n.º 7
0
void Application::showSettings()
{
	SettingsDialog *s = new SettingsDialog( activeWindow() );
	s->addAction( d->closeAction );
	s->show();
}
Ejemplo n.º 8
0
void OutputOSSFactory::showSettings(QWidget* parent)
{
    SettingsDialog *s = new SettingsDialog(parent);
    s->show();
}
Ejemplo n.º 9
0
void MainWindow::showPreferences()
{
	SettingsDialog *dialog = new SettingsDialog(this);
	dialog->show();
}
Ejemplo n.º 10
0
void DecoderCUEFactory::showSettings(QWidget *parent)
{
     SettingsDialog *s = new SettingsDialog(parent);
     s->show();
}
Ejemplo n.º 11
0
void DecoderWildMidiFactory::showSettings(QWidget *parent)
{
    SettingsDialog *d = new SettingsDialog(parent);
    d->show();
}
Ejemplo n.º 12
0
//Вызов диалога настроек
void MainWindow::on_settings_triggered()
{
    SettingsDialog *sd = new SettingsDialog;
    connect(sd,SIGNAL(smthChanged()),this,SLOT(refreshAllTabs()));
    sd->show();
}
Ejemplo n.º 13
0
void OutputQtMultimediaFactory::showSettings(QWidget* parent)
{
    SettingsDialog *s = new SettingsDialog(parent);
    s->show();
}