Show path to pattern file in a graphical shell.
--HG-- branch : develop
This commit is contained in:
parent
d4abab1029
commit
7b40bc3667
|
@ -2031,7 +2031,7 @@ void TMainWindow::InitWindow()
|
||||||
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
||||||
connect(ui->lineEditFullName, &QLineEdit::textEdited, this, &TMainWindow::SaveMFullName);
|
connect(ui->lineEditFullName, &QLineEdit::textEdited, this, &TMainWindow::SaveMFullName);
|
||||||
|
|
||||||
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, &TMainWindow::ShowInGraphicalShell);
|
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, [this](){ShowInGraphicalShell(curFile);});
|
||||||
|
|
||||||
InitUnits();
|
InitUnits();
|
||||||
|
|
||||||
|
@ -2106,12 +2106,14 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
|
||||||
mType == MeasurementsType::Standard ? shownName += QLatin1Literal(".vst") : shownName += QLatin1Literal(".vit");
|
mType == MeasurementsType::Standard ? shownName += QLatin1Literal(".vst") : shownName += QLatin1Literal(".vit");
|
||||||
ui->lineEditPathToFile->setText(tr("<Empty>"));
|
ui->lineEditPathToFile->setText(tr("<Empty>"));
|
||||||
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
|
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
|
||||||
|
ui->lineEditPathToFile->setCursorPosition(0);
|
||||||
ui->pushButtonShowInExplorer->setEnabled(false);
|
ui->pushButtonShowInExplorer->setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->lineEditPathToFile->setText(QDir::toNativeSeparators(curFile));
|
ui->lineEditPathToFile->setText(QDir::toNativeSeparators(curFile));
|
||||||
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(curFile));
|
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(curFile));
|
||||||
|
ui->lineEditPathToFile->setCursorPosition(0);
|
||||||
ui->pushButtonShowInExplorer->setEnabled(true);
|
ui->pushButtonShowInExplorer->setEnabled(true);
|
||||||
auto settings = qApp->TapeSettings();
|
auto settings = qApp->TapeSettings();
|
||||||
QStringList files = settings->GetRecentFileList();
|
QStringList files = settings->GetRecentFileList();
|
||||||
|
@ -3001,52 +3003,3 @@ void TMainWindow::InitGender(QComboBox *gender)
|
||||||
gender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
|
gender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
|
||||||
gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
|
gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void TMainWindow::ShowInGraphicalShell()
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
QStringList args;
|
|
||||||
args << "-e";
|
|
||||||
args << "tell application \"Finder\"";
|
|
||||||
args << "-e";
|
|
||||||
args << "activate";
|
|
||||||
args << "-e";
|
|
||||||
args << "select POSIX file \""+curFile+"\"";
|
|
||||||
args << "-e";
|
|
||||||
args << "end tell";
|
|
||||||
QProcess::startDetached("osascript", args);
|
|
||||||
#elif defined(Q_OS_WIN)
|
|
||||||
QProcess::startDetached(QString("explorer /select, \"%1\"").arg(QDir::toNativeSeparators(curFile)));
|
|
||||||
#else
|
|
||||||
const QString app = "xdg-open %d";
|
|
||||||
QString cmd;
|
|
||||||
for (int i = 0; i < app.size(); ++i)
|
|
||||||
{
|
|
||||||
QChar c = app.at(i);
|
|
||||||
if (c == QLatin1Char('%') && i < app.size()-1)
|
|
||||||
{
|
|
||||||
c = app.at(++i);
|
|
||||||
QString s;
|
|
||||||
if (c == QLatin1Char('d'))
|
|
||||||
{
|
|
||||||
s = QLatin1Char('"') + QFileInfo(curFile).path() + QLatin1Char('"');
|
|
||||||
}
|
|
||||||
else if (c == QLatin1Char('%'))
|
|
||||||
{
|
|
||||||
s = c;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s = QLatin1Char('%');
|
|
||||||
s += c;
|
|
||||||
}
|
|
||||||
cmd += s;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
cmd += c;
|
|
||||||
}
|
|
||||||
QProcess::startDetached(cmd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -116,7 +116,6 @@ private slots:
|
||||||
void ShowMData();
|
void ShowMData();
|
||||||
|
|
||||||
void DeployFormula();
|
void DeployFormula();
|
||||||
void ShowInGraphicalShell();
|
|
||||||
|
|
||||||
void SaveMName();
|
void SaveMName();
|
||||||
void SaveMValue();
|
void SaveMValue();
|
||||||
|
|
|
@ -40,15 +40,26 @@
|
||||||
#define MAX_SIZES 18
|
#define MAX_SIZES 18
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent) :
|
DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPattern *doc, VContainer *pattern,
|
||||||
QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc), pattern(pattern), heightsChecked(MAX_HEIGHTS),
|
QWidget *parent)
|
||||||
sizesChecked(MAX_SIZES), heights (QMap<GHeights, bool>()), sizes(QMap<GSizes, bool>()),
|
: QDialog(parent),
|
||||||
data(QMap<QCheckBox *, int>()), descriptionChanged(false), gradationChanged(false), defaultChanged(false),
|
ui(new Ui::DialogPatternProperties),
|
||||||
securityChanged(false), isInitialized(false),
|
doc(doc),
|
||||||
deleteAction(nullptr),
|
pattern(pattern),
|
||||||
changeImageAction(nullptr),
|
heightsChecked(MAX_HEIGHTS),
|
||||||
saveImageAction(nullptr),
|
sizesChecked(MAX_SIZES),
|
||||||
showImageAction(nullptr)
|
heights (QMap<GHeights, bool>()),
|
||||||
|
sizes(QMap<GSizes, bool>()),
|
||||||
|
data(QMap<QCheckBox *, int>()),
|
||||||
|
descriptionChanged(false),
|
||||||
|
gradationChanged(false),
|
||||||
|
defaultChanged(false),
|
||||||
|
securityChanged(false),
|
||||||
|
deleteAction(nullptr),
|
||||||
|
changeImageAction(nullptr),
|
||||||
|
saveImageAction(nullptr),
|
||||||
|
showImageAction(nullptr),
|
||||||
|
m_filePath(filePath)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -60,6 +71,25 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
|
|
||||||
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
|
if (m_filePath.isEmpty())
|
||||||
|
{
|
||||||
|
ui->lineEditPathToFile->setText(tr("<Empty>"));
|
||||||
|
ui->lineEditPathToFile->setToolTip(tr("File was not saved yet."));
|
||||||
|
ui->pushButtonShowInExplorer->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->lineEditPathToFile->setText(QDir::toNativeSeparators(m_filePath));
|
||||||
|
ui->lineEditPathToFile->setToolTip(QDir::toNativeSeparators(m_filePath));
|
||||||
|
ui->pushButtonShowInExplorer->setEnabled(true);
|
||||||
|
}
|
||||||
|
ui->lineEditPathToFile->setCursorPosition(0);
|
||||||
|
|
||||||
|
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, [this](){ShowInGraphicalShell(m_filePath);});
|
||||||
|
#if defined(Q_OS_MAC)
|
||||||
|
ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
|
||||||
|
#endif //defined(Q_OS_MAC)
|
||||||
|
|
||||||
ui->lineEditAuthor->setText(doc->GetAuthor());
|
ui->lineEditAuthor->setText(doc->GetAuthor());
|
||||||
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);
|
||||||
|
|
||||||
|
@ -329,27 +359,6 @@ void DialogPatternProperties::DescEdited()
|
||||||
descriptionChanged = true;
|
descriptionChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogPatternProperties::showEvent(QShowEvent *event)
|
|
||||||
{
|
|
||||||
QDialog::showEvent( event );
|
|
||||||
if ( event->spontaneous() )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInitialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// do your init stuff here
|
|
||||||
|
|
||||||
setMaximumSize(size());
|
|
||||||
setMinimumSize(size());
|
|
||||||
|
|
||||||
isInitialized = true;//first show windows are held
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::ToggleComboBox()
|
void DialogPatternProperties::ToggleComboBox()
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,8 @@ class DialogPatternProperties : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
|
explicit DialogPatternProperties(const QString &filePath, VPattern *doc, VContainer *pattern,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
virtual ~DialogPatternProperties() Q_DECL_OVERRIDE;
|
virtual ~DialogPatternProperties() Q_DECL_OVERRIDE;
|
||||||
signals:
|
signals:
|
||||||
void UpdateGradation();
|
void UpdateGradation();
|
||||||
|
@ -59,8 +60,6 @@ public slots:
|
||||||
void DescEdited();
|
void DescEdited();
|
||||||
void ChangeImage();
|
void ChangeImage();
|
||||||
void ShowContextMenu();
|
void ShowContextMenu();
|
||||||
protected:
|
|
||||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
|
||||||
private slots:
|
private slots:
|
||||||
void ToggleComboBox();
|
void ToggleComboBox();
|
||||||
void DefValueChanged();
|
void DefValueChanged();
|
||||||
|
@ -82,11 +81,11 @@ private:
|
||||||
bool gradationChanged;
|
bool gradationChanged;
|
||||||
bool defaultChanged;
|
bool defaultChanged;
|
||||||
bool securityChanged;
|
bool securityChanged;
|
||||||
bool isInitialized;
|
|
||||||
QAction *deleteAction;
|
QAction *deleteAction;
|
||||||
QAction *changeImageAction;
|
QAction *changeImageAction;
|
||||||
QAction *saveImageAction;
|
QAction *saveImageAction;
|
||||||
QAction *showImageAction;
|
QAction *showImageAction;
|
||||||
|
const QString &m_filePath;
|
||||||
|
|
||||||
void SetHeightsChecked(bool enabled);
|
void SetHeightsChecked(bool enabled);
|
||||||
void SetSizesChecked(bool enabled);
|
void SetSizesChecked(bool enabled);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>657</width>
|
<width>757</width>
|
||||||
<height>532</height>
|
<height>692</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -28,6 +28,58 @@
|
||||||
<string>Description</string>
|
<string>Description</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayoutPath">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEditPathToFile">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background: transparent;</string>
|
||||||
|
</property>
|
||||||
|
<property name="frame">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string notr="true">Path to the pattern file.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QPushButton" name="pushButtonShowInExplorer">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Show in Explorer</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -1212,7 +1212,7 @@ void MainWindow::OpenRecentFile()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::PatternProperties()
|
void MainWindow::PatternProperties()
|
||||||
{
|
{
|
||||||
DialogPatternProperties proper(doc, pattern, this);
|
DialogPatternProperties proper(curFile, doc, pattern, this);
|
||||||
connect(&proper, &DialogPatternProperties::UpdateGradation, this, &MainWindow::UpdateGradation);
|
connect(&proper, &DialogPatternProperties::UpdateGradation, this, &MainWindow::UpdateGradation);
|
||||||
proper.exec();
|
proper.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QPrinterInfo>
|
#include <QPrinterInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
// Keep synchronize all names with initialization in VTranslateVars class!!!!!
|
// Keep synchronize all names with initialization in VTranslateVars class!!!!!
|
||||||
//measurements
|
//measurements
|
||||||
|
@ -1796,3 +1797,53 @@ QPixmap darkenPixmap(const QPixmap &pixmap)
|
||||||
}
|
}
|
||||||
return QPixmap::fromImage(img);
|
return QPixmap::fromImage(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ShowInGraphicalShell(const QString &filePath)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
QStringList args;
|
||||||
|
args << "-e";
|
||||||
|
args << "tell application \"Finder\"";
|
||||||
|
args << "-e";
|
||||||
|
args << "activate";
|
||||||
|
args << "-e";
|
||||||
|
args << "select POSIX file \""+filePath+"\"";
|
||||||
|
args << "-e";
|
||||||
|
args << "end tell";
|
||||||
|
QProcess::startDetached("osascript", args);
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
QProcess::startDetached(QString("explorer /select, \"%1\"").arg(QDir::toNativeSeparators(filePath)));
|
||||||
|
#else
|
||||||
|
const QString app = "xdg-open %d";
|
||||||
|
QString cmd;
|
||||||
|
for (int i = 0; i < app.size(); ++i)
|
||||||
|
{
|
||||||
|
QChar c = app.at(i);
|
||||||
|
if (c == QLatin1Char('%') && i < app.size()-1)
|
||||||
|
{
|
||||||
|
c = app.at(++i);
|
||||||
|
QString s;
|
||||||
|
if (c == QLatin1Char('d'))
|
||||||
|
{
|
||||||
|
s = QLatin1Char('"') + QFileInfo(filePath).path() + QLatin1Char('"');
|
||||||
|
}
|
||||||
|
else if (c == QLatin1Char('%'))
|
||||||
|
{
|
||||||
|
s = c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = QLatin1Char('%');
|
||||||
|
s += c;
|
||||||
|
}
|
||||||
|
cmd += s;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cmd += c;
|
||||||
|
}
|
||||||
|
QProcess::startDetached(cmd);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -615,6 +615,8 @@ QSharedPointer<QPrinter> DefaultPrinter(QPrinter::PrinterMode mode = QPrinter::S
|
||||||
|
|
||||||
QPixmap darkenPixmap(const QPixmap &pixmap) Q_REQUIRED_RESULT;
|
QPixmap darkenPixmap(const QPixmap &pixmap) Q_REQUIRED_RESULT;
|
||||||
|
|
||||||
|
void ShowInGraphicalShell(const QString &filePath);
|
||||||
|
|
||||||
static inline bool VFuzzyComparePossibleNulls(double p1, double p2) Q_REQUIRED_RESULT;
|
static inline bool VFuzzyComparePossibleNulls(double p1, double p2) Q_REQUIRED_RESULT;
|
||||||
static inline bool VFuzzyComparePossibleNulls(double p1, double p2)
|
static inline bool VFuzzyComparePossibleNulls(double p1, double p2)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user