Initial work on user defined file actions
FossilOrigin-Name: c1562dbda3ad33559227bb0d2fd177e35cae6681
This commit is contained in:
parent
d285cc76a8
commit
2429d6ca9e
29
manifest
29
manifest
@ -1,5 +1,5 @@
|
||||
C Reorganized\sbranch\soptions\sin\scommit\sdialog.
|
||||
D 2015-06-02T16:19:59.488
|
||||
C Initial\swork\son\suser\sdefined\sfile\sactions\n
|
||||
D 2015-06-02T17:28:10.948
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -224,18 +224,18 @@ F src/FslSettingsDialog.cpp 2531d3709f0eab66651671e3edead2ca720d07d5
|
||||
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 191dff3e4759644be48ce40048d6f93d3a5e03f2
|
||||
F src/MainWindow.h 31870bca434835471159ab350583c21028e77e47
|
||||
F src/MainWindow.cpp 8521536cfe2167d5b82bc5c7808dff8117d3da4f
|
||||
F src/MainWindow.h d3216b30702df9a44b3a93e6c96fd05ceb0e3822
|
||||
F src/RemoteDialog.cpp 8540cc5e2e41c4127ed8a028d84691604fa6ecac
|
||||
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
||||
F src/RevisionDialog.cpp e58c4f8a704f00addebb15d521b76620fdafda79
|
||||
F src/RevisionDialog.h b718c3009342eaabad39c8a11a253a4e4fef7a73
|
||||
F src/SearchBox.cpp d4209c575baa9933e1ce5ed376e785b289a145ba
|
||||
F src/SearchBox.h 0c78d3a68136dab3e0e71b83ae36f22bd2688ab2
|
||||
F src/Settings.cpp 7a674604caa9d9f5ffb6b73d95745bde09525389
|
||||
F src/Settings.h 883ac5c0f38a6ac93b400b7b96447b017ee50c06
|
||||
F src/SettingsDialog.cpp 25be4c351dd21ea9132321944f42dc0bc22fb128
|
||||
F src/SettingsDialog.h b324dfd77ca3ad24fd83588aaf79a7e4c291e716
|
||||
F src/Settings.cpp 8e8c85f2c2aecb6df3d456ce775a4a53704ebbed
|
||||
F src/Settings.h 9eeeec1ac9cee4d8dc44a448995d0d599274c2ff
|
||||
F src/SettingsDialog.cpp 611405e28ce746b2db6ff210c2784d5b8f2dbde8
|
||||
F src/SettingsDialog.h fea64d7f92ff326ea49f14559e36379892c0a7c4
|
||||
F src/Utils.cpp d53b1b92352e586a7c12a19ec6b109a9f095b7f1
|
||||
F src/Utils.h 011e4be3f94cd26be537299cd44ab9c135db44a5
|
||||
F src/Workspace.cpp 7004c2c30f79d2e64691aa9b2c55ee72a84d978b
|
||||
@ -248,11 +248,14 @@ F ui/CloneDialog.ui 4886e7d4f258ea8b852b5eefc860396e35145712
|
||||
F ui/CommitDialog.ui 1e5dafa742e9ae07ec937bcda8cda3297ddc6199
|
||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||
F ui/FslSettingsDialog.ui eb3d4cb764cab90b01e82922237d8c42d6ce1749
|
||||
F ui/MainWindow.ui 10181826a25056ed5aba2b23a7d110159be7c043
|
||||
F ui/MainWindow.ui 140d5b3e8c37d2e764afd3ee9e74bc754888d067
|
||||
F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b
|
||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||
F ui/SettingsDialog.ui 4c480cd595a32664d01c85bf74845c4282fc0068
|
||||
P 4e621933a5ddf87127fab8cc0aa94a4a6fd8c964
|
||||
R 176bdc576cc4d16d2dc819b4b903879d
|
||||
F ui/SettingsDialog.ui 2a84288694c666badb6f29e4badaa3f0bdd46287
|
||||
P 1954aea71218df9a36b6059fac19ab416ef470dc
|
||||
R e725cdba0f62a2aad3ff979a23275b03
|
||||
T *branch * user-actions
|
||||
T *sym-user-actions *
|
||||
T -sym-trunk *
|
||||
U kostas
|
||||
Z d1ca8b7e2dcce6bdcdbdb07bc1f60316
|
||||
Z 732d3b0fa352093eb465015746a344aa
|
||||
|
@ -1 +1 @@
|
||||
1954aea71218df9a36b6059fac19ab416ef470dc
|
||||
c1562dbda3ad33559227bb0d2fd177e35cae6681
|
@ -106,11 +106,14 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
||||
ui->fileTableView->addAction(ui->actionHistory);
|
||||
ui->fileTableView->addAction(ui->actionOpenFile);
|
||||
ui->fileTableView->addAction(ui->actionOpenContaining);
|
||||
ui->actionCustomFileAction->setVisible(false);
|
||||
ui->fileTableView->addAction(ui->actionCustomFileAction);
|
||||
ui->fileTableView->addAction(separator);
|
||||
ui->fileTableView->addAction(ui->actionAdd);
|
||||
ui->fileTableView->addAction(ui->actionRevert);
|
||||
ui->fileTableView->addAction(ui->actionRename);
|
||||
ui->fileTableView->addAction(ui->actionDelete);
|
||||
|
||||
connect( ui->fileTableView,
|
||||
SIGNAL( dragOutEvent() ),
|
||||
SLOT( onFileViewDragOut() ),
|
||||
@ -604,7 +607,8 @@ void MainWindow::enableActions(bool on)
|
||||
ui->actionDeleteTag,
|
||||
ui->actionCreateBranch,
|
||||
ui->actionMergeBranch,
|
||||
ui->actionFossilSettings
|
||||
ui->actionFossilSettings,
|
||||
ui->actionCustomFileAction
|
||||
};
|
||||
|
||||
for(size_t i=0; i<COUNTOF(actions); ++i)
|
||||
@ -1055,6 +1059,8 @@ void MainWindow::applySettings()
|
||||
// Set the workspace after loading the settings, since it may trigger a remote info storage
|
||||
if(!active_workspace.isEmpty())
|
||||
setCurrentWorkspace(active_workspace);
|
||||
|
||||
applyUserActions();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1654,6 +1660,8 @@ void MainWindow::on_actionSettings_triggered()
|
||||
// Run the dialog
|
||||
if(!SettingsDialog::run(this, settings))
|
||||
return;
|
||||
|
||||
applyUserActions();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -2440,7 +2448,7 @@ void MainWindow::on_actionCreateBranch_triggered()
|
||||
updateRevision(branch_name);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::MergeRevision(const QString &defaultRevision)
|
||||
void MainWindow::mergeRevision(const QString &defaultRevision)
|
||||
{
|
||||
QStringList res;
|
||||
QString revision = defaultRevision;
|
||||
@ -2474,7 +2482,7 @@ void MainWindow::on_actionMergeBranch_triggered()
|
||||
|
||||
if(!selectedBranches.isEmpty())
|
||||
revision = selectedBranches.first();
|
||||
MergeRevision(revision);
|
||||
mergeRevision(revision);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -2661,3 +2669,45 @@ void MainWindow::on_actionDeleteRemote_triggered()
|
||||
updateWorkspaceView();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::applyUserActions()
|
||||
{
|
||||
QString fileaction_name;
|
||||
QString fileaction_cmd;
|
||||
|
||||
if(settings.HasValue(FUEL_SETTING_FILEACTION_NAME) && settings.HasValue(FUEL_SETTING_FILEACTION_COMMAND))
|
||||
{
|
||||
fileaction_name = settings.GetValue(FUEL_SETTING_FILEACTION_NAME).toString();
|
||||
fileaction_cmd = settings.GetValue(FUEL_SETTING_FILEACTION_COMMAND).toString();
|
||||
}
|
||||
|
||||
if(!fileaction_name.isEmpty() && !fileaction_cmd.isEmpty())
|
||||
{
|
||||
ui->actionCustomFileAction->setVisible(true);
|
||||
ui->actionCustomFileAction->setText(fileaction_name);
|
||||
}
|
||||
else
|
||||
ui->actionCustomFileAction->setVisible(false);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionCustomFileAction_triggered()
|
||||
{
|
||||
if(!settings.HasValue(FUEL_SETTING_FILEACTION_NAME) || !settings.HasValue(FUEL_SETTING_FILEACTION_COMMAND))
|
||||
return;
|
||||
|
||||
QStringList selection;
|
||||
getSelectionFilenames(selection, WorkspaceFile::TYPE_ALL);
|
||||
|
||||
QProcess proc(this);
|
||||
|
||||
QStringList params;
|
||||
foreach(const QString &f, selection)
|
||||
{
|
||||
QString path = QFileInfo(fossil().getCurrentWorkspace() + "/" + f).absoluteFilePath();
|
||||
params.append(path);
|
||||
}
|
||||
|
||||
const QString &cmd = settings.GetValue(FUEL_SETTING_FILEACTION_COMMAND).toString();
|
||||
proc.startDetached(cmd, params);
|
||||
}
|
||||
|
@ -52,7 +52,9 @@ private:
|
||||
void updateWorkspaceView();
|
||||
void updateFileView();
|
||||
void selectRootDir();
|
||||
void MergeRevision(const QString& defaultRevision);
|
||||
void mergeRevision(const QString& defaultRevision);
|
||||
void applyUserActions();
|
||||
|
||||
|
||||
void fossilBrowse(const QString &fossilUrl);
|
||||
void dragEnterEvent(class QDragEnterEvent *event);
|
||||
@ -132,6 +134,7 @@ private slots:
|
||||
void on_actionSetDefaultRemote_triggered();
|
||||
void on_actionAddRemote_triggered();
|
||||
void on_actionDeleteRemote_triggered();
|
||||
void on_actionCustomFileAction_triggered();
|
||||
|
||||
private:
|
||||
class MainWinUICallback : public UICallback
|
||||
|
@ -37,6 +37,11 @@ Settings::Settings(bool portableMode) : store(0)
|
||||
if(!HasValue(FUEL_SETTING_WEB_BROWSER))
|
||||
SetValue(FUEL_SETTING_WEB_BROWSER, 0);
|
||||
|
||||
if(!HasValue(FUEL_SETTING_FILEACTION_NAME))
|
||||
SetValue(FUEL_SETTING_FILEACTION_NAME, "");
|
||||
if(!HasValue(FUEL_SETTING_FILEACTION_COMMAND))
|
||||
SetValue(FUEL_SETTING_FILEACTION_COMMAND, "");
|
||||
|
||||
ApplyEnvironment();
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#define FUEL_SETTING_FILE_DBLCLICK "FileDblClickAction"
|
||||
#define FUEL_SETTING_LANGUAGE "Language"
|
||||
#define FUEL_SETTING_WEB_BROWSER "WebBrowser"
|
||||
#define FUEL_SETTING_FILEACTION_NAME "FileActionName"
|
||||
#define FUEL_SETTING_FILEACTION_COMMAND "FileActionCommand"
|
||||
|
||||
#define FOSSIL_SETTING_GDIFF_CMD "gdiff-command"
|
||||
#define FOSSIL_SETTING_GMERGE_CMD "gmerge-command"
|
||||
|
@ -26,6 +26,9 @@ SettingsDialog::SettingsDialog(QWidget *parent, Settings &_settings) :
|
||||
ui->cmbDoubleClickAction->setCurrentIndex(settings->GetValue(FUEL_SETTING_FILE_DBLCLICK).toInt());
|
||||
ui->cmbFossilBrowser->setCurrentIndex(settings->GetValue(FUEL_SETTING_WEB_BROWSER).toInt());
|
||||
|
||||
ui->lineCustomFileActionName->setText(settings->GetValue(FUEL_SETTING_FILEACTION_NAME).toString());
|
||||
ui->lineCustomFileActionCommand->setText(settings->GetValue(FUEL_SETTING_FILEACTION_COMMAND).toString());
|
||||
|
||||
// Initialize language combo
|
||||
foreach(const LangMap &m, langMap)
|
||||
ui->cmbActiveLanguage->addItem(m.name);
|
||||
@ -68,6 +71,12 @@ void SettingsDialog::on_buttonBox_accepted()
|
||||
if(curr_langid != new_langid)
|
||||
QMessageBox::information(this, tr("Restart required"), tr("The language change will take effect after restarting the application"), QMessageBox::Ok);
|
||||
|
||||
|
||||
Q_ASSERT(settings->HasValue(FUEL_SETTING_FILEACTION_NAME));
|
||||
settings->SetValue(FUEL_SETTING_FILEACTION_NAME, ui->lineCustomFileActionName->text().trimmed());
|
||||
Q_ASSERT(settings->HasValue(FUEL_SETTING_FILEACTION_COMMAND));
|
||||
settings->SetValue(FUEL_SETTING_FILEACTION_COMMAND, QDir::fromNativeSeparators(ui->lineCustomFileActionCommand->text().trimmed()));
|
||||
|
||||
settings->ApplyEnvironment();
|
||||
}
|
||||
|
||||
@ -121,3 +130,11 @@ QString SettingsDialog::LangNameToId(const QString &name)
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void SettingsDialog::on_btnSelectCustomFileActionCommand_clicked()
|
||||
{
|
||||
QString path = SelectExe(this, tr("Select executable"));
|
||||
if(!path.isEmpty())
|
||||
ui->lineCustomFileActionCommand->setText(QDir::toNativeSeparators(path));
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ private slots:
|
||||
void on_btnSelectFossil_clicked();
|
||||
void on_buttonBox_accepted();
|
||||
void on_btnClearMessageHistory_clicked();
|
||||
void on_btnSelectCustomFileActionCommand_clicked();
|
||||
|
||||
private:
|
||||
QString LangIdToName(const QString &id);
|
||||
|
@ -1047,6 +1047,14 @@
|
||||
<string>Delete Remote</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCustomFileAction">
|
||||
<property name="text">
|
||||
<string>Custom File Action</string>
|
||||
</property>
|
||||
<property name="iconText">
|
||||
<string>Custom File Action</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>204</height>
|
||||
<height>278</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -180,6 +180,69 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom File Action Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineCustomFileActionName">
|
||||
<property name="toolTip">
|
||||
<string>Name of custom action</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom File Action Command</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineCustomFileActionCommand">
|
||||
<property name="toolTip">
|
||||
<string>Custom action command line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSelectCustomFileActionCommand">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user