]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiGraphics.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiGraphics.cpp
index 2ef5c6b6f62992f177b592fa365144e7089ae0d2..b6bbaeac3fb13860c7a7049a4b0b01ec7c378af7 100644 (file)
@@ -77,7 +77,7 @@ size_t const rorigin_size = sizeof(rorigin_lyx_strs) / sizeof(char *);
 
 static string const autostr = N_("automatically");
 
-} // namespace anon
+} // namespace
 
 
 namespace lyx {
@@ -110,15 +110,13 @@ static void setAutoTextCB(QCheckBox * checkBox, QLineEdit * lineEdit,
 
 
 GuiGraphics::GuiGraphics(GuiView & lv)
-       : GuiDialog(lv, "graphics", qt_("Graphics"))
+       : GuiDialog(lv, "graphics", qt_("Graphics")), bbChanged(false)
 {
        setupUi(this);
-       
+
        //main buttons
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-       connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+                       this, SLOT(slotButtonBox(QAbstractButton *)));
 
        //graphics pane
        connect(filename, SIGNAL(textChanged(const QString &)),
@@ -155,7 +153,7 @@ GuiGraphics::GuiGraphics(GuiView & lv)
        filename->setValidator(new PathValidator(true, filename));
        setFocusProxy(filename);
 
-       QDoubleValidator * scaleValidator = 
+       QDoubleValidator * scaleValidator =
                new DoubleAutoValidator(Scale, qt_(autostr));
        scaleValidator->setBottom(0);
        scaleValidator->setDecimals(256); //I guess that will do
@@ -167,19 +165,19 @@ GuiGraphics::GuiGraphics(GuiView & lv)
        //clipping pane
        connect(clip, SIGNAL(stateChanged(int)),
                this, SLOT(change_adaptor()));
-       connect(lbY, SIGNAL(textChanged(const QString&)),
+       connect(lbY, SIGNAL(textChanged(const QString &)),
                this, SLOT(changeBB()));
        connect(lbYunit, SIGNAL(activated(int)),
                this, SLOT(changeBB()));
-       connect(rtY, SIGNAL(textChanged(const QString&)),
+       connect(rtY, SIGNAL(textChanged(const QString &)),
                this, SLOT(changeBB()));
        connect(rtYunit, SIGNAL(activated(int)),
                this, SLOT(changeBB()));
-       connect(lbX, SIGNAL(textChanged(const QString&)),
+       connect(lbX, SIGNAL(textChanged(const QString &)),
                this, SLOT(changeBB()));
        connect(lbXunit, SIGNAL(activated(int)),
                this, SLOT(changeBB()));
-       connect(rtX, SIGNAL(textChanged(const QString&)),
+       connect(rtX, SIGNAL(textChanged(const QString &)),
                this, SLOT(changeBB()));
        connect(rtXunit, SIGNAL(activated(int)),
                this, SLOT(changeBB()));
@@ -192,7 +190,7 @@ GuiGraphics::GuiGraphics(GuiView & lv)
        rtY->setValidator(new QDoubleValidator(rtY));
 
        //extra options pane
-       connect(latexoptions, SIGNAL(textChanged(const QString&)),
+       connect(latexoptions, SIGNAL(textChanged(const QString &)),
                this, SLOT(change_adaptor()));
        connect(draftCB, SIGNAL(stateChanged(int)),
                this, SLOT(change_adaptor()));
@@ -204,7 +202,7 @@ GuiGraphics::GuiGraphics(GuiView & lv)
        // is clicked, even right clicked (I think), not just whenever it is
        // toggled.
        connect(displayGB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
-       connect(displayscale, SIGNAL(textChanged(const QString&)),
+       connect(displayscale, SIGNAL(textChanged(const QString &)),
                this, SLOT(change_adaptor()));
        connect(groupCO, SIGNAL(currentIndexChanged(int)),
                this, SLOT(changeGroup(int)));
@@ -212,10 +210,10 @@ GuiGraphics::GuiGraphics(GuiView & lv)
        displayscale->setValidator(new QIntValidator(displayscale));
 
        bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
-       bc().setOK(okPB);
-       bc().setApply(applyPB);
-       bc().setRestore(restorePB);
-       bc().setCancel(closePB);
+       bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
+       bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
+       bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
+       bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
 
        bc().addReadOnly(latexoptions);
        bc().addReadOnly(filenameL);
@@ -255,12 +253,12 @@ void GuiGraphics::changeGroup(int /* index */)
 {
        QString const new_group = groupCO->itemData(
                groupCO->currentIndex()).toString();
-       
+
        // check if the old group consisted only of this member
        if (current_group_ != fromqstr(new_group)
            && graphics::countGroupMembers(buffer(), current_group_) == 1) {
                if (!new_group.isEmpty()) {
-                       if (Alert::prompt(_("Dissolve previous group?"), 
+                       if (Alert::prompt(_("Dissolve previous group?"),
                                bformat(_("If you assign this graphic to group '%2$s',\n"
                                          "the previously assigned group '%1$s' will be dissolved,\n"
                                          "because this graphic was its only member.\n"
@@ -276,7 +274,7 @@ void GuiGraphics::changeGroup(int /* index */)
                                return;
                        }
                } else {
-                       if (Alert::prompt(_("Dissolve previous group?"), 
+                       if (Alert::prompt(_("Dissolve previous group?"),
                        bformat(_("If you sign off this graphic from group '%1$s',\n"
                                  "the group will be dissolved,\n"
                                  "because this graphic was its only member.\n"
@@ -292,7 +290,7 @@ void GuiGraphics::changeGroup(int /* index */)
                        return;
                        }
                }
-       } 
+       }
 
        if (new_group.isEmpty()) {
                changed();
@@ -305,7 +303,7 @@ void GuiGraphics::changeGroup(int /* index */)
                changed();
                return;
        }
-       
+
        // filename might have been changed
        QString current_filename = filename->text();
 
@@ -314,7 +312,7 @@ void GuiGraphics::changeGroup(int /* index */)
        InsetGraphics::string2params(grp, buffer(), params_);
        paramsToDialog(params_);
        groupCO->blockSignals(false);
-       
+
        // reset filename
        filename->setText(current_filename);
 
@@ -330,7 +328,7 @@ void GuiGraphics::on_newGroupPB_clicked()
        if (newgroup.empty())
                return;
        if (groupCO->findData(toqstr(newgroup), Qt::MatchExactly) != -1) {
-               Alert::warning(_("Group already defined!"), 
+               Alert::warning(_("Group already defined!"),
                        bformat(_("A graphics group with the name '%1$s' already exists."),
                                newgroup));
                return;
@@ -469,9 +467,9 @@ void GuiGraphics::updateAspectRatioStatus()
 }
 
 
-void GuiGraphics::on_aspectratio_toggled(bool aspectratio)
+void GuiGraphics::on_aspectratio_toggled(bool aspect_ratio)
 {
-       if (aspectratio) {
+       if (aspect_ratio) {
                WidthCB->setText(qt_("Set max. &width:"));
                HeightCB->setText(qt_("Set max. &height:"));
                Width->setToolTip(qt_("Maximal width of image in output"));
@@ -485,12 +483,12 @@ void GuiGraphics::on_aspectratio_toggled(bool aspectratio)
 }
 
 
-void GuiGraphics::on_angle_textChanged(const QString & filename)
+void GuiGraphics::on_angle_textChanged(const QString & file_name)
 {
        rotateOrderCB->setEnabled((WidthCB->isChecked() ||
                                 HeightCB->isChecked() ||
                                 scaleCB->isChecked()) &&
-                                (filename != "0"));
+                                (file_name != "0"));
 }
 
 
@@ -504,7 +502,7 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
        lbYunit->clear();
        rtXunit->clear();
        rtYunit->clear();
-       
+
        for (size_t i = 0; i < bb_size; i++) {
                lbXunit->addItem(qt_(bb_units_gui[i]),
                        toqstr(bb_units[i]));
@@ -515,7 +513,7 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp)
                rtYunit->addItem(qt_(bb_units_gui[i]),
                        toqstr(bb_units[i]));
        }
-       
+
        // set the right default unit
        Length::UNIT const defaultUnit = Length::defaultUnit();
 
@@ -752,9 +750,9 @@ bool GuiGraphics::isValid()
 }
 
 
-bool GuiGraphics::initialiseParams(string const & data)
+bool GuiGraphics::initialiseParams(string const & sdata)
 {
-       InsetGraphics::string2params(data, buffer(), params_);
+       InsetGraphics::string2params(sdata, buffer(), params_);
        paramsToDialog(params_);
        current_group_ = params_.groupId;
        return true;
@@ -781,16 +779,16 @@ QString GuiGraphics::browse(QString const & in_name) const
 
        // Does user clipart directory exist?
        string clipdir = addName(package().user_support().absFileName(), "clipart");
-       FileName clip(clipdir);
+       FileName fclip(clipdir);
 
        // bail out to system clipart directory
-       if (!clip.isDirectory())
+       if (!fclip.isDirectory())
                clipdir = addName(package().system_support().absFileName(), "clipart");
 
        return browseRelToParent(in_name, bufferFilePath(),
-               title, fileFilters(QString()), false, 
-               qt_("Clipart|#C#c"), toqstr(clipdir),
-               qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
+               title, fileFilters(QString()), false,
+               qt_("&Clipart"), toqstr(clipdir),
+               qt_("D&ocuments"), toqstr(lyxrc.document_path));
 }