Method Show in Explorer.
--HG-- branch : feature
This commit is contained in:
parent
984d10498b
commit
6294fcc753
|
@ -42,6 +42,7 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
#define DIALOG_MAX_FORMULA_HEIGHT 64
|
||||||
|
|
||||||
|
@ -1262,6 +1263,8 @@ void TMainWindow::InitWindow()
|
||||||
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
||||||
connect(ui->lineEditFullName, &QLineEdit::editingFinished, this, &TMainWindow::SaveMFullName);
|
connect(ui->lineEditFullName, &QLineEdit::editingFinished, this, &TMainWindow::SaveMFullName);
|
||||||
|
|
||||||
|
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, this, &TMainWindow::ShowInGraphicalShell);
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1333,13 +1336,13 @@ void TMainWindow::SetCurrentFile(const QString &fileName)
|
||||||
shownName += ".vit";
|
shownName += ".vit";
|
||||||
}
|
}
|
||||||
ui->labelPathToFile->setText(tr("<Empty>"));
|
ui->labelPathToFile->setText(tr("<Empty>"));
|
||||||
ui->pushButtonShowInFolder->setEnabled(false);
|
ui->pushButtonShowInExplorer->setEnabled(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->labelPathToFile->setText(curFile);
|
ui->labelPathToFile->setText(curFile);
|
||||||
ui->labelPathToFile->setToolTip(curFile);
|
ui->labelPathToFile->setToolTip(curFile);
|
||||||
ui->pushButtonShowInFolder->setEnabled(true);
|
ui->pushButtonShowInExplorer->setEnabled(true);
|
||||||
}
|
}
|
||||||
shownName += "[*]";
|
shownName += "[*]";
|
||||||
setWindowTitle(shownName);
|
setWindowTitle(shownName);
|
||||||
|
@ -1654,3 +1657,55 @@ void TMainWindow::SetDecimals()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TMainWindow::ShowInGraphicalShell()
|
||||||
|
{
|
||||||
|
#ifdef Q_WS_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_WS_WIN)
|
||||||
|
QStringList args;
|
||||||
|
args << "/select," << QDir::toNativeSeparators(curFile);
|
||||||
|
const QString command = "explorer" + " " + args;
|
||||||
|
QProcess::startDetached(command);
|
||||||
|
#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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ private slots:
|
||||||
void ShowMData();
|
void ShowMData();
|
||||||
|
|
||||||
void DeployFormula();
|
void DeployFormula();
|
||||||
|
void ShowInGraphicalShell();
|
||||||
|
|
||||||
void SaveMName();
|
void SaveMName();
|
||||||
void SaveMValue();
|
void SaveMValue();
|
||||||
|
|
|
@ -433,12 +433,12 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignRight">
|
<item alignment="Qt::AlignRight">
|
||||||
<widget class="QPushButton" name="pushButtonShowInFolder">
|
<widget class="QPushButton" name="pushButtonShowInExplorer">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show in folder</string>
|
<string>Show in Explorer</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user