Added Path and Modified columns
Double clicking a file invokes diff Added Open file action FossilOrigin-Name: 22658a331a132d4adb2643d8d51f379e35b95f63
This commit is contained in:
parent
d08b7adb90
commit
0ea111ee0b
@ -5,6 +5,17 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
COLUMN_STATUS,
|
||||||
|
COLUMN_PATH,
|
||||||
|
COLUMN_FILENAME,
|
||||||
|
COLUMN_EXTENSION,
|
||||||
|
COLUMN_MODIFIED
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@ -14,6 +25,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->tableView->setModel(&itemModel);
|
ui->tableView->setModel(&itemModel);
|
||||||
ui->tableView->addAction(ui->actionDiff);
|
ui->tableView->addAction(ui->actionDiff);
|
||||||
ui->tableView->addAction(ui->actionHistory);
|
ui->tableView->addAction(ui->actionHistory);
|
||||||
|
ui->tableView->addAction(ui->actionOpenFile);
|
||||||
ui->tableView->addAction(ui->actionAdd);
|
ui->tableView->addAction(ui->actionAdd);
|
||||||
ui->tableView->addAction(ui->actionDelete);
|
ui->tableView->addAction(ui->actionDelete);
|
||||||
ui->tableView->addAction(ui->actionRename);
|
ui->tableView->addAction(ui->actionRename);
|
||||||
@ -118,7 +130,7 @@ void MainWindow::refresh()
|
|||||||
if(status_text=="EDITED")
|
if(status_text=="EDITED")
|
||||||
status = FileEntry::STATUS_EDITTED;
|
status = FileEntry::STATUS_EDITTED;
|
||||||
else if(status_text=="UNCHANGED")
|
else if(status_text=="UNCHANGED")
|
||||||
status = FileEntry::STATUS_UNCHAGED;
|
status = FileEntry::STATUS_UNCHANGED;
|
||||||
|
|
||||||
QString fname = line.right(line.length() - 10).trimmed();
|
QString fname = line.right(line.length() - 10).trimmed();
|
||||||
|
|
||||||
@ -130,7 +142,7 @@ void MainWindow::refresh()
|
|||||||
|
|
||||||
// Update the model
|
// Update the model
|
||||||
itemModel.clear();
|
itemModel.clear();
|
||||||
itemModel.setHorizontalHeaderLabels(QStringList() << "Status" << "File" << "Ext" );
|
itemModel.setHorizontalHeaderLabels(QStringList() << "S" << "Path" << "File" << "Ext" << "Modified" );
|
||||||
|
|
||||||
size_t i=0;
|
size_t i=0;
|
||||||
for(filemap_t::iterator it = workspaceFiles.begin(); it!=workspaceFiles.end(); ++it, ++i)
|
for(filemap_t::iterator it = workspaceFiles.begin(); it!=workspaceFiles.end(); ++it, ++i)
|
||||||
@ -141,25 +153,30 @@ void MainWindow::refresh()
|
|||||||
case FileEntry::STATUS_EDITTED:
|
case FileEntry::STATUS_EDITTED:
|
||||||
{
|
{
|
||||||
QIcon modicon(":icons/icons/Button Blank Yellow-01.png");
|
QIcon modicon(":icons/icons/Button Blank Yellow-01.png");
|
||||||
itemModel.setItem(i, 0, new QStandardItem(modicon, "Edited"));
|
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(modicon, "E"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FileEntry::STATUS_UNCHAGED:
|
case FileEntry::STATUS_UNCHANGED:
|
||||||
{
|
{
|
||||||
QIcon modicon(":icons/icons/Button Blank Green-01.png");
|
QIcon modicon(":icons/icons/Button Blank Green-01.png");
|
||||||
itemModel.setItem(i, 0, new QStandardItem(modicon, "Unchanged"));
|
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(modicon, "U"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
QIcon modicon(":icons/icons/Button Blank Gray-01.png");
|
QIcon modicon(":icons/icons/Button Blank Gray-01.png");
|
||||||
itemModel.setItem(i, 0, new QStandardItem(modicon, "Unknown"));
|
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(modicon, "?"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
itemModel.setItem(i, 1, new QStandardItem(e.filename));
|
QString path = e.filename;
|
||||||
itemModel.setItem(i, 2, new QStandardItem( e.fileinfo.completeSuffix()));
|
path = path.left(path.indexOf(e.fileinfo.fileName()));
|
||||||
|
|
||||||
|
itemModel.setItem(i, COLUMN_PATH, new QStandardItem(path));
|
||||||
|
itemModel.setItem(i, COLUMN_FILENAME, new QStandardItem(e.filename));
|
||||||
|
itemModel.setItem(i, COLUMN_EXTENSION, new QStandardItem(e.fileinfo.completeSuffix()));
|
||||||
|
itemModel.setItem(i, COLUMN_MODIFIED, new QStandardItem(e.fileinfo.lastModified().toString(Qt::SystemLocaleShortDate)));
|
||||||
|
|
||||||
}
|
}
|
||||||
ui->tableView->resizeColumnsToContents();
|
ui->tableView->resizeColumnsToContents();
|
||||||
@ -214,8 +231,9 @@ bool MainWindow::runFossil(QStringList &result, const QStringList &args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::on_tableView_customContextMenuRequested(const QPoint &pos)
|
void MainWindow::on_tableView_customContextMenuRequested(const QPoint &/*pos*/)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
QModelIndex idx = ui->tableView->indexAt(pos);
|
QModelIndex idx = ui->tableView->indexAt(pos);
|
||||||
if(!idx.isValid())
|
if(!idx.isValid())
|
||||||
return;
|
return;
|
||||||
@ -227,7 +245,7 @@ void MainWindow::on_tableView_customContextMenuRequested(const QPoint &pos)
|
|||||||
menu->addAction("Delete");
|
menu->addAction("Delete");
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction("Commit");
|
menu->addAction("Commit");
|
||||||
menu->exec(pos);
|
menu->exec(pos);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -306,7 +324,7 @@ void MainWindow::getSelectionFilenames(QStringList &filenames)
|
|||||||
|
|
||||||
// FIXME: we are being called once per cell of each row
|
// FIXME: we are being called once per cell of each row
|
||||||
// but we only need column 1. There must be a better way
|
// but we only need column 1. There must be a better way
|
||||||
if(mi.column()!=1)
|
if(mi.column()!=COLUMN_FILENAME)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QVariant data = itemModel.data(mi);
|
QVariant data = itemModel.data(mi);
|
||||||
@ -399,3 +417,20 @@ void MainWindow::on_actionHistory_triggered()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void MainWindow::on_tableView_doubleClicked(const QModelIndex &/*index*/)
|
||||||
|
{
|
||||||
|
on_actionDiff_triggered();
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void MainWindow::on_actionOpenFile_triggered()
|
||||||
|
{
|
||||||
|
QStringList selection;
|
||||||
|
getSelectionFilenames(selection);
|
||||||
|
|
||||||
|
for(QStringList::iterator it = selection.begin(); it!=selection.end(); ++it)
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(QUrl::fromLocalFile(getCurrentWorkspace()+QDir::separator()+*it));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -20,7 +20,7 @@ struct FileEntry
|
|||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
STATUS_UNKNOWN,
|
STATUS_UNKNOWN,
|
||||||
STATUS_UNCHAGED,
|
STATUS_UNCHANGED,
|
||||||
STATUS_EDITTED
|
STATUS_EDITTED
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,6 +73,10 @@ private slots:
|
|||||||
|
|
||||||
void on_actionClearLog_triggered();
|
void on_actionClearLog_triggered();
|
||||||
|
|
||||||
|
void on_tableView_doubleClicked(const QModelIndex &index);
|
||||||
|
|
||||||
|
void on_actionOpenFile_triggered();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_tableView_customContextMenuRequested(const QPoint &pos);
|
void on_tableView_customContextMenuRequested(const QPoint &pos);
|
||||||
|
|
||||||
|
@ -299,6 +299,11 @@
|
|||||||
<string>Timeline</string>
|
<string>Timeline</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionOpenFile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open file</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources>
|
<resources>
|
||||||
|
18
manifest
18
manifest
@ -1,8 +1,8 @@
|
|||||||
C Reorganized\scontext\smenu\nAdded\sClear\slog\saction\nImproved\ssettings\sserialization.\nAdded\sSaving\sand\sloading\sof\swindow\sposition\sand\ssize\nAdded\sQuit\saction\nAdded\sTimeline\saction\nAdded\sFile\shistory\saction
|
C Added\sPath\sand\sModified\scolumns\nDouble\sclicking\sa\sfile\sinvokes\sdiff\nAdded\sOpen\sfile\saction
|
||||||
D 2011-08-02T14:37:32.392
|
D 2011-08-02T15:37:39.139
|
||||||
F MainWindow.cpp 40b52cc20d0bdd312eda97dabfe061d0b811c4ca
|
F MainWindow.cpp 4adeb7e76a91a587a6a57e76e8e3edba5093473e
|
||||||
F MainWindow.h d9dd1137ff2af5a3a10d0f63f6bfe85d25b466c4
|
F MainWindow.h a3e385b65b14b25de39e683165104e15fc92ae68
|
||||||
F MainWindow.ui ecde2d039645f4ff31d56416985fa372b534dade
|
F MainWindow.ui 71a58630d7a3b6af128d427a9390eadfc4fc83e3
|
||||||
F icons/Address\sBook-01.png ef2cec80ea5a559b72e8be4a344a1869fe69cbd8
|
F icons/Address\sBook-01.png ef2cec80ea5a559b72e8be4a344a1869fe69cbd8
|
||||||
F icons/Adobe\sIllustrator\sCS3\sDocument-01.png 2e44e933d58eefee7ccfa1650fed4ceadcf3c2be
|
F icons/Adobe\sIllustrator\sCS3\sDocument-01.png 2e44e933d58eefee7ccfa1650fed4ceadcf3c2be
|
||||||
F icons/Adobe\sPDF\sDocument-01.png 8a0bc3ba633d08debde748d64b5a9675e30447a3
|
F icons/Adobe\sPDF\sDocument-01.png 8a0bc3ba633d08debde748d64b5a9675e30447a3
|
||||||
@ -157,9 +157,9 @@ F icons/Zoom\sOut-01.png 8eda092100d9e00c9097f43a80d1e26695947448
|
|||||||
F icons/Zoom-01.png 67ca532922e9166325c5c75fce1ca3fbb0d2b6a6
|
F icons/Zoom-01.png 67ca532922e9166325c5c75fce1ca3fbb0d2b6a6
|
||||||
F main.cpp f53e9e1e34f65565f06b2d37d7be5c38e2113a03
|
F main.cpp f53e9e1e34f65565f06b2d37d7be5c38e2113a03
|
||||||
F qtfossil.pro 80268b3b1ec8f73cbc24896a0f2ae3fbcca286cb
|
F qtfossil.pro 80268b3b1ec8f73cbc24896a0f2ae3fbcca286cb
|
||||||
F qtfossil.pro.user 22fafa96fdc37a358378024e78fab11e7796b61d
|
F qtfossil.pro.user 1158668605888375173ffebe3cda61de6ebc4e72
|
||||||
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
||||||
P b900691237413a91803d830d1e9e6702ed76d749
|
P 836ed88f08a4d0133120fa5735627bbd24cd30a0
|
||||||
R 73ae2bf1796d58dab2d89012f1383da3
|
R 58b9892426d610ee78533f5c84abd2c2
|
||||||
U kostas
|
U kostas
|
||||||
Z 7d44a0e71f9d084bae91ca71484d39c3
|
Z ddf19bd088c79dcb80cd114027ea16a1
|
||||||
|
@ -1 +1 @@
|
|||||||
836ed88f08a4d0133120fa5735627bbd24cd30a0
|
22658a331a132d4adb2643d8d51f379e35b95f63
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by Qt Creator 2.2.82, 2011-08-02T23:35:20. -->
|
<!-- Written by Qt Creator 2.2.82, 2011-08-03T00:36:05. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user