Added Commit and FileAction dialogs

Skeleton code for Commit, Add, Delete, Revert actions

FossilOrigin-Name: 9e35495cc3f4e18f458cf02f83d1d8075c0a85b9
This commit is contained in:
kostas
2011-08-03 15:30:09 +00:00
parent 8b3ba82e50
commit dd9e18f113
12 changed files with 547 additions and 79 deletions

View File

@ -17,28 +17,67 @@ class QStringList;
struct FileEntry
{
enum Status
enum EntryType
{
STATUS_UNKNOWN,
STATUS_UNCHANGED,
STATUS_EDITTED
TYPE_UNKNOWN = 1<<0,
TYPE_UNCHANGED = 1<<1,
TYPE_EDITTED = 1<<2,
TYPE_ALL = TYPE_UNKNOWN|TYPE_UNCHANGED|TYPE_EDITTED
};
QFileInfo fileinfo;
Status status;
QString filename;
void set(QFileInfo &info, EntryType type, const QString &repoPath)
{
FileInfo = info;
Type = type;
Filename = getRelativeFilename(repoPath);
}
bool isType(EntryType t) const
{
return Type == t;
}
void setType(EntryType t)
{
Type = t;
}
EntryType getType() const
{
return Type;
}
QFileInfo getFileInfo() const
{
return FileInfo;
}
bool isRepo() const
{
return Type == TYPE_UNCHANGED || Type == TYPE_EDITTED;
}
const QString &getFilename() const
{
return Filename;
}
QString getRelativeFilename(const QString &path)
{
QString abs_base_dir = QDir(path).absolutePath();
QString relative = fileinfo.absoluteFilePath();
QString relative = FileInfo.absoluteFilePath();
int index = relative.indexOf(abs_base_dir);
if(index<0)
return QString("");
return relative.right(relative.length() - abs_base_dir.length()-1);
}
private:
QFileInfo FileInfo;
EntryType Type;
QString Filename;
};
@ -58,9 +97,10 @@ private:
const QString &getCurrentWorkspace() { Q_ASSERT(currentWorkspace<workspaces.size()); return workspaces[currentWorkspace]; }
void Log(const QString &text);
bool uiRunning() const { return fossilUI.state() == QProcess::Running; }
void getSelectionFilenames(QStringList &filenames);
void getSelectionFilenames(QStringList &filenames, int includeMask=FileEntry::TYPE_ALL);
bool startUI();
void stopUI();
void updateStatus();
private slots:
void on_actionRefresh_triggered();
@ -70,33 +110,32 @@ private slots:
void on_actionQuit_triggered();
void on_actionTimeline_triggered();
void on_actionHistory_triggered();
void on_actionClearLog_triggered();
void on_tableView_doubleClicked(const QModelIndex &index);
void on_actionOpenFile_triggered();
void on_actionPush_triggered();
void on_actionPull_triggered();
void on_actionCommit_triggered();
void on_actionAdd_triggered();
public slots:
void on_tableView_customContextMenuRequested(const QPoint &pos);
void on_actionDelete_triggered();
void on_actionRevert_triggered();
private:
Ui::MainWindow *ui;
QStandardItemModel itemModel;
QString settingsFile;
Ui::MainWindow *ui;
QStandardItemModel itemModel;
QProcess fossilUI;
QString settingsFile;
QString fossilPath;
QStringList workspaces;
QString projectName;
QString repositoryFile;
QString fossilPath;
QStringList workspaces;
typedef QMap<QString, FileEntry> filemap_t;
filemap_t workspaceFiles;
int currentWorkspace;
QProcess fossilUI;
filemap_t workspaceFiles;
int currentWorkspace;
QStringList commitMessages;
};
#endif // MAINWINDOW_H