Exemple #1
0
UIConfig::UIConfig(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::UIConfig)
{
    ui->setupUi(this);

    _removing_thumbnails = false;

    settings = new QSettings("settings.ini", QSettings::IniFormat);
    timeoutValueEditor = new UIListEditor(this);
    timeoutValueEditor->setModal(true);

    dialogFolderShortcut = new DialogFolderShortcut(this);
    dialogFolderShortcut->setModal(true);

    userAgentStrings.insert("Wget", "Wget/1.12");
    userAgentStrings.insert("Opera", "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14");
    userAgentStrings.insert("Firefox", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0");
    userAgentStrings.insert("Chrome", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36");

    loadSettings();
    loadShortcuts();

    connect(timeoutValueEditor, SIGNAL(valuesChanged()), this, SLOT(loadSettings()));
    connect(ui->cbUseProxy, SIGNAL(toggled(bool)), this, SLOT(toggleProxy(bool)));
    connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(editShortcutItem(QListWidgetItem*)));
    connect(folderShortcuts, SIGNAL(shortcutsChanged()), this, SLOT(loadShortcuts()));
    connect(dialogFolderShortcut, SIGNAL(shortcutChanged(QString,QString,QString)), folderShortcuts, SLOT(updateShortcut(QString,QString,QString)));
    connect(dialogFolderShortcut, SIGNAL(editCanceled()), this, SLOT(loadShortcuts()));
    connect(ui->btnDeleteAllThumbnails, SIGNAL(clicked()), this, SIGNAL(deleteAllThumbnails()));
    connect(ui->btnDeleteAllThumbnails, SIGNAL(clicked()), this, SLOT(thumbnailDeletionStarted()));
}
ShortcutConfigDialog::ShortcutConfigDialog(QWidget *parent)
    : QDialog(parent)
{
    setModal(true);
    setWindowTitle(tr("Configure Shortcuts") + QLatin1String(" - ") + QApplication::applicationName());

    m_shortcutConfigWidget = new ShortcutConfigWidget(this);
    connect(m_shortcutConfigWidget, SIGNAL(shortcutsChanged(QHash<QString,ActionDescription>)), this, SIGNAL(shortcutsChanged(QHash<QString,ActionDescription>)));

    QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
    buttonBox->addButton(QDialogButtonBox::Ok);
    buttonBox->addButton(QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QWidget *buttonWidget = new QWidget(this);
    QHBoxLayout *buttonLayout = new QHBoxLayout(buttonWidget);
    buttonLayout->addWidget(m_shortcutConfigWidget->clearButton());
    buttonLayout->addWidget(m_shortcutConfigWidget->useDefaultButton());
    buttonLayout->addStretch();
    buttonLayout->addWidget(buttonBox);
    buttonLayout->setContentsMargins(0, 0, 0, 0);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(m_shortcutConfigWidget);
    mainLayout->addWidget(buttonWidget);
    setLayout(mainLayout);
}
Exemple #3
0
void SettingsUi::setShortcutsToDefault()
{
    qDebug() << "setting all shortcuts to default";

    QDBusInterface tohkbd2daemon("com.kimmoli.tohkbd2", "/", "com.kimmoli.tohkbd2", QDBusConnection::systemBus());
    tohkbd2daemon.setTimeout(2000);
    tohkbd2daemon.call(QDBus::AutoDetect, "setShortcutsToDefault");

    emit shortcutsChanged();
}
void ShortcutHandler::openShortcutConfigDialog()
{
    if (!m_shortcutConfigDialog) {
        m_shortcutConfigDialog = new ShortcutConfigDialog(qobject_cast<QWidget*>(parent()));
        m_shortcutConfigDialog->setActionDescriptions(m_actionDescriptions);
        m_shortcutConfigDialog->setExclusivityGroups(m_exclusivityGroups);
        connect(m_shortcutConfigDialog, SIGNAL(shortcutsChanged(QHash<QString,ActionDescription>)), this, SLOT(changeShortcuts(QHash<QString,ActionDescription>)));
    }
    m_shortcutConfigDialog->exec();
}
Exemple #5
0
SearchProviderDialog::SearchProviderDialog(SearchProvider *provider, QList<SearchProvider*> &providers, QWidget *parent)
    : QDialog( parent )
    , m_provider(provider)
{
    setModal(true);

    m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this);
    connect(m_buttons, SIGNAL(accepted()), SLOT(accept()));
    connect(m_buttons, SIGNAL(rejected()), SLOT(reject()));

    QWidget* mainWidget = new QWidget(this);
    m_dlg.setupUi(mainWidget);

    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->addWidget(mainWidget);
    layout->addWidget(m_buttons);

    m_dlg.leQuery->setMinimumWidth(m_dlg.leQuery->fontMetrics().averageCharWidth() * 50);

    connect(m_dlg.leName,      SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leQuery,     SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(shortcutsChanged(QString)));
    connect(m_dlg.pbPaste,     SIGNAL(clicked()),            SLOT(pastePlaceholder()));

    // Data init
    m_providers = providers;
    QStringList charsets = KCharsets::charsets()->availableEncodingNames();
    charsets.prepend(i18nc("@item:inlistbox The default character set", "Default"));
    m_dlg.cbCharset->addItems(charsets);
    if (m_provider)
    {
        setWindowTitle(i18n("Modify Web Shortcut"));
        m_dlg.leName->setText(m_provider->name());
        m_dlg.leQuery->setText(m_provider->query());
        m_dlg.leShortcut->setText(m_provider->keys().join(QStringLiteral(",")));
        m_dlg.cbCharset->setCurrentIndex(m_provider->charset().isEmpty() ? 0 : charsets.indexOf(m_provider->charset()));
        m_dlg.leName->setEnabled(false);
        m_dlg.leQuery->setFocus();
    }
    else
    {
        setWindowTitle(i18n("New Web Shortcut"));
        m_dlg.leName->setFocus();

        //If the clipboard contains a url copy it to the query lineedit
        const QClipboard *clipboard = QApplication::clipboard();
        const QString url = clipboard->text();

        if (!QUrl(url).host().isEmpty())
            m_dlg.leQuery->setText(url);

        m_buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
    }
}
ShortcutConfigWidget *ShortcutHandler::configWidget()
{
    Q_ASSERT_X(!m_shortcutConfigAction, "ShortcutHandler", "a shortcut configuration dialog and a shortcut configuration widget cannot exist at the same time in one application");
    if (!m_shortcutConfigWidget) {
        m_shortcutConfigWidget = new ShortcutConfigWidget(qobject_cast<QWidget*>(parent()));
        m_shortcutConfigWidget->setActionDescriptions(m_actionDescriptions);
        m_shortcutConfigWidget->setExclusivityGroups(m_exclusivityGroups);
        connect(m_shortcutConfigWidget, SIGNAL(shortcutsChanged(QHash<QString,ActionDescription>)), this, SLOT(changeShortcuts(QHash<QString,ActionDescription>)));
    }
    return m_shortcutConfigWidget;
}
Exemple #7
0
void SettingsUi::setShortcut(QString key, QString appPath)
{
    qDebug() << "setting shortcut" << key << "to" << appPath;

    QDBusInterface tohkbd2daemon("com.kimmoli.tohkbd2", "/", "com.kimmoli.tohkbd2", QDBusConnection::systemBus());
    tohkbd2daemon.setTimeout(2000);
    QList<QVariant> args;
    args.append(key);
    args.append(appPath);
    tohkbd2daemon.callWithArgumentList(QDBus::AutoDetect, "setShortcut", args);

    emit shortcutsChanged();
}
SearchProviderDialog::SearchProviderDialog(SearchProvider *provider, QList<SearchProvider*> &providers, QWidget *parent)
    : KDialog( parent )
    , m_provider(provider)
{
    setModal(true);
    setButtons( Ok | Cancel );

    m_dlg.setupUi(mainWidget());

    m_dlg.leQuery->setMinimumWidth(kapp->fontMetrics().averageCharWidth() * 50);

    connect(m_dlg.leName,      SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leQuery,     SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(m_dlg.leShortcut,  SIGNAL(textChanged(QString)), SLOT(shortcutsChanged(QString)));
    connect(m_dlg.pbPaste,     SIGNAL(clicked()),            SLOT(pastePlaceholder()));

    // Data init
    m_providers = providers;
    QStringList charsets = KGlobal::charsets()->availableEncodingNames();
    charsets.prepend(i18nc("@item:inlistbox The default character set", "Default"));
    m_dlg.cbCharset->addItems(charsets);
    if (m_provider)
    {
        setPlainCaption(i18n("Modify Web Shortcut"));
        m_dlg.leName->setText(m_provider->name());
        m_dlg.leQuery->setText(m_provider->query());
        m_dlg.leShortcut->setText(m_provider->keys().join(","));
        m_dlg.cbCharset->setCurrentIndex(m_provider->charset().isEmpty() ? 0 : charsets.indexOf(m_provider->charset()));
        m_dlg.leName->setEnabled(false);
        m_dlg.leQuery->setFocus();
    }
    else
    {
        setPlainCaption(i18n("New Web Shortcut"));
        m_dlg.leName->setFocus();

        //If the clipboard contains a url copy it to the query lineedit
        const QClipboard *clipboard = QApplication::clipboard();
        const QString url = clipboard->text();

        if (!KUrl(url).host().isEmpty())
            m_dlg.leQuery->setText(url);

        enableButton(Ok, false);
    }
}
Exemple #9
0
void HelpDialog::createDialogContent()
{
	ui->setupUi(dialog);
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	ui->stackedWidget->setCurrentIndex(0);
	ui->stackListWidget->setCurrentRow(0);
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	// Kinetic scrolling
	kineticScrollingList << ui->helpBrowser << ui->aboutBrowser << ui->logBrowser;
	StelGui* gui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
	if (gui)
	{
		enableKineticScrolling(gui->getFlagUseKineticScrolling());
		connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool)));
	}


	// Help page
	updateHelpText();
	connect(ui->editShortcutsButton, SIGNAL(clicked()), this, SLOT(showShortcutsWindow()));
	connect(StelApp::getInstance().getStelActionManager(), SIGNAL(shortcutsChanged()), this, SLOT(updateHelpText()));

	// About page
	updateAboutText();

	// Log page	
	ui->logPathLabel->setText(QString("%1/log.txt:").arg(StelFileMgr::getUserDir()));
	connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(updateLog(int)));
	connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refreshLog()));

	// Set up download manager for checker of updates
	networkManager = StelApp::getInstance().getNetworkAccessManager();
	updateState = CompleteNoUpdates;
	connect(ui->checkUpdatesButton, SIGNAL(clicked()), this, SLOT(checkUpdates()));
	connect(this, SIGNAL(checkUpdatesComplete(void)), this, SLOT(updateAboutText()));

	connect(ui->stackListWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
}
Exemple #10
0
UIImageOverview::UIImageOverview(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::UIImageOverview)
{
    QClipboard *clipboard = QApplication::clipboard();

    requestHandler = new RequestHandler(this);
    iParser = 0;
    oParser = 0;
    _cachedResult = false;

    pendingThumbnails.clear();

    ui->setupUi(this);

#ifndef __DEBUG__
    ui->btnDebug->hide();
#endif

    timer = new QTimer(this);
    settings = new QSettings("settings.ini", QSettings::IniFormat);

    thumbnailsizeLocked = false;
    closeWhenFinished = false;
    downloading = false;

    deleteFileAction = new QAction(QString("Delete File"), this);
    deleteFileAction->setIcon(QIcon(":/icons/resources/remove.png"));
    reloadFileAction = new QAction("Reload File", this);
    reloadFileAction->setIcon(QIcon(":/icons/resources/reload.png"));
    openFileAction = new QAction("Open File", this);
    openFileAction->setIcon(QIcon(":/icons/resources/open.png"));

    ui->progressBar->setMinimum(1);
    ui->progressBar->setMaximum(-1);
    ui->progressBar->setValue(0);
    ui->progressBar->setEnabled(true);
    ui->progressBar->setVisible(false);
    ui->progressBar->setFormat("%p%");

    if (QUrl(clipboard->text()).isValid() && pluginManager->isSupported(clipboard->text())) {
        ui->leURI->setText(clipboard->text());
    }

    connect(requestHandler, SIGNAL(responseError(QUrl, int)), this, SLOT(errorHandler(QUrl, int)));
    connect(requestHandler, SIGNAL(response(QUrl, QByteArray, bool)), this, SLOT(processRequestResponse(QUrl, QByteArray, bool)));

    connect(ui->leSavepath, SIGNAL(textChanged(QString)), this, SIGNAL(directoryChanged(QString)));
    connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(openFile()));

    connect(deleteFileAction, SIGNAL(triggered()), this, SLOT(deleteFile()));
    connect(reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFile()));
    connect(openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));

    connect(timer, SIGNAL(timeout()), this, SLOT(triggerRescan()));
    connect(folderShortcuts, SIGNAL(shortcutsChanged()), this, SLOT(fillShortcutComboBox()));
    connect(ui->cbFolderShortcuts, SIGNAL(currentIndexChanged(QString)), this, SLOT(selectShortcut(QString)));
    connect(ui->leSavepath, SIGNAL(textChanged(QString)), this, SLOT(checkForFolderShortcut(QString)));
    connect(ui->btnAddShortcut, SIGNAL(clicked()), this, SLOT(addShortcut()));

    // Connections for key bindings
    connect(ui->listWidget, SIGNAL(openItem()), this, SLOT(openFile()));
    connect(ui->listWidget, SIGNAL(deleteItem()), this, SLOT(deleteFile()));
    connect(ui->listWidget, SIGNAL(reloadItem()), this, SLOT(reloadFile()));

    connect(tnt, SIGNAL(thumbnailAvailable(QString,QString)), this, SLOT(addThumbnail(QString,QString)));

    setTabTitle("idle");

    loadSettings();
    fillShortcutComboBox();
    expectedThumbnailCount = 0;
    thumbnailCount = 0;
}