Commit cc6fec2b authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Made it possible to choose a name when copying a color scheme

Based on a window-modal input dialog, so that it appears as a sheet on
the Mac.

Reviewed-by: Norwegian Rock Cat
parent 60905c48
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#include <QtGui/QFontDatabase> #include <QtGui/QFontDatabase>
#include <QtGui/QInputDialog>
#include <QtGui/QListWidget> #include <QtGui/QListWidget>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QPalette> #include <QtGui/QPalette>
...@@ -425,6 +426,19 @@ void FontSettingsPage::colorSchemeSelected(int index) ...@@ -425,6 +426,19 @@ void FontSettingsPage::colorSchemeSelected(int index)
} }
void FontSettingsPage::copyColorScheme() void FontSettingsPage::copyColorScheme()
{
QInputDialog *dialog = new QInputDialog(d_ptr->ui.copyButton->window());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setInputMode(QInputDialog::TextInput);
dialog->setWindowTitle(tr("Copy Color Scheme"));
dialog->setLabelText(tr("Color Scheme name:"));
dialog->setTextValue(tr("%1 (copy)").arg(d_ptr->m_value.colorScheme().name()));
connect(dialog, SIGNAL(textValueSelected(QString)), this, SLOT(copyColorScheme(QString)));
dialog->open();
}
void FontSettingsPage::copyColorScheme(const QString &name)
{ {
int index = d_ptr->ui.schemeComboBox->currentIndex(); int index = d_ptr->ui.schemeComboBox->currentIndex();
if (index == -1) if (index == -1)
...@@ -444,7 +458,7 @@ void FontSettingsPage::copyColorScheme() ...@@ -444,7 +458,7 @@ void FontSettingsPage::copyColorScheme()
d_ptr->m_value.setColorScheme(d_ptr->ui.schemeEdit->colorScheme()); d_ptr->m_value.setColorScheme(d_ptr->ui.schemeEdit->colorScheme());
ColorScheme scheme = d_ptr->m_value.colorScheme(); ColorScheme scheme = d_ptr->m_value.colorScheme();
scheme.setName(tr("%1 (copy)").arg(scheme.name())); scheme.setName(name);
scheme.save(fileName); scheme.save(fileName);
d_ptr->m_value.setColorSchemeFileName(fileName); d_ptr->m_value.setColorSchemeFileName(fileName);
......
...@@ -113,6 +113,7 @@ private slots: ...@@ -113,6 +113,7 @@ private slots:
void fontSizeSelected(const QString &sizeString); void fontSizeSelected(const QString &sizeString);
void colorSchemeSelected(int index); void colorSchemeSelected(int index);
void copyColorScheme(); void copyColorScheme();
void copyColorScheme(const QString &name);
void deleteColorScheme(); void deleteColorScheme();
private: private:
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<item> <item>
<widget class="QPushButton" name="copyButton"> <widget class="QPushButton" name="copyButton">
<property name="text"> <property name="text">
<string>Copy</string> <string>Copy...</string>
</property> </property>
</widget> </widget>
</item> </item>
......
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