예제 #1
0
파일: inputmap.cpp 프로젝트: speakman/qlc
InputMap::InputMap(QObject*parent, t_input_universe universes) : QObject(parent)
{
	m_universes = universes;
	m_editorUniverse = 0;
	
	initPatch();
	loadPlugins();

#ifdef Q_WS_X11
	/* First, load user profiles (overrides system profiles) */
	QDir dir(QString(getenv("HOME")));
	loadProfiles(dir.absoluteFilePath(QString(USERINPUTPROFILEDIR)));
#endif

	/* Then, load system profiles */
#ifdef __APPLE__
	loadProfiles(QString("%1/%2")
                    .arg(QApplication::applicationDirPath())
                    .arg(INPUTPROFILEDIR));
#else
	loadProfiles(INPUTPROFILEDIR);
#endif

	loadDefaults();
}
예제 #2
0
	void loadAssets()
	{
		log("loading profiles", "LoadAssets"); 	loadProfiles();

		for(string packPath : getScan<Mode::Single, Type::Folder>("Packs/"))
		{
			string packName{packPath.substr(6, packPath.length() - 6)};

			string packLua{""};
			for(const auto& path : getScan<Mode::Recurse, Type::File, Pick::ByExt>(packPath, ".lua")) packLua.append(getFileContents(path));
			string packHash{Online::getMD5Hash(packLua + HG_SKEY1 + HG_SKEY2 + HG_SKEY3)};

			Json::Value packRoot{getRootFromFile(packPath + "/pack.json")};
			PackData packData(packName, packRoot["name"].asString(), packRoot["priority"].asFloat(), packHash);
			packDataMap.insert(make_pair(packName, packData));
		}

		vector<PackData> packDatasToQuery;
		for(pair<string, PackData> packDataPair : packDataMap) packDatasToQuery.push_back(packDataPair.second);
		sort(begin(packDatasToQuery), end(packDatasToQuery), [](PackData a, PackData b) { return a.getPriority() < b.getPriority(); });

		for(PackData packData : packDatasToQuery)
		{
			string packName{packData.getId()}, packPath{"Packs/" + packName + "/"};
			packPaths.push_back("Packs/" + packName + "/");
			log("loading " + packName + " music", "LoadAssets");			loadMusic(packPath);
			log("loading " + packName + " music data", "LoadAssets");		loadMusicData(packPath);
			log("loading " + packName + " style data", "LoadAssets");		loadStyleData(packPath);
			log("loading " + packName + " level data", "LoadAssets");		loadLevelData(packPath);
			log("loading " + packName + " events", "LoadAssets");			loadEvents(packPath);
			log("loading " + packName + " custom sounds", "LoadAssets");	loadCustomSounds(packName, packPath);
		}
	}
예제 #3
0
void ProfileWrangler::removeProfile()
{
    m_profiles.erase(m_profiles.begin() + m_curr_profile_index);
    
    saveProfiles();
    loadProfiles();
}
예제 #4
0
ShortcutsManager::ShortcutsManager(QObject *parent) : QObject(parent),
	m_reloadTimer(0)
{
	m_instance = this;

	m_nativeShortcuts[QLatin1String("NewWindow")] = QKeySequence(QKeySequence::New);
	m_nativeShortcuts[QLatin1String("Open")] = QKeySequence(QKeySequence::Open);
	m_nativeShortcuts[QLatin1String("Save")] = QKeySequence(QKeySequence::Save);
	m_nativeShortcuts[QLatin1String("Exit")] = QKeySequence(QKeySequence::Quit);
	m_nativeShortcuts[QLatin1String("Undo")] = QKeySequence(QKeySequence::Undo);
	m_nativeShortcuts[QLatin1String("Redo")] = QKeySequence(QKeySequence::Redo);
	m_nativeShortcuts[QLatin1String("Redo")] = QKeySequence(QKeySequence::Redo);
	m_nativeShortcuts[QLatin1String("Cut")] = QKeySequence(QKeySequence::Cut);
	m_nativeShortcuts[QLatin1String("Copy")] = QKeySequence(QKeySequence::Copy);
	m_nativeShortcuts[QLatin1String("Paste")] = QKeySequence(QKeySequence::Paste);
	m_nativeShortcuts[QLatin1String("Delete")] = QKeySequence(QKeySequence::Delete);
	m_nativeShortcuts[QLatin1String("SelectAll")] = QKeySequence(QKeySequence::SelectAll);
	m_nativeShortcuts[QLatin1String("Find")] = QKeySequence(QKeySequence::Find);
	m_nativeShortcuts[QLatin1String("FindNext")] = QKeySequence(QKeySequence::FindNext);
	m_nativeShortcuts[QLatin1String("FindPrevious")] = QKeySequence(QKeySequence::FindPrevious);
	m_nativeShortcuts[QLatin1String("Reload")] = QKeySequence(QKeySequence::Refresh);
	m_nativeShortcuts[QLatin1String("ZoomIn")] = QKeySequence(QKeySequence::ZoomIn);
	m_nativeShortcuts[QLatin1String("ZoomOut")] = QKeySequence(QKeySequence::ZoomOut);
	m_nativeShortcuts[QLatin1String("Back")] = QKeySequence(QKeySequence::Back);
	m_nativeShortcuts[QLatin1String("Forward")] = QKeySequence(QKeySequence::Forward);
	m_nativeShortcuts[QLatin1String("Help")] = QKeySequence(QKeySequence::HelpContents);
	m_nativeShortcuts[QLatin1String("ApplicationConfiguration")] = QKeySequence(QKeySequence::Preferences);

	loadProfiles();

	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), m_instance, SLOT(optionChanged(QString)));
}
예제 #5
0
/*!
    \fn OptionsDialog::removeProfile()
 */
void OptionsDialog::removeProfile() {
    QStringList profiles = getSetting("profiles").toStringList();
    QList<QListWidgetItem*> selected = profilesList->selectedItems();
    if(!selected.isEmpty()) {
        profiles.removeAll(selected.first()->text());
        setSetting("profiles", profiles);
        loadProfiles();
    }
}
예제 #6
0
/*!
    \fn OptionsDialog::addProfile()
 */
void OptionsDialog::addProfile() {
    bool ok;
    QString name = QInputDialog::getText(this, tr("Profile name"), tr("Profile Name:"), QLineEdit::Normal, "", &ok);
    if(ok && !name.isEmpty()) {
        QStringList profiles = getSetting("profiles").toStringList();
        profiles << name;
        setSetting("profiles", profiles);
        loadProfiles();
        updateProfile(QHash<QString, QVariant>(), name);
    }
}
예제 #7
0
void ActionsManager::timerEvent(QTimerEvent *event)
{
	if (event->timerId() == m_reloadTimer)
	{
		killTimer(m_reloadTimer);

		m_reloadTimer = 0;

		loadProfiles();
	}
}
예제 #8
0
파일: kimportdlg.cpp 프로젝트: KDE/kmymoney
void KImportDlg::slotNewProfile()
{
  QPointer<MyMoneyQifProfileEditor> editor = new MyMoneyQifProfileEditor(true, this);
  editor->setObjectName("QIF Profile Editor");

  if (editor->exec()) {
    loadProfiles();
    m_profileComboBox->setCurrentIndex(m_profileComboBox->findText(editor->selectedProfile(), Qt::MatchExactly));
  }

  delete editor;
}
예제 #9
0
void ProfileWrangler::removeProfile(std::shared_ptr<Profile> old_profile)
{
    for(size_t pos = 0; pos < m_profiles.size(); ++pos)
    {
        if(m_profiles[pos] == old_profile)
        {
			cout << "found profile to delete" << endl;
            m_profiles.erase(m_profiles.begin() + (int)pos);
        }
    }
    
    saveProfiles();
    loadProfiles();
}
예제 #10
0
	void createProfile(const string& mName)
	{
		ofstream o{"Profiles/" + mName + ".json"};
		Json::Value root;
		Json::StyledStreamWriter writer;

		root["name"] = mName;
		root["scores"] = Json::objectValue;
		writer.write(o, root);
		o.flush(); o.close();

		profileDataMap.clear();
		loadProfiles();
	}
예제 #11
0
void OptionsDialog::setAjSettings(const AjSettings& settings) {
    profileChangeActive = false;
    nickEdit->setText(settings.nick);
    xmlEdit->setText(settings.xmlPort);
    incomingEdit->setText(settings.incomingDir);
    tempEdit->setText(settings.tempDir);
    autoConnect->setChecked((settings.autoconnect.toLower() == "true"));
    downSpin->setValue(settings.maxDown.toInt() / 1024);
    upSpin->setValue(settings.maxUp.toInt() / 1024);
    slotSpin->setValue(settings.maxSlot.toInt());
    sourcesSpin->setValue(settings.maxSources.toInt());
    connectionsSpin->setValue(settings.maxCon.toInt());
    newSpin->setValue(settings.maxNewCon.toInt());
    tcpEdit->setText(settings.tcpPort);
    loadProfiles();
    profileChanged = false;
    profileChangeActive = true;
}
예제 #12
0
/*!
  Open the setup dialog
*/
void QIMPenInput::setup()
{
    if ( !setupDlg ) {
	// We are working with our copy of the char sets here.
	setupDlg = new QIMPenSetup( profile, 0, 0, TRUE );
	setupDlg->editor()->selectCharSet( profile->charSets().at(1) );	// lower case? This is crap.
	if ( qApp->desktop()->width() < 640 )
	    setupDlg->showMaximized();
	Global::hideInputMethod();
	setupDlg->exec();
	loadProfiles();
	delete setupDlg;
	setupDlg = 0;
	Global::showInputMethod();
    } else {
	setupDlg->raise();
    }
}
예제 #13
0
KImportDlg::KImportDlg(QWidget *parent)
    : KImportDlgDecl(parent)
{
  setModal(true);
  // Set all the last used options
  readConfig();

  loadProfiles(true);

  // load button icons
  m_qbuttonCancel->setGuiItem(KStandardGuiItem::cancel());

  KGuiItem okButtenItem(i18n("&Import"),
                        KIcon("document-import"),
                        i18n("Start operation"),
                        i18n("Use this to start the import operation"));
  m_qbuttonOk->setGuiItem(okButtenItem);

  KGuiItem browseButtenItem(i18n("&Browse..."),
                            KIcon("document-open"),
                            i18n("Select filename"),
                            i18n("Use this to select a filename to export to"));
  m_qbuttonBrowse->setGuiItem(browseButtenItem);

  KGuiItem newButtenItem(i18nc("New profile", "&New..."),
                         KIcon("document-new"),
                         i18n("Create a new profile"),
                         i18n("Use this to open the profile editor"));
  m_profileEditorButton->setGuiItem(newButtenItem);

  // connect the buttons to their functionality
  connect(m_qbuttonBrowse, SIGNAL(clicked()), this, SLOT(slotBrowse()));
  connect(m_qbuttonOk, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
  connect(m_qbuttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
  connect(m_profileEditorButton, SIGNAL(clicked()), this, SLOT(slotNewProfile()));

  // connect the change signals to the check slot and perform initial check
  connect(m_qlineeditFile, SIGNAL(textChanged(QString)), this,
          SLOT(slotFileTextChanged(QString)));

  // setup button enable status
  slotFileTextChanged(m_qlineeditFile->text());
}
예제 #14
0
ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap <QString, QString> metadata, const QStringList &lumas, int videotracks, int audiotracks, const QString &projectPath, bool readOnlyTracks, bool savedProject, QWidget * parent) :
    QDialog(parent), m_savedProject(savedProject), m_lumas(lumas)
{
    setupUi(this);

    list_search->setTreeWidget(files_list);
    project_folder->setMode(KFile::Directory);
    project_folder->setUrl(QUrl(projectPath));
    loadProfiles();

    manage_profiles->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
    manage_profiles->setToolTip(i18n("Manage project profiles"));
    connect(manage_profiles, SIGNAL(clicked(bool)), this, SLOT(slotEditProfiles()));

    m_buttonOk = buttonBox->button(QDialogButtonBox::Ok);
    //buttonOk->setEnabled(false);
    audio_thumbs->setChecked(KdenliveSettings::audiothumbnails());
    video_thumbs->setChecked(KdenliveSettings::videothumbnails());
    audio_tracks->setValue(audiotracks);
    video_tracks->setValue(videotracks);
    connect(generate_proxy, SIGNAL(toggled(bool)), proxy_minsize, SLOT(setEnabled(bool)));
    connect(generate_imageproxy, SIGNAL(toggled(bool)), proxy_imageminsize, SLOT(setEnabled(bool)));

    QString currentProf;
    if (doc) {
        currentProf = KdenliveSettings::current_profile();
        enable_proxy->setChecked(doc->getDocumentProperty(QStringLiteral("enableproxy")).toInt());
        generate_proxy->setChecked(doc->getDocumentProperty(QStringLiteral("generateproxy")).toInt());
        proxy_minsize->setValue(doc->getDocumentProperty(QStringLiteral("proxyminsize")).toInt());
        m_proxyparameters = doc->getDocumentProperty(QStringLiteral("proxyparams"));
        generate_imageproxy->setChecked(doc->getDocumentProperty(QStringLiteral("generateimageproxy")).toInt());
        proxy_imageminsize->setValue(doc->getDocumentProperty(QStringLiteral("proxyimageminsize")).toInt());
        m_proxyextension = doc->getDocumentProperty(QStringLiteral("proxyextension"));
    }
    else {
        currentProf = KdenliveSettings::default_profile();
        enable_proxy->setChecked(KdenliveSettings::enableproxy());
        generate_proxy->setChecked(KdenliveSettings::generateproxy());
        proxy_minsize->setValue(KdenliveSettings::proxyminsize());
        m_proxyparameters = KdenliveSettings::proxyparams();
        generate_imageproxy->setChecked(KdenliveSettings::generateimageproxy());
        proxy_imageminsize->setValue(KdenliveSettings::proxyimageminsize());
        m_proxyextension = KdenliveSettings::proxyextension();
    }
    // Select profile
    for (int i = 0; i < profiles_list->count(); ++i) {
        if (profiles_list->itemData(i).toString() == currentProf) {
            profiles_list->setCurrentIndex(i);
            break;
        }
    }

    proxy_minsize->setEnabled(generate_proxy->isChecked());
    proxy_imageminsize->setEnabled(generate_imageproxy->isChecked());


    loadProxyProfiles();

    // Proxy GUI stuff
    proxy_showprofileinfo->setIcon(KoIconUtils::themedIcon(QStringLiteral("help-about")));
    proxy_showprofileinfo->setToolTip(i18n("Show default profile parameters"));
    proxy_manageprofile->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
    proxy_manageprofile->setToolTip(i18n("Manage proxy profiles"));

    connect(proxy_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile()));
    proxy_profile->setToolTip(i18n("Select default proxy profile"));

    connect(proxy_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateProxyParams()));
    proxyparams->setVisible(false);
    proxyparams->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5);
    connect(proxy_showprofileinfo, SIGNAL(clicked(bool)), proxyparams, SLOT(setVisible(bool)));

    if (readOnlyTracks) {
        video_tracks->setEnabled(false);
        audio_tracks->setEnabled(false);
    }

    // Metadata list
    QTreeWidgetItem *item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Title"));
    item->setData(0, Qt::UserRole, QStringLiteral("meta.attr.title.markup"));
    if (metadata.contains(QStringLiteral("meta.attr.title.markup"))) {
	item->setText(1, metadata.value(QStringLiteral("meta.attr.title.markup")));
	metadata.remove(QStringLiteral("meta.attr.title.markup"));
    }
    item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Author"));
    item->setData(0, Qt::UserRole, QStringLiteral("meta.attr.author.markup"));
    if (metadata.contains(QStringLiteral("meta.attr.author.markup"))) {
	item->setText(1, metadata.value(QStringLiteral("meta.attr.author.markup")));
	metadata.remove(QStringLiteral("meta.attr.author.markup"));
    }
    else if (metadata.contains(QStringLiteral("meta.attr.artist.markup"))) {
	item->setText(0, i18n("Artist"));
	item->setData(0, Qt::UserRole, QStringLiteral("meta.attr.artist.markup"));
	item->setText(1, metadata.value(QStringLiteral("meta.attr.artist.markup")));
	metadata.remove(QStringLiteral("meta.attr.artist.markup"));
    }
    item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Copyright"));
    item->setData(0, Qt::UserRole, QStringLiteral("meta.attr.copyright.markup"));
    if (metadata.contains(QStringLiteral("meta.attr.copyright.markup"))) {
	item->setText(1, metadata.value(QStringLiteral("meta.attr.copyright.markup")));
	metadata.remove(QStringLiteral("meta.attr.copyright.markup"));
    }
    item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Year"));
    item->setData(0, Qt::UserRole, QStringLiteral("meta.attr.year.markup"));
    if (metadata.contains(QStringLiteral("meta.attr.year.markup"))) {
	item->setText(1, metadata.value(QStringLiteral("meta.attr.year.markup")));
	metadata.remove(QStringLiteral("meta.attr.year.markup"));
    }
    else if (metadata.contains(QStringLiteral("meta.attr.date.markup"))) {
	item->setText(0, i18n("Date"));
	item->setData(0, Qt::UserRole, QStringLiteral("meta.attr.date.markup"));
	item->setText(1, metadata.value(QStringLiteral("meta.attr.date.markup")));
	metadata.remove(QStringLiteral("meta.attr.date.markup"));
    }
    item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    
    QMap<QString, QString>::const_iterator meta = metadata.constBegin();
    while (meta != metadata.constEnd()) {
	item = new QTreeWidgetItem(metadata_list, QStringList() << meta.key().section('.', 2,2));
	item->setData(0, Qt::UserRole, meta.key());
	item->setText(1, meta.value());
	item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
	++meta;
    }
    
    connect(add_metadata, SIGNAL(clicked()), this, SLOT(slotAddMetadataField()));
    connect(delete_metadata, SIGNAL(clicked()), this, SLOT(slotDeleteMetadataField()));
    add_metadata->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add")));
    delete_metadata->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-remove")));
    
    slotUpdateDisplay();
    if (doc != NULL) {
        slotUpdateFiles();
        connect(clear_cache, SIGNAL(clicked()), this, SLOT(slotClearCache()));
        connect(delete_unused, SIGNAL(clicked()), this, SLOT(slotDeleteUnused()));
        connect(delete_proxies, SIGNAL(clicked()), this, SLOT(slotDeleteProxies()));
    } else tabWidget->widget(1)->setEnabled(false);
    connect(profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
    connect(project_folder, SIGNAL(textChanged(QString)), this, SLOT(slotUpdateButton(QString)));
    connect(button_export, SIGNAL(clicked()), this, SLOT(slotExportToText()));
    // Delete unused files is not implemented
    delete_unused->setVisible(false);
}
예제 #15
0
/*!
  \class QIMPenInput qimpeninput.h

  Pen input widget.
*/
QIMPenInput::QIMPenInput( QWidget *parent, const char *name, WFlags wf )
    : QFrame( parent, name, wf ), helpDlg(0), profile(0)
{
    setFrameStyle( Box | Plain );

    profileList.setAutoDelete( true );

    matcher = new QIMPenMatch( this );
    connect( matcher, SIGNAL(keypress(uint)), this, SLOT(keypress(uint)) );
    connect( matcher, SIGNAL(erase()), this, SLOT(erase()) );

    QGridLayout *gl = new QGridLayout( this, 5, 2, 1, 0 );
    gl->setColStretch( 0, 1 );

    wordPicker = new QIMPenWordPick( this );
    connect( wordPicker, SIGNAL(wordClicked(const QString&)),
	     this, SLOT(wordPicked(const QString&)) );
    connect( matcher, SIGNAL(matchedCharacters(const QIMPenCharMatchList&)),
	     this, SLOT(matchedCharacters(const QIMPenCharMatchList&)) );
    connect( matcher, SIGNAL(matchedWords(const QIMPenMatch::MatchWordList&)),
	     wordPicker, SLOT(setWords(const QIMPenMatch::MatchWordList&)) );
    QFont f("smallsmooth",9);
    QFontInfo fi( f );
    wordPicker->setFont( f );
    wordPicker->setBackgroundColor( white );
    gl->addMultiCellWidget( wordPicker, 0, 0, 0, 1 );
    if ( !Global::fixedDawg().root() || !matcher->isWordMatchingEnabled() )
	wordPicker->hide();

    pw = new QIMPenWidget( this );
    gl->addMultiCellWidget( pw, 1, 4, 0, 0 );

    int bh = pw->sizeHint().height()/4;

    QPushButton *b = new QPushButton( this );
    b->setFocusPolicy( NoFocus );
    b->setPixmap( QPixmap( (const char **)bs_xpm ) );
    b->setFixedHeight(pw->sizeHint().height()-3*bh); // left-over space goes here
    b->setAutoRepeat( TRUE );
    gl->addWidget( b, 1, 1 );
    connect( b, SIGNAL(clicked()), SLOT(backspace()));

    b = new QPushButton( this );
    b->setFocusPolicy( NoFocus );
    b->setPixmap( QPixmap( (const char **)enter_xpm ) );
    b->setFixedHeight(bh);
    b->setAutoRepeat( TRUE );
    gl->addWidget( b, 2, 1 );
    connect( b, SIGNAL(clicked()), SLOT(enter()));

    helpBtn = new QPushButton( this );
    helpBtn->setFocusPolicy( NoFocus );
    helpBtn->setPixmap( QPixmap( (const char **)help_xpm ) );
    helpBtn->setFixedHeight(bh);
    gl->addWidget( helpBtn, 3, 1 );
    connect( helpBtn, SIGNAL(clicked()), SLOT(help()));

    QPixmap pm( (const char **)pen_xpm );
    setupBtn = new QPushButton( this );
    setupBtn->setFocusPolicy( NoFocus );
    setupBtn->setPixmap( pm );
    setupBtn->setFixedHeight(bh);
    gl->addWidget( setupBtn, 4, 1 );
    connect( setupBtn, SIGNAL(clicked()), SLOT(setup()));

    connect( matcher, SIGNAL(removeStroke()), pw, SLOT(removeStroke()) );
    connect( pw, SIGNAL(changeCharSet(QIMPenCharSet*)),
             matcher, SLOT(setCharSet(QIMPenCharSet*)) );
    connect( pw, SIGNAL(changeCharSet(int)),
             this, SLOT(selectCharSet(int)) );
    connect( pw, SIGNAL(beginStroke()),
	     matcher, SLOT(beginStroke()) );
    connect( pw, SIGNAL(stroke(QIMPenStroke*)),
             this, SLOT(strokeEntered(QIMPenStroke*)) );
    connect( pw, SIGNAL(stroke(QIMPenStroke*)),
             matcher, SLOT(strokeEntered(QIMPenStroke*)) );

    shortcutCharSet = 0;
    currCharSet = 0;
    setupDlg = 0;
    profile = 0;
    mode = Normal;

    loadProfiles();
}
예제 #16
0
void ProfileWrangler::addProfile(std::shared_ptr<Profile> new_profile)
{
    m_profiles.push_back(new_profile);
    saveProfiles();
    loadProfiles();
}
예제 #17
0
void ActionsManager::registerWindow(QWidget *window, QList<QAction*> actions)
{
	if (!window)
	{
		return;
	}

	window->addActions(actions);

	if (m_profileShortcuts.isEmpty())
	{
		m_nativeShortcuts[QLatin1String("NewWindow")] = QKeySequence(QKeySequence::New);
		m_nativeShortcuts[QLatin1String("Open")] = QKeySequence(QKeySequence::Open);
		m_nativeShortcuts[QLatin1String("Save")] = QKeySequence(QKeySequence::Save);
		m_nativeShortcuts[QLatin1String("Exit")] = QKeySequence(QKeySequence::Quit);
		m_nativeShortcuts[QLatin1String("Undo")] = QKeySequence(QKeySequence::Undo);
		m_nativeShortcuts[QLatin1String("Redo")] = QKeySequence(QKeySequence::Redo);
		m_nativeShortcuts[QLatin1String("Redo")] = QKeySequence(QKeySequence::Redo);
		m_nativeShortcuts[QLatin1String("Cut")] = QKeySequence(QKeySequence::Cut);
		m_nativeShortcuts[QLatin1String("Copy")] = QKeySequence(QKeySequence::Copy);
		m_nativeShortcuts[QLatin1String("Paste")] = QKeySequence(QKeySequence::Paste);
		m_nativeShortcuts[QLatin1String("Delete")] = QKeySequence(QKeySequence::Delete);
		m_nativeShortcuts[QLatin1String("SelectAll")] = QKeySequence(QKeySequence::SelectAll);
		m_nativeShortcuts[QLatin1String("Find")] = QKeySequence(QKeySequence::Find);
		m_nativeShortcuts[QLatin1String("FindNext")] = QKeySequence(QKeySequence::FindNext);
		m_nativeShortcuts[QLatin1String("FindPrevious")] = QKeySequence(QKeySequence::FindPrevious);
		m_nativeShortcuts[QLatin1String("Reload")] = QKeySequence(QKeySequence::Refresh);
		m_nativeShortcuts[QLatin1String("ZoomIn")] = QKeySequence(QKeySequence::ZoomIn);
		m_nativeShortcuts[QLatin1String("ZoomOut")] = QKeySequence(QKeySequence::ZoomOut);
		m_nativeShortcuts[QLatin1String("Back")] = QKeySequence(QKeySequence::Back);
		m_nativeShortcuts[QLatin1String("Forward")] = QKeySequence(QKeySequence::Forward);
		m_nativeShortcuts[QLatin1String("Help")] = QKeySequence(QKeySequence::HelpContents);
		m_nativeShortcuts[QLatin1String("ApplicationConfiguration")] = QKeySequence(QKeySequence::Preferences);

		registerAction(QLatin1String("OpenLinkInThisTab"), tr("Open"));
		registerAction(QLatin1String("OpenLinkInNewTab"), tr("Open in New Tab"));
		registerAction(QLatin1String("OpenLinkInNewTabBackground"), tr("Open in New Background Tab"));
		registerAction(QLatin1String("OpenLinkInNewWindow"), tr("Open in New Window"));
		registerAction(QLatin1String("OpenLinkInNewWindowBackground"), tr("Open in New Background Window"));
		registerAction(QLatin1String("CopyLinkToClipboard"), tr("Copy Link to Clipboard"));
		registerAction(QLatin1String("OpenFrameInThisTab"), tr("Open"));
		registerAction(QLatin1String("OpenFrameInNewTab"), tr("Open in New Tab"));
		registerAction(QLatin1String("OpenFrameInNewTabBackground"), tr("Open in New Background Tab"));
		registerAction(QLatin1String("CopyFrameLinkToClipboard"), tr("Copy Frame Link to Clipboard"));
		registerAction(QLatin1String("ReloadFrame"), tr("Reload"));
		registerAction(QLatin1String("ReloadImage"), tr("Reload Image"));
		registerAction(QLatin1String("ViewSourceFrame"), tr("View Source"));
		registerAction(QLatin1String("SaveLinkToDisk"), tr("Save Link Target As..."));
		registerAction(QLatin1String("SaveLinkToDownloads"), tr("Save to Downloads"));
		registerAction(QLatin1String("BookmarkLink"), tr("Bookmark Link..."), Utils::getIcon(QLatin1String("bookmark-new")));
		registerAction(QLatin1String("ReloadTime"), tr("Reload Each"));
		registerAction(QLatin1String("CopyAddress"), tr("Copy Address"));
		registerAction(QLatin1String("Validate"), tr("Validate"));
		registerAction(QLatin1String("ContentBlocking"), tr("Content Blocking..."));
		registerAction(QLatin1String("WebsitePreferences"), tr("Website Preferences..."));
		registerAction(QLatin1String("ImageProperties"), tr("Image Properties..."));
		registerAction(QLatin1String("OpenImageInNewTab"), tr("Open Image"));
		registerAction(QLatin1String("SaveImageToDisk"), tr("Save Image..."));
		registerAction(QLatin1String("CopyImageToClipboard"), tr("Copy Image to Clipboard"));
		registerAction(QLatin1String("CopyImageUrlToClipboard"), tr("Copy Image Link to Clipboard"));
		registerAction(QLatin1String("Search"), tr("Search"));
		registerAction(QLatin1String("SearchMenu"), tr("Search Using"));
		registerAction(QLatin1String("OpenSelectionAsLink"), tr("Go to This Address"));
		registerAction(QLatin1String("ClearAll"), tr("Clear All"));
		registerAction(QLatin1String("SpellCheck"), tr("Check Spelling"));
		registerAction(QLatin1String("CreateSearch"), tr("Create Search..."));
		registerAction(QLatin1String("SaveMediaToDisk"), tr("Save Media..."));
		registerAction(QLatin1String("CopyMediaUrlToClipboard"), tr("Copy Media Link to Clipboard"));
		registerAction(QLatin1String("ToggleMediaControls"), tr("Show Controls"));
		registerAction(QLatin1String("ToggleMediaLoop"), tr("Looping"));
		registerAction(QLatin1String("ToggleMediaPlayPause"), tr("Play"));
		registerAction(QLatin1String("ToggleMediaMute"), tr("Mute"));

		loadProfiles();

		connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), m_instance, SLOT(optionChanged(QString)));
	}

	if (!m_windowActions.contains(window))
	{
		m_windowActions[window] = QHash<QString, QAction*>();

		connect(window, SIGNAL(destroyed(QObject*)), m_instance, SLOT(removeWindow(QObject*)));
	}

	for (int i = 0; i < actions.count(); ++i)
	{
		if (actions.at(i) && !actions.at(i)->isSeparator() && !actions.at(i)->objectName().isEmpty())
		{
			m_windowActions[window][actions.at(i)->objectName().startsWith(QLatin1String("action")) ? actions.at(i)->objectName().mid(6) : actions.at(i)->objectName()] = actions.at(i);

			actions.at(i)->setShortcutContext(Qt::WidgetWithChildrenShortcut);
		}
	}

	setupWindowActions(window);
}
예제 #18
0
void ProfileWrangler::addProfile(Profile new_profile)
{
    m_profiles.push_back(std::make_shared<Profile>(new_profile));
    saveProfiles();
    loadProfiles();
}
예제 #19
0
ArtworkCalligraphyOptionWidget::ArtworkCalligraphyOptionWidget()
        : m_changingProfile(false)
{
    QGridLayout *layout = new QGridLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);

    m_comboBox = new KComboBox(this);
    layout->addWidget(m_comboBox, 0, 0);

    m_saveButton = new QToolButton(this);
    m_saveButton->setToolTip(i18n("Save profile as..."));
    m_saveButton->setIcon(KIcon("document-save-as"));
    layout->addWidget(m_saveButton, 0, 1);

    m_removeButton = new QToolButton(this);
    m_removeButton->setToolTip(i18n("Remove profile"));
    m_removeButton->setIcon(KIcon("list-remove"));
    layout->addWidget(m_removeButton, 0, 2);

    QGridLayout *detailsLayout = new QGridLayout();
    detailsLayout->setContentsMargins(0, 0, 0, 0);
    detailsLayout->setVerticalSpacing(0);

    m_usePath = new QCheckBox(i18n("&Follow selected path"), this);
    detailsLayout->addWidget(m_usePath, 0, 0, 1, 4);

    m_usePressure = new QCheckBox(i18n("Use tablet &pressure"), this);
    detailsLayout->addWidget(m_usePressure, 1, 0, 1, 4);

    QLabel *widthLabel = new QLabel(i18n("Width:"), this);
    widthLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_widthBox = new QDoubleSpinBox;
    m_widthBox->setRange(0.0, 999.0);
    widthLabel->setBuddy(m_widthBox);
    detailsLayout->addWidget(widthLabel, 2, 2);
    detailsLayout->addWidget(m_widthBox, 2, 3);

    QLabel *thinningLabel = new QLabel(i18n("Thinning:"), this);
    thinningLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_thinningBox = new QDoubleSpinBox;
    m_thinningBox->setRange(-1.0, 1.0);
    m_thinningBox->setSingleStep(0.1);
    thinningLabel->setBuddy(m_thinningBox);
    detailsLayout->addWidget(thinningLabel, 2, 0);
    detailsLayout->addWidget(m_thinningBox, 2, 1);

    m_useAngle = new QCheckBox(i18n("Use tablet &angle"), this);
    detailsLayout->addWidget(m_useAngle, 3, 0, 1, 4);

    QLabel *angleLabel = new QLabel(i18n("Angle:"), this);
    angleLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_angleBox = new QSpinBox;
    m_angleBox->setRange(0, 179);
    m_angleBox->setWrapping(true);
    angleLabel->setBuddy(m_angleBox);
    detailsLayout->addWidget(angleLabel, 4, 0);
    detailsLayout->addWidget(m_angleBox, 4, 1);

    QLabel *fixationLabel = new QLabel(i18n("Fixation:"), this);
    fixationLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_fixationBox = new QDoubleSpinBox;
    m_fixationBox->setRange(0.0, 1.0);
    m_fixationBox->setSingleStep(0.1);
    fixationLabel->setBuddy(m_fixationBox);
    detailsLayout->addWidget(fixationLabel, 5, 0);
    detailsLayout->addWidget(m_fixationBox, 5, 1);

    QLabel *capsLabel = new QLabel(i18n("Caps:"), this);
    capsLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_capsBox = new QDoubleSpinBox;
    m_capsBox->setRange(0.0, 2.0);
    m_capsBox->setSingleStep(0.03);
    capsLabel->setBuddy(m_capsBox);
    detailsLayout->addWidget(capsLabel, 5, 2);
    detailsLayout->addWidget(m_capsBox, 5, 3);

    QLabel *massLabel = new QLabel(i18n("Mass:"), this);
    massLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_massBox = new QDoubleSpinBox;
    m_massBox->setRange(0.0, 20.0);
    m_massBox->setDecimals(1);
    massLabel->setBuddy(m_massBox);
    detailsLayout->addWidget(massLabel, 6, 0);
    detailsLayout->addWidget(m_massBox, 6, 1);

    QLabel *dragLabel = new QLabel(i18n("Drag:"), this);
    dragLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_dragBox = new QDoubleSpinBox;
    m_dragBox->setRange(0.0, 1.0);
    m_dragBox->setSingleStep(0.1);
    dragLabel->setBuddy(m_dragBox);
    detailsLayout->addWidget(dragLabel, 6, 2);
    detailsLayout->addWidget(m_dragBox, 6, 3);

    layout->addLayout(detailsLayout, 1, 0, 1, 3);
    //layout->setRowStretch( 2, 1 );

    createConnections();
    addDefaultProfiles(); // if they are already added does nothing
    loadProfiles();
}