Permalink
Browse files

* Allow inserting / removing files to / from the project.

* Update the application icon and provide a svg version of it.


git-svn-id: https://scantailor.svn.sourceforge.net/svnroot/scantailor/trunk@334 80b70061-164d-0410-b7b7-e274ec932871
  • Loading branch information...
1 parent a22d5d3 commit a1eb4dccd207ec11a92e5c54a33378bf8815d155 jart committed Apr 13, 2009
View
@@ -20,25 +20,32 @@
#define ABSTRACTCOMMAND_H_
#include "RefCountable.h"
+#include "IntrusivePtr.h"
template<typename R>
class AbstractCommand0 : public RefCountable
{
public:
+ typedef IntrusivePtr<AbstractCommand0> Ptr;
+
virtual R operator()() = 0;
};
template<typename R, typename A1>
class AbstractCommand1 : public RefCountable
{
public:
+ typedef IntrusivePtr<AbstractCommand1> Ptr;
+
virtual R operator()(A1 arg1) = 0;
};
template<typename R, typename T1, typename T2>
class AbstractCommand2 : public RefCountable
{
public:
+ typedef IntrusivePtr<AbstractCommand2> Ptr;
+
virtual R operator()(T1 arg1, T2 arg2) = 0;
};
View
@@ -0,0 +1,24 @@
+/*
+ Scan Tailor - Interactive post-processing tool for scanned pages.
+ Copyright (C) 2007-2009 Joseph Artsimovich <joseph_a@mail.ru>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef BEFORE_OR_AFTER_H_
+#define BEFORE_OR_AFTER_H_
+
+enum BeforeOrAfter { BEFORE, AFTER };
+
+#endif
View
@@ -276,6 +276,7 @@ SET(
PageLayout.cpp PageLayout.h
RecentProjects.cpp RecentProjects.h
FixDpiDialog.cpp FixDpiDialog.h
+ FixDpiSinglePageDialog.cpp FixDpiSinglePageDialog.h
ProjectCreationContext.cpp ProjectCreationContext.h
MainWindow.cpp MainWindow.h
ContentSpanFinder.cpp ContentSpanFinder.h
@@ -325,6 +326,7 @@ SET(
AutoManualMode.h
AbstractCommand.h
AbstractFilter.h
+ BeforeOrAfter.h
FilterResult.h
CompositeCacheDrivenTask.h
Margins.h
@@ -0,0 +1,117 @@
+/*
+ Scan Tailor - Interactive post-processing tool for scanned pages.
+ Copyright (C) 2007-2009 Joseph Artsimovich <joseph_a@mail.ru>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "FixDpiSinglePageDialog.h.moc"
+#include "ImageId.h"
+#include <QPushButton>
+#include <QIntValidator>
+#include <QVariant>
+#include <QFileInfo>
+
+FixDpiSinglePageDialog::FixDpiSinglePageDialog(
+ ImageId const& image_id, Dpi const& dpi,
+ bool is_multipage_file, QWidget* parent)
+: QDialog(parent),
+ m_dpi(dpi)
+{
+ ui.setupUi(this);
+
+ QString const file_name(QFileInfo(image_id.filePath()).fileName());
+ QString image_name(file_name);
+ if (is_multipage_file) {
+ image_name = tr("%1 (page %1)").arg(file_name).arg(image_id.page() + 1);
+ }
+ ui.text->setText(ui.text->text().arg(image_name));
+
+ m_pOkBtn = ui.buttonBox->button(QDialogButtonBox::Ok);
+ m_pOkBtn->setEnabled(isDpiOK());
+
+ ui.dpiCombo->addItem("300 x 300", QSize(300, 300));
+ ui.dpiCombo->addItem("400 x 400", QSize(400, 400));
+ ui.dpiCombo->addItem("600 x 600", QSize(600, 600));
+
+ ui.xDpi->setMaxLength(4);
+ ui.yDpi->setMaxLength(4);
+ QIntValidator* xDpiValidator = new QIntValidator(ui.xDpi);
+ xDpiValidator->setBottom(100);
+ ui.xDpi->setValidator(xDpiValidator);
+ QIntValidator* yDpiValidator = new QIntValidator(ui.yDpi);
+ yDpiValidator->setBottom(100);
+ ui.yDpi->setValidator(yDpiValidator);
+
+ connect(
+ ui.dpiCombo, SIGNAL(activated(int)),
+ this, SLOT(dpiComboChangedByUser(int))
+ );
+ connect(
+ ui.xDpi, SIGNAL(textEdited(QString const&)),
+ this, SLOT(dpiValueChanged())
+ );
+ connect(
+ ui.yDpi, SIGNAL(textEdited(QString const&)),
+ this, SLOT(dpiValueChanged())
+ );
+}
+
+void
+FixDpiSinglePageDialog::dpiComboChangedByUser(int idx)
+{
+ QVariant const data(ui.dpiCombo->itemData(idx));
+ if (data.isValid()) {
+ m_dpi = Dpi(data.toSize());
+ ui.xDpi->setText(QString::number(m_dpi.horizontal()));
+ ui.yDpi->setText(QString::number(m_dpi.vertical()));
+ }
+
+ m_pOkBtn->setEnabled(isDpiOK());
+}
+
+void
+FixDpiSinglePageDialog::dpiValueChanged()
+{
+ bool x_ok = true, y_ok = true;
+ m_dpi = Dpi(ui.xDpi->text().toInt(&x_ok), ui.yDpi->text().toInt(&y_ok));
+ m_pOkBtn->setEnabled(isDpiOK());
+
+ if (x_ok && y_ok) {
+ int const count = ui.dpiCombo->count();
+ for (int i = 0; i < count; ++i) {
+ QVariant const data(ui.dpiCombo->itemData(i));
+ if (data.isValid()) {
+ if (m_dpi.toSize() == data.toSize()) {
+ ui.dpiCombo->setCurrentIndex(i);
+ return;
+ }
+ }
+ }
+ }
+
+ ui.dpiCombo->setCurrentIndex(0);
+}
+
+bool
+FixDpiSinglePageDialog::isDpiOK() const
+{
+ return isDpiOK(m_dpi.horizontal()) && isDpiOK(m_dpi.vertical());
+}
+
+bool
+FixDpiSinglePageDialog::isDpiOK(int dpi)
+{
+ return dpi >= 100 && dpi <= 1600;
+}
@@ -0,0 +1,51 @@
+/*
+ Scan Tailor - Interactive post-processing tool for scanned pages.
+ Copyright (C) 2007-2009 Joseph Artsimovich <joseph_a@mail.ru>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef FIX_DPI_SINGLE_PAGE_DIALOG_H_
+#define FIX_DPI_SINGLE_PAGE_DIALOG_H_
+
+#include "ui_FixDpiSinglePageDialog.h"
+#include "Dpi.h"
+
+class QPushButton;
+class ImageId;
+
+class FixDpiSinglePageDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ FixDpiSinglePageDialog(
+ ImageId const& image_id, Dpi const& dpi,
+ bool is_multipage_file, QWidget* parent = 0);
+
+ Dpi const& dpi() const { return m_dpi; }
+private slots:
+ void dpiComboChangedByUser(int idx);
+
+ void dpiValueChanged();
+private:
+ bool isDpiOK() const;
+
+ static bool isDpiOK(int dpi);
+
+ Ui::FixDpiSinglePageDialog ui;
+ Dpi m_dpi;
+ QPushButton* m_pOkBtn;
+};
+
+#endif
Oops, something went wrong.

0 comments on commit a1eb4dc

Please sign in to comment.