-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UI and logic for collectively adding repositories
- Loading branch information
Showing
5 changed files
with
185 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "AddRepositoriesCollectivelyDialog.h" | ||
#include "ui_AddRepositoriesCollectivelyDialog.h" | ||
|
||
AddRepositoriesCollectivelyDialog::AddRepositoriesCollectivelyDialog(QWidget *parent, QStringList const &dirs) | ||
: QDialog(parent) | ||
, ui(new Ui::AddRepositoriesCollectivelyDialog) | ||
{ | ||
ui->setupUi(this); | ||
|
||
QStringList list = dirs; | ||
std::sort(list.begin(), list.end()); | ||
|
||
for (QString const &dir : list) { | ||
QListWidgetItem *item = new QListWidgetItem(dir); | ||
item->setCheckState(Qt::Checked); | ||
ui->listWidget->addItem(item); | ||
} | ||
} | ||
|
||
AddRepositoriesCollectivelyDialog::~AddRepositoriesCollectivelyDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
QStringList AddRepositoriesCollectivelyDialog::selectedDirs() const | ||
{ | ||
QStringList dirs; | ||
for (int i = 0; i < ui->listWidget->count(); i++) { | ||
QListWidgetItem *item = ui->listWidget->item(i); | ||
if (item->checkState() == Qt::Checked) { | ||
dirs.append(item->text()); | ||
} | ||
} | ||
return dirs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef ADDREPOSITORIESCOLLECTIVELYDIALOG_H | ||
#define ADDREPOSITORIESCOLLECTIVELYDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class AddRepositoriesCollectivelyDialog; | ||
} | ||
|
||
class AddRepositoriesCollectivelyDialog : public QDialog { | ||
Q_OBJECT | ||
private: | ||
Ui::AddRepositoriesCollectivelyDialog *ui; | ||
|
||
public: | ||
explicit AddRepositoriesCollectivelyDialog(QWidget *parent, const QStringList &dirs); | ||
~AddRepositoriesCollectivelyDialog(); | ||
|
||
QStringList selectedDirs() const; | ||
}; | ||
|
||
#endif // ADDREPOSITORIESCOLLECTIVELYDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>AddRepositoriesCollectivelyDialog</class> | ||
<widget class="QDialog" name="AddRepositoriesCollectivelyDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Add Repositories</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QListWidget" name="listWidget"/> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<spacer name="horizontalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="pushButton"> | ||
<property name="text"> | ||
<string>&OK</string> | ||
</property> | ||
<property name="default"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="pushButton_2"> | ||
<property name="text"> | ||
<string>&Cancel</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>pushButton</sender> | ||
<signal>clicked()</signal> | ||
<receiver>AddRepositoriesCollectivelyDialog</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>233</x> | ||
<y>279</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>213</x> | ||
<y>279</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>pushButton_2</sender> | ||
<signal>clicked()</signal> | ||
<receiver>AddRepositoriesCollectivelyDialog</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>326</x> | ||
<y>289</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>308</x> | ||
<y>295</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters