Commit 1f74bb3b authored by Oleg Kukharchuk's avatar Oleg Kukharchuk
Browse files

Merge branch 'master' of git://anongit.kde.org/calligra

parents 30d755f9 d18288b2
......@@ -200,6 +200,8 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
KisConfig cfg;
m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile());
m_page->cmbWorkingColorSpace->setIDList(KoColorSpaceRegistry::instance()->listKeys());
m_page->cmbWorkingColorSpace->setCurrent(cfg.workingColorSpace());
......@@ -234,10 +236,13 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
// XXX: this needs to be available per screen!
const KoColorProfile *profile = KisConfig::getScreenProfile();
if (profile && profile->isSuitableForDisplay()) {
// We've got an X11 profile, don't allow to override
m_page->cmbMonitorProfile->hide();
m_page->lblMonitorProfile->setText(i18n("Monitor profile: ") + profile->name());
if (cfg.useSystemMonitorProfile()) {
// We've got an X11 profile, don't allow to override
m_page->cmbMonitorProfile->hide();
m_page->lblMonitorProfile->setText(i18n("Monitor profile: ") + profile->name());
}
} else {
m_page->chkUseSystemMonitorProfile->setEnabled(false);
m_page->cmbMonitorProfile->show();
m_page->lblMonitorProfile->setText(i18n("&Monitor profile: "));
}
......@@ -698,6 +703,7 @@ bool KisDlgPreferences::editPreferences()
cfg.setZoomWithWheel(dialog->m_general->chkZoomWithWheel->isChecked());
// Color settings
cfg.setUseSystemMonitorProfile(dialog->m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
cfg.setMonitorProfile(dialog->m_colorSettings->m_page->cmbMonitorProfile->itemHighlighted());
cfg.setWorkingColorSpace(dialog->m_colorSettings->m_page->cmbWorkingColorSpace->currentItem().id());
cfg.setPrinterColorSpace(dialog->m_colorSettings->m_page->cmbPrintingColorSpace->currentItem().id());
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<height>457</height>
<width>760</width>
<height>546</height>
</rect>
</property>
<property name="windowTitle">
......@@ -65,6 +65,16 @@
<property name="margin">
<number>11</number>
</property>
<item>
<widget class="QCheckBox" name="chkUseSystemMonitorProfile">
<property name="text">
<string>Use system monitor profile</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
......
......@@ -51,7 +51,6 @@ public:
, toolProxy(0)
, currentAction(0)
, currentShortcut(0)
, eventCount(0)
, tabletPressEvent(0)
{ }
......@@ -75,8 +74,6 @@ public:
QPointF mousePosition;
int eventCount;
QTabletEvent *tabletPressEvent;
};
......@@ -118,9 +115,10 @@ bool KisInputManager::eventFilter(QObject* object, QEvent* event)
case QEvent::MouseButtonDblClick: {
d->mousePosition = widgetToPixel(static_cast<QMouseEvent*>(event)->posF());
//If the palette is visible, then hide it.
//If the palette is visible, then hide it and eat the event.
if (canvas()->favoriteResourceManager()->isPopupPaletteVisible()) {
canvas()->favoriteResourceManager()->slotShowPopupPalette();
return true;
}
} //Intentional fall through
case QEvent::KeyPress:
......@@ -274,12 +272,10 @@ void KisInputManager::Private::match(QEvent* event)
//With the current input, there is simply no shortcut that matches,
//so restart the matching.
potentialShortcuts = shortcuts;
eventCount = 0;
return;
}
eventCount++;
if (potentialShortcuts.count() == 1 || event->type() == QEvent::MouseButtonPress || eventCount >= 5) {
if (potentialShortcuts.count() == 1 || event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick) {
//Either we have only one possible match or we reached the queue threshold.
KisShortcut* completedShortcut = 0;
foreach (KisShortcut* shortcut, potentialShortcuts) {
......@@ -299,8 +295,6 @@ void KisInputManager::Private::match(QEvent* event)
currentAction = completedShortcut->action();
currentAction->begin(completedShortcut->shortcutIndex());
}
eventCount = 0;
}
}
......@@ -412,12 +406,14 @@ void KisInputManager::Private::clearState()
if (currentShortcut) {
currentAction->end();
currentAction = 0;
currentShortcut->clear();
currentShortcut = 0;
potentialShortcuts = shortcuts;
eventCount = 0;
delete tabletPressEvent;
tabletPressEvent = 0;
}
foreach (KisShortcut* shortcut, shortcuts) {
shortcut->clear();
}
}
......@@ -133,6 +133,12 @@ void KisShortcut::match(QEvent* event)
}
break;
}
case QEvent::MouseButtonDblClick: {
Qt::MouseButton button = static_cast<QMouseEvent*>(event)->button();
if (d->buttons.contains(button) && !d->buttonState.contains(button)) {
d->buttonState.append(button);
}
}
case QEvent::Wheel: {
QWheelEvent *wevent = static_cast<QWheelEvent*>(event);
if (wevent->delta() > 0) {
......
......@@ -41,6 +41,9 @@ public:
QTabletEvent::PointerType pointerType;
int tabletZ;
qint64 tabletID;
QPointF mousePosition;
Qt::KeyboardModifiers modifiers;
};
KisToolInvocationAction::KisToolInvocationAction(KisInputManager *manager)
......@@ -64,21 +67,24 @@ void KisToolInvocationAction::begin(int /*shortcut*/)
d->tabletDevice = pressEvent->device();
d->tabletZ = pressEvent->z();
d->tabletID = pressEvent->uniqueId();
d->mousePosition = d->tabletToPixel(pressEvent->hiResGlobalPos());
} else {
QMouseEvent *pressEvent = new QMouseEvent(QEvent::MouseButtonPress, inputManager()->mousePosition().toPoint(), Qt::LeftButton, Qt::LeftButton, 0);
inputManager()->toolProxy()->mousePressEvent(pressEvent, inputManager()->mousePosition());
d->mousePosition = inputManager()->mousePosition();
}
}
void KisToolInvocationAction::end()
{
if(d->useTablet) {
QTabletEvent *releaseEvent = new QTabletEvent(QEvent::TabletRelease, inputManager()->mousePosition().toPoint(), inputManager()->mousePosition().toPoint(), inputManager()->mousePosition(), d->tabletDevice, d->pointerType, 0.f, 0, 0, 0.f, 0.f, d->tabletZ, 0, d->tabletID);
inputManager()->toolProxy()->tabletEvent(releaseEvent, inputManager()->mousePosition());
QTabletEvent *releaseEvent = new QTabletEvent(QEvent::TabletRelease, d->mousePosition.toPoint(), d->mousePosition.toPoint(), d->mousePosition, d->tabletDevice, d->pointerType, 0.f, 0, 0, 0.f, 0.f, d->tabletZ, d->modifiers, d->tabletID);
inputManager()->toolProxy()->tabletEvent(releaseEvent, d->mousePosition);
d->useTablet = false;
} else {
QMouseEvent *releaseEvent = new QMouseEvent(QEvent::MouseButtonRelease, inputManager()->mousePosition().toPoint(), Qt::LeftButton, Qt::LeftButton, 0);
inputManager()->toolProxy()->mouseReleaseEvent(releaseEvent, inputManager()->mousePosition());
QMouseEvent *releaseEvent = new QMouseEvent(QEvent::MouseButtonRelease, d->mousePosition.toPoint(), Qt::LeftButton, Qt::LeftButton, d->modifiers);
inputManager()->toolProxy()->mouseReleaseEvent(releaseEvent, d->mousePosition);
}
}
......@@ -86,10 +92,14 @@ void KisToolInvocationAction::inputEvent(QEvent* event)
{
if(event->type() == QEvent::MouseMove) {
QMouseEvent* mevent = static_cast<QMouseEvent*>(event);
inputManager()->toolProxy()->mouseMoveEvent(mevent, inputManager()->widgetToPixel(mevent->posF()));
d->mousePosition = inputManager()->widgetToPixel(mevent->posF());
d->modifiers = mevent->modifiers();
inputManager()->toolProxy()->mouseMoveEvent(mevent, d->mousePosition);
} else if(event->type() == QEvent::TabletMove) {
QTabletEvent* tevent = static_cast<QTabletEvent*>(event);
inputManager()->toolProxy()->tabletEvent(tevent, d->tabletToPixel(tevent->hiResGlobalPos()));
d->mousePosition = d->tabletToPixel(tevent->hiResGlobalPos());
d->modifiers = tevent->modifiers();
inputManager()->toolProxy()->tabletEvent(tevent, d->mousePosition);
}
}
......
......@@ -225,7 +225,10 @@ const KoColorProfile *KisConfig::displayProfile(int screen)
{
// first try to get the screen profile set by the X11 _ICC_PROFILE atom (compatible with colord,
// but colord can set the atom to none, in which case we cannot create a suitable profile)
const KoColorProfile *profile = KisConfig::getScreenProfile(screen);
const KoColorProfile *profile = 0;
if (useSystemMonitorProfile()) {
profile = KisConfig::getScreenProfile(screen);
}
// if it fails. check the configuration
if (!profile || !profile->isSuitableForDisplay()) {
......@@ -837,3 +840,14 @@ void KisConfig::setExportConfiguration(const QString &filterId, const KisPropert
m_cfg.writeEntry("ExportConfiguration-" + filterId, exportConfig);
}
bool KisConfig::useSystemMonitorProfile() const
{
return m_cfg.readEntry("ColorManagement/UseSystemMonitorProfile", false);
}
void KisConfig::setUseSystemMonitorProfile(bool _useSystemMonitorProfile)
{
m_cfg.writeEntry("ColorManagement/UseSystemMonitorProfile", _useSystemMonitorProfile);
}
......@@ -265,6 +265,9 @@ public:
QString exportConfiguration(const QString &filterId) const;
void setExportConfiguration(const QString &filterId, const KisPropertiesConfiguration &properties);
bool useSystemMonitorProfile() const;
void setUseSystemMonitorProfile(bool _useSystemMonitorProfile);
template<class T>
void writeEntry(const QString& name, const T& value) {
m_cfg.writeEntry(name, value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment