Implemented diff command

Implemented ui command
Added full set of icons

FossilOrigin-Name: b900691237413a91803d830d1e9e6702ed76d749
This commit is contained in:
kostas 2011-08-02 13:16:35 +00:00
parent 66329a565b
commit 58fe746714
178 changed files with 432 additions and 85 deletions

View File

@ -28,22 +28,23 @@ MainWindow::MainWindow(QWidget *parent) :
if(fossilPath.isEmpty())
fossilPath = "fossil";
// fossilPath = "/home/kostas/local/bin/fossil";
// repoPath = ;
refresh();
}
//------------------------------------------------------------------------------
MainWindow::~MainWindow()
{
saveSettings();
delete ui;
}
//------------------------------------------------------------------------------
void MainWindow::on_actionRefresh_triggered()
{
refresh();
}
//------------------------------------------------------------------------------
void MainWindow::on_actionOpen_triggered()
{
QString path = QFileDialog::getExistingDirectory (this, tr("Fossil Checkout"));
@ -56,11 +57,12 @@ void MainWindow::on_actionOpen_triggered()
}
void RecurseDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir)
//------------------------------------------------------------------------------
static void RecurseDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir)
{
QDir dir(dirPath);
QFileInfoList list = dir.entryInfoList(QDir::AllEntries);
QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::Hidden);
for (int i=0; i<list.count(); ++i)
{
QFileInfo info = list[i];
@ -81,13 +83,10 @@ void RecurseDirectory(QFileInfoList &entries, const QString& dirPath, const QStr
}
}
//------------------------------------------------------------------------------
void MainWindow::refresh()
{
QStringList res;
if(!runFossil(res, QStringList() << "ls" << "-l"))
return;
// Scan all files
// Scan all workspace files
QFileInfoList all_files;
QString wkdir = getCurrentWorkspace();
@ -105,6 +104,11 @@ void MainWindow::refresh()
workspaceFiles.insert(e.filename, e);
}
// Retrieve the status of files tracked by fossil
QStringList res;
if(!runFossil(res, QStringList() << "ls" << "-l"))
return;
for(QStringList::iterator it=res.begin(); it!=res.end(); ++it)
{
QString line = (*it).trimmed();
@ -127,6 +131,7 @@ void MainWindow::refresh()
it.value().status = status;
}
// Update the model
itemModel.clear();
itemModel.setHorizontalHeaderLabels(QStringList() << "Status" << "File" << "Ext" );
@ -138,19 +143,19 @@ void MainWindow::refresh()
{
case FileEntry::STATUS_EDITTED:
{
QIcon modicon(":icons/icons/Button-Blank-Yellow-icon.png");
QIcon modicon(":icons/icons/Button Blank Yellow-01.png");
itemModel.setItem(i, 0, new QStandardItem(modicon, "Edited"));
break;
}
case FileEntry::STATUS_UNCHAGED:
{
QIcon modicon(":icons/icons/Button-Blank-Green-icon.png");
QIcon modicon(":icons/icons/Button Blank Green-01.png");
itemModel.setItem(i, 0, new QStandardItem(modicon, "Unchanged"));
break;
}
default:
{
QIcon modicon(":icons/icons/Button-Blank-Gray-icon.png");
QIcon modicon(":icons/icons/Button Blank Gray-01.png");
itemModel.setItem(i, 0, new QStandardItem(modicon, "Unknown"));
}
@ -164,6 +169,13 @@ void MainWindow::refresh()
ui->tableView->resizeRowsToContents();
}
//------------------------------------------------------------------------------
void MainWindow::Log(const QString &text)
{
ui->textBrowser->append(text);
}
//------------------------------------------------------------------------------
bool MainWindow::runFossil(QStringList &result, const QStringList &args)
{
QProcess process;
@ -174,12 +186,12 @@ bool MainWindow::runFossil(QStringList &result, const QStringList &args)
QStringList rargs;
rargs << args;
ui->textBrowser->append("fossil "+rargs.join(" "));
Log("> fossil "+rargs.join(" "));
process.start(fossilPath, rargs);
if(!process.waitForStarted())
{
ui->textBrowser->append(fossilPath + " does not exist\n");
Log(fossilPath + " does not exist\n");
return false;
}
@ -191,14 +203,15 @@ bool MainWindow::runFossil(QStringList &result, const QStringList &args)
for(QStringList::iterator it=lines.begin(); it!=lines.end(); ++it)
{
QString &line = *it;
result.append(line.trimmed());
ui->textBrowser->append( line.trimmed());
QString line = it->trimmed();
result.append(line);
Log(line);
}
return true;
}
//------------------------------------------------------------------------------
void MainWindow::on_tableView_customContextMenuRequested(const QPoint &pos)
{
QModelIndex idx = ui->tableView->indexAt(pos);
@ -213,10 +226,9 @@ void MainWindow::on_tableView_customContextMenuRequested(const QPoint &pos)
menu->addSeparator();
menu->addAction("Commit");
menu->exec(pos);
// QMen
}
//------------------------------------------------------------------------------
void MainWindow::loadSettings()
{
QSettings settings(settingsFile, QSettings::NativeFormat);
@ -244,14 +256,59 @@ void MainWindow::loadSettings()
}
//------------------------------------------------------------------------------
void MainWindow::saveSettings()
{
QSettings settings(settingsFile, QSettings::NativeFormat);
settings.setValue("FossilPath", fossilPath);
settings.setValue("NumWorkspaces", workspaces.size());
for(size_t i=0; i<workspaces.size(); ++i)
for(int i=0; i<workspaces.size(); ++i)
settings.setValue("Workspace_"+i, workspaces[i]);
settings.setValue("LastWorkspace", currentWorkspace);
}
//------------------------------------------------------------------------------
void MainWindow::on_actionDiff_triggered()
{
QModelIndexList selection = ui->tableView->selectionModel()->selectedIndexes();
for(QModelIndexList::iterator mi_it = selection.begin(); mi_it!=selection.end(); ++mi_it)
{
const QModelIndex &mi = *mi_it;
// FIXME: we are being called once per cell of each row
// but we only need column 1. There must be a better way
if(mi.column()!=1)
continue;
QVariant data = itemModel.data(mi);
QString fname = data.toString();
QStringList res;
if(!runFossil(res, QStringList() << "gdiff" << fname))
return;
}
}
void MainWindow::on_actionFossilUI_toggled(bool arg1)
{
if(arg1 && fossilUI.state()==QProcess::NotRunning)
{
fossilUI.setProcessChannelMode(QProcess::MergedChannels);
fossilUI.setWorkingDirectory(getCurrentWorkspace());
Log("> fossil ui");
fossilUI.start(fossilPath, QStringList() << "ui");
if(!fossilUI.waitForStarted())
{
Log(fossilPath + " does not exist\n");
return;
}
}
else if(!arg1 && fossilUI.state()==QProcess::Running)
{
fossilUI.terminate();
}
}

View File

@ -7,6 +7,8 @@
#include <QMap>
#include <QFileInfo>
#include <QDir>
#include <QProcess>
namespace Ui {
class MainWindow;
}
@ -54,11 +56,16 @@ private:
void loadSettings();
void saveSettings();
const QString &getCurrentWorkspace() { Q_ASSERT(currentWorkspace<workspaces.size()); return workspaces[currentWorkspace]; }
void Log(const QString &text);
private slots:
void on_actionRefresh_triggered();
void on_actionOpen_triggered();
void on_actionDiff_triggered();
void on_actionFossilUI_toggled(bool arg1);
public slots:
void on_tableView_customContextMenuRequested(const QPoint &pos);
@ -73,6 +80,8 @@ private:
typedef QMap<QString, FileEntry> filemap_t;
filemap_t workspaceFiles;
int currentWorkspace;
QProcess fossilUI;
};
#endif // MAINWINDOW_H

View File

@ -136,7 +136,7 @@
<action name="actionRefresh">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Button-Refresh-icon.png</normaloff>:/icons/icons/Button-Refresh-icon.png</iconset>
<normaloff>:/icons/icons/Button Refresh-01.png</normaloff>:/icons/icons/Button Refresh-01.png</iconset>
</property>
<property name="text">
<string>Refresh</string>
@ -145,7 +145,7 @@
<action name="actionCommit">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Button-Add-icon.png</normaloff>:/icons/icons/Button-Add-icon.png</iconset>
<normaloff>:/icons/icons/Save-01.png</normaloff>:/icons/icons/Save-01.png</iconset>
</property>
<property name="text">
<string>Commit</string>
@ -154,7 +154,7 @@
<action name="actionDiff">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Document-Copy-icon.png</normaloff>:/icons/icons/Document-Copy-icon.png</iconset>
<normaloff>:/icons/icons/Document Copy-01.png</normaloff>:/icons/icons/Document Copy-01.png</iconset>
</property>
<property name="text">
<string>Diff</string>
@ -163,7 +163,7 @@
<action name="actionAdd">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/File-New-icon.png</normaloff>:/icons/icons/File-New-icon.png</iconset>
<normaloff>:/icons/icons/File New-01.png</normaloff>:/icons/icons/File New-01.png</iconset>
</property>
<property name="text">
<string>Add</string>
@ -172,13 +172,17 @@
<action name="actionDelete">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/File-Delete-icon.png</normaloff>:/icons/icons/File-Delete-icon.png</iconset>
<normaloff>:/icons/icons/File Delete-01.png</normaloff>:/icons/icons/File Delete-01.png</iconset>
</property>
<property name="text">
<string>Delete</string>
</property>
</action>
<action name="actionOpen">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/My Documents-01.png</normaloff>:/icons/icons/My Documents-01.png</iconset>
</property>
<property name="text">
<string>Open workspace...</string>
</property>
@ -186,7 +190,7 @@
<action name="actionPush">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Button-Upload-icon.png</normaloff>:/icons/icons/Button-Upload-icon.png</iconset>
<normaloff>:/icons/icons/Button Upload-01.png</normaloff>:/icons/icons/Button Upload-01.png</iconset>
</property>
<property name="text">
<string>Push</string>
@ -195,7 +199,7 @@
<action name="actionPull">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Button-Download-icon.png</normaloff>:/icons/icons/Button-Download-icon.png</iconset>
<normaloff>:/icons/icons/Button Download-01.png</normaloff>:/icons/icons/Button Download-01.png</iconset>
</property>
<property name="text">
<string>Pull</string>
@ -204,7 +208,7 @@
<action name="actionRename">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/File-Open-icon.png</normaloff>:/icons/icons/File-Open-icon.png</iconset>
<normaloff>:/icons/icons/File Open-01.png</normaloff>:/icons/icons/File Open-01.png</iconset>
</property>
<property name="text">
<string>Rename</string>
@ -214,6 +218,10 @@
</property>
</action>
<action name="actionQuit">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Button Turn Off-01.png</normaloff>:/icons/icons/Button Turn Off-01.png</iconset>
</property>
<property name="text">
<string>Quit</string>
</property>
@ -221,19 +229,25 @@
<action name="actionHistory">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/File-History-icon.png</normaloff>:/icons/icons/File-History-icon.png</iconset>
<normaloff>:/icons/icons/File History-01.png</normaloff>:/icons/icons/File History-01.png</iconset>
</property>
<property name="text">
<string>history</string>
</property>
</action>
<action name="actionFossilUI">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Network-PC-icon.png</normaloff>:/icons/icons/Network-PC-icon.png</iconset>
<normaloff>:/icons/icons/Network MAC-01.png</normaloff>:/icons/icons/Network MAC-01.png</iconset>
</property>
<property name="text">
<string>FossilUI</string>
<string>Fossil UI</string>
</property>
<property name="toolTip">
<string>Starts the Fosill UI</string>
</property>
</action>
<action name="actionRevert">
@ -245,6 +259,15 @@
<string>revert</string>
</property>
</action>
<action name="actionClearLog">
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icons/icons/Book-01.png</normaloff>:/icons/icons/Book-01.png</iconset>
</property>
<property name="text">
<string>clearLog</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>

BIN
icons/Address Book-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
icons/Battery-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
icons/Binoculars-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
icons/Book-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
icons/Briefcase-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
icons/Button Add-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
icons/Button Cancel-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
icons/Button Close-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
icons/Button Delete-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
icons/Button Forward-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
icons/Button Help-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
icons/Button Info-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
icons/Button Log Off-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
icons/Button Next-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
icons/Button Pause-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
icons/Button Play-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
icons/Button Refresh-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
icons/Button Reload-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
icons/Button Rewind-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
icons/Button Turn On-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
icons/Button Upload-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
icons/Button Warning-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
icons/Calculator-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
icons/Calendar Blue-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
icons/Calendar Green-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
icons/Calendar Red-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
icons/Clipboard-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
icons/Clock-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
icons/Coin-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
icons/Document Blank-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
icons/Document Chart-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
icons/Document Copy-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
icons/Document Help-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
icons/Document Text-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
icons/Document-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

BIN
icons/Edit Document-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
icons/Email Delete-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
icons/Email Download-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
icons/Email Forward-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
icons/Email Inbox-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
icons/Email Reply-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
icons/Email-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
icons/File Audio MP3-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
icons/File Audio WAV-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
icons/File Audio WMA-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
icons/File Audio-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
icons/File Delete-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
icons/File History-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
icons/File New-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
icons/File Open-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Some files were not shown because too many files have changed in this diff Show More