Skip to content

Commit

Permalink
Merge remote branch 'hef/master'
Browse files Browse the repository at this point in the history
Conflicts:
	mainwindow.ui
  • Loading branch information
bdenne2 committed Dec 2, 2010
2 parents 1e89ceb + 57aa42a commit 6196cc1
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 73 deletions.
15 changes: 14 additions & 1 deletion gitcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ GitCommand::GitCommand(QObject *parent) :
defaultArgs(new QStringList),
repo(),
gitStatusProcess(new QProcess),
gitLSIgnoredProcess(new QProcess)
gitLSIgnoredProcess(new QProcess),
gitAddProcess(new QProcess)
{
connect(gitStatusProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(statusOutput(int, QProcess::ExitStatus)));
connect(gitLSIgnoredProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(lsIgnoredOutput(int, QProcess::ExitStatus)));
Expand All @@ -18,6 +19,7 @@ GitCommand::~GitCommand()
delete defaultArgs;
delete gitStatusProcess;
delete gitLSIgnoredProcess;
delete gitAddProcess;
}
void GitCommand::status()
{
Expand Down Expand Up @@ -53,6 +55,17 @@ void GitCommand::lsIgnoredOutput(int exitCode, QProcess::ExitStatus exitStatus)
QStringList fileList = resultString.split('\n',QString::SkipEmptyParts);
emit lsIgnored(fileList);
}
void GitCommand::add(QString filename)
{
QSettings settings;
QString proc = settings.value("gitPath").toString();
QStringList args = *defaultArgs;
args << "add" << filename;
gitAddProcess->start(proc, args);
gitAddProcess->waitForFinished(5000);

}

void GitCommand::setRepo(QString repo)
{
*defaultArgs = QStringList() << "--git-dir" << repo + "/.git" << "--work-tree" << repo;
Expand Down
2 changes: 2 additions & 0 deletions gitcommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ class GitCommand : public QObject
~GitCommand();
void status();
void lsIgnored();
void add(QString filename);

private:
QStringList* defaultArgs;
QString repo;
QProcess* gitStatusProcess;
QProcess* gitLSIgnoredProcess;
QProcess* gitAddProcess;

signals:
void status(QStringList files);
Expand Down
18 changes: 13 additions & 5 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,18 @@ void MainWindow::updateIgnoredModel(QStringList files)

void MainWindow::on_gitAddButton_clicked()
{
//ui->git
//QModelIndexList *indexList = ui->changedFileslistView->selectedIndexes();
/* (int i=0; i < indexList->count(); ++i)
QItemSelectionModel* selectionModel = ui->changedFileslistView->selectionModel();
QItemSelection itemSelection = selectionModel->selection();
QModelIndexList indexList = itemSelection.indexes();
for(int i=0; i < indexList.count(); ++i)
{
indexList->at(i);
} */
QString filename = QString(indexList.at(i).data().toString());
gitCommand->add( filename );
ui->statusBar->showMessage(filename,5000);
}
reload();
}
void MainWindow::reload()
{
gitCommand->status();
}
1 change: 1 addition & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private slots:
void activateExistingProjectWizard();
void activateShareProjectWizard();
void updateIgnoredModel(QStringList);
void reload();
};

#endif // MAINWINDOW_H
15 changes: 1 addition & 14 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,6 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
<widget class="QPushButton" name="gitIgnoreButton">
<property name="geometry">
<rect>
<x>150</x>
<y>90</y>
<width>93</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>-----&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>170</x>
Expand All @@ -206,7 +193,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="topArrow">
<widget class="QPushButton" name="gitAddButton">
<property name="geometry">
<rect>
<x>170</x>
Expand Down
Loading

0 comments on commit 6196cc1

Please sign in to comment.