Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
soramimi committed Jan 20, 2024
1 parent 5ba9490 commit eb55c4a
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 126 deletions.
4 changes: 2 additions & 2 deletions src/BasicRepositoryDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class MainWindow;

class BasicRepositoryDialog : public QDialog {
public:
explicit BasicRepositoryDialog(MainWindow *mainwindow, GitPtr g);
~BasicRepositoryDialog() override;
explicit BasicRepositoryDialog(MainWindow *mainwindow, GitPtr g);
~BasicRepositoryDialog() override;
private:
struct Private;
Private *m;
Expand Down
4 changes: 2 additions & 2 deletions src/BlameWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ QList<BlameItem> BlameWindow::parseBlame(char const *begin, char const *end)
} else {
char const *p = line.c_str();
char const *q = strchr(p, ' ');
if (q) {
QString label = QString::fromLatin1(p, int(q - p));
if (q) {
QString label = QString::fromLatin1(p, int(q - p));
if (item.commit_id.isEmpty()) {
item.commit_id = label;
int a, b, c;
Expand Down
2 changes: 1 addition & 1 deletion src/ColorButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ColorButton::setColor(QColor const &color)
*/
void ColorButton::paintEvent(QPaintEvent *event)
{
(void)event;
(void)event;
QPainter pr(this);
QStyleOptionToolButton o;
QStyleOptionButton o2;
Expand Down
6 changes: 3 additions & 3 deletions src/CommitDetailGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void CommitDetailGetter::start(GitPtr git)
git_ = git;
threads_.clear();
threads_.resize(4);
for (int i = 0; i < threads_.size(); i++) {
for (size_t i = 0; i < threads_.size(); i++) {
std::thread th([&](){
while (1) {
Request item;
Expand Down Expand Up @@ -90,7 +90,7 @@ void CommitDetailGetter::stop()
requests_.clear();
cache_.clear();
}
for (int i = 0; i < threads_.size(); i++) {
for (size_t i = 0; i < threads_.size(); i++) {
if (threads_[i].joinable()) {
threads_[i].join();
}
Expand Down Expand Up @@ -139,7 +139,7 @@ CommitDetailGetter::Data CommitDetailGetter::query(Git::CommitID const &id, bool
item.id = id;
requests_.push_back(item);

const int MAX = std::min(1000, global->appsettings.maximum_number_of_commit_item_acquisitions);
const size_t MAX = std::min(1000, global->appsettings.maximum_number_of_commit_item_acquisitions);

size_t n = requests_.size();
if (n > MAX) {
Expand Down
1 change: 1 addition & 0 deletions src/ConfigUserDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ void ConfigUserDialog::on_lineEdit_local_email_textEdited(const QString &text)

void ConfigUserDialog::on_checkBox_unset_local_stateChanged(int arg1)
{
(void)arg1;
bool f = ui->checkBox_unset_local->isChecked();
ui->lineEdit_local_name->setEnabled(!f);
ui->lineEdit_local_email->setEnabled(!f);
Expand Down
4 changes: 4 additions & 0 deletions src/EditProfilesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ void EditProfilesDialog::on_pushButton_down_clicked()

void EditProfilesDialog::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
{
(void)current;
(void)previous;

updateUI();

int row = ui->tableWidget->currentRow();
Expand Down Expand Up @@ -350,6 +353,7 @@ void EditProfilesDialog::on_pushButton_get_icon_from_network_clicked()

void EditProfilesDialog::on_tableWidget_itemDoubleClicked(QTableWidgetItem *item)
{
(void)item;
if (enable_double_click_) {
done(QDialog::Accepted);
}
Expand Down
2 changes: 1 addition & 1 deletion src/FileDiffSliderWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ QPixmap FileDiffSliderWidget::makeDiffPixmap(int width, int height, TextDiffLine
QPixmap pixmap = QPixmap(w, h * scale);
pixmap.fill(theme->diff_slider_normal_bg);
QPainter pr(&pixmap);
auto Loop = [&](std::function<QColor(TextDiffLine::Type)> const &getcolor){
auto Loop = [&](std::function<QColor(TextDiffLine::Type)> const &getcolor){
int i = 0;
while (i < lines.size()) {
auto type = (TextDiffLine::Type)lines[i].type;
Expand Down
10 changes: 5 additions & 5 deletions src/FileDiffWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void FileDiffWidget::makeSideBySideDiffData(Git::Diff const &diff, std::vector<s
auto ParseNumber = [&](){
size_t v = 0;
while (isdigit(*p & 0xff)) {
v = v * 10 + size_t(*p - '0');
v = v * 10 + size_t(*p - '0');
p++;
}
return v;
Expand Down Expand Up @@ -230,8 +230,8 @@ void FileDiffWidget::makeSideBySideDiffData(Git::Diff const &diff, std::vector<s
});
size_t h = hunks.size();
while (linenum > 0 || h > 0) {
while (h > 0) {
int hunk_number = int(h - 1);
while (h > 0) {
int hunk_number = int(h - 1);
HunkItem const &hi = hunks[hunk_number];
if (hi.pos + hi.len < linenum) {
break;
Expand Down Expand Up @@ -451,8 +451,8 @@ void FileDiffWidget::setSingleFile(QByteArray const &ba, QString const &id, QStr

void FileDiffWidget::setOriginalLines_(QByteArray const &ba, Git::SubmoduleItem const *submodule, Git::CommitItem const *submodule_commit)
{
(void)submodule;
(void)submodule_commit;
(void)submodule;
(void)submodule_commit;

m->original_lines.clear();

Expand Down
6 changes: 3 additions & 3 deletions src/Git.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1526,8 +1526,8 @@ bool Git::reflog(ReflogItemList *out, int maxcount)
c = *ptr;
}
if (c == '\r' || c == '\n' || c == 0) {
int d = 0;
QString line = QString::fromUtf8(left, int(ptr - left));
int d = 0;
QString line = QString::fromUtf8(left, int(ptr - left));
if (left < ptr) {
d = *left & 0xff;
}
Expand Down Expand Up @@ -1614,7 +1614,7 @@ QString Git::trimPath(QString const &s)
}
return QString::fromUtf8(ba);
}
if (left == begin && right == end) return s;
if (left == begin && right == end) return s;
return QString::fromUtf16((char16_t const *)left, int(right - left));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Git.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ struct NamedCommitItem {
Tag,
};
Type type = Type::None;
QString remote;
QString remote;
QString name;
Git::CommitID id;
};
Expand Down
4 changes: 2 additions & 2 deletions src/GitObjectManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ Git::CommitID GitObjectCache::getCommitIdFromTag(QString const &tag)
if (!obj.content.isEmpty()) {
misc::splitLines(obj.content, [&](char const *ptr, size_t len){
if (!commit_id.isValid()) {
if (len >= 7 + GIT_ID_LENGTH && strncmp(ptr, "object ", 7) == 0) {
Git::CommitID id2(QString::fromUtf8(ptr + 7, int(len - 7)).trimmed());
if (len >= 7 + GIT_ID_LENGTH && strncmp(ptr, "object ", 7) == 0) {
Git::CommitID id2(QString::fromUtf8(ptr + 7, int(len - 7)).trimmed());
if (Git::isValidID(id2)) {
commit_id = id2;
}
Expand Down
4 changes: 2 additions & 2 deletions src/GitPack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ void GitPack::decodeTree(QByteArray *out)
for (int i = 0; i < 20; i++) {
sprintf(p, "%02x", ptr[i]);
p += 2;
}
ba.append(tmp, int(p - tmp));
}
ba.append(tmp, int(p - tmp));
ba.append('\t');
ba.append(name.c_str(), name.size());
ba.append('\n');
Expand Down
26 changes: 13 additions & 13 deletions src/LogTableWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,19 @@ void drawBranch(QPainterPath *path, double x0, double y0, double x1, double y1,
{
if (x0 == x1) {
path->moveTo(x0, y0);
path->lineTo(x1, y1);
} else {
double ym = bend_early ? (y0 + r) : (y1 - r);
if (bend_early) {
path->moveTo(x0, y0);
path->cubicTo(x0, ym, x1, ym, x1, ym + ym - y0);
path->lineTo(x1, y1);
} else {
path->moveTo(x0, y0);
path->lineTo(x0, ym + ym - y1);
path->cubicTo(x0, ym, x1, ym, x1, y1);
}
}
path->lineTo(x1, y1);
} else {
double ym = bend_early ? (y0 + r) : (y1 - r);
if (bend_early) {
path->moveTo(x0, y0);
path->cubicTo(x0, ym, x1, ym, x1, ym + ym - y0);
path->lineTo(x1, y1);
} else {
path->moveTo(x0, y0);
path->lineTo(x0, ym + ym - y1);
path->cubicTo(x0, ym, x1, ym, x1, y1);
}
}
}

void LogTableWidget::paintEvent(QPaintEvent *e)
Expand Down
12 changes: 0 additions & 12 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,18 +619,6 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event)
}
}
} else if (et == QEvent::FocusIn) {
auto SelectItem = [](QListWidget *w){
int row = w->currentRow();
if (row < 0) {
row = 0;
w->setCurrentRow(row);
}
auto *item = w->item(row);
if (item) {
item->setSelected(true);
w->viewport()->update();
}
};
// ファイルリストがフォーカスを得たとき、diffビューを更新する。(コンテキストメニュー対応)
if (watched == frame()->unstagedFileslistwidget()) {
m->last_focused_file_list = watched;
Expand Down
54 changes: 27 additions & 27 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ struct GitHubRepositoryInfo {

class AsyncExecGitThread_ : public QThread {
private:
GitPtr g;
std::function<void(GitPtr g)> callback;
GitPtr g;
std::function<void(GitPtr g)> callback;
public:
AsyncExecGitThread_(GitPtr g, std::function<void(GitPtr g)> const &callback)
: g(g)
, callback(callback)
{
}
virtual ~AsyncExecGitThread_() override
{
}
AsyncExecGitThread_(GitPtr g, std::function<void(GitPtr g)> const &callback)
: g(g)
, callback(callback)
{
}
virtual ~AsyncExecGitThread_() override
{
}
protected:
void run() override
{
callback(g);
}
void run() override
{
callback(g);
}
};

class HunkItem {
Expand Down Expand Up @@ -134,7 +134,7 @@ class MainWindow : public QMainWindow {
int idiff;
};

Ui::MainWindow *ui;
Ui::MainWindow *ui;

struct Private;
Private *m;
Expand Down Expand Up @@ -197,7 +197,7 @@ class MainWindow : public QMainWindow {
void rebaseBranch(Git::CommitItem const *commit);
void cherrypick(Git::CommitItem const *commit);
void merge(RepositoryWrapperFrame *frame, const Git::CommitItem *commit = nullptr);
void detectGitServerType(GitPtr g);
void detectGitServerType(GitPtr g);
void setRemoteOnline(bool f, bool save);
void startTimers();
void onCloneCompleted(bool success, const QVariant &userdata);
Expand Down Expand Up @@ -245,16 +245,16 @@ class MainWindow : public QMainWindow {
void checkUser();
void openRepository(bool validate, bool waitcursor = true, bool keep_selection = false);
void updateRepository();
void reopenRepository(bool log, const std::function<void (GitPtr )> &callback);
void reopenRepository(bool log, const std::function<void (GitPtr )> &callback);
void setCurrentRepository(const RepositoryData &repo, bool clear_authentication);
void openSelectedRepository();
QList<Git::Diff> makeDiffs(RepositoryWrapperFrame *frame, QString id, bool *ok);
void queryBranches(RepositoryWrapperFrame *frame, GitPtr g);
void queryBranches(RepositoryWrapperFrame *frame, GitPtr g);
void updateRemoteInfo();
void queryRemotes(GitPtr g);
void queryRemotes(GitPtr g);
void clone(QString url = {}, QString dir = {});
void submodule_add(QString url = {}, const QString &local_dir = {});
const Git::CommitItem *selectedCommitItem(RepositoryWrapperFrame *frame) const;
void submodule_add(QString url = {}, const QString &local_dir = {});
const Git::CommitItem *selectedCommitItem(RepositoryWrapperFrame *frame) const;
void commit(RepositoryWrapperFrame *frame, bool amend = false);
void commitAmend(RepositoryWrapperFrame *frame);
void pushSetUpstream(bool set_upstream, const QString &remote, const QString &branch, bool force);
Expand Down Expand Up @@ -285,9 +285,9 @@ class MainWindow : public QMainWindow {
Git::Object internalCatFile(RepositoryWrapperFrame *frame, GitPtr g, const QString &id);
bool isThereUncommitedChanges() const;
static void addDiffItems(const QList<Git::Diff> *diff_list, const std::function<void (const ObjectData &)> &add_item);
Git::CommitItemList retrieveCommitLog(GitPtr g);
Git::CommitItemList retrieveCommitLog(GitPtr g);
std::map<Git::CommitID, QList<Git::Branch> > &commitToBranchMapRef(RepositoryWrapperFrame *frame);
void updateWindowTitle(GitPtr g);
void updateWindowTitle(GitPtr g);
QString makeCommitInfoText(RepositoryWrapperFrame *frame, int row, QList<BranchLabel> *label_list);
void removeRepositoryFromBookmark(int index, bool ask);
void openTerminal(const RepositoryData *repo);
Expand Down Expand Up @@ -346,13 +346,13 @@ class MainWindow : public QMainWindow {
PtyCondition getPtyCondition();
void setPtyUserData(const QVariant &userdata);
void setPtyProcessOk(bool pty_process_ok);
bool fetch(GitPtr g, bool prune);
bool fetch_tags_f(GitPtr g);
bool fetch(GitPtr g, bool prune);
bool fetch_tags_f(GitPtr g);
void setPtyCondition(const PtyCondition &ptyCondition);
const QList<RepositoryData> &cRepositories() const;
QList<RepositoryData> *pRepositories();
void setRepos(QList<RepositoryData> const &list);
bool interactionCanceled() const;
bool interactionCanceled() const;
void setInteractionCanceled(bool canceled);
InteractionMode interactionMode() const;
void setInteractionMode(const InteractionMode &im);
Expand Down Expand Up @@ -465,7 +465,7 @@ class MainWindow : public QMainWindow {
QString determinFileType(QByteArray in);
QList<Git::Tag> queryTagList(RepositoryWrapperFrame *frame);
TextEditorThemePtr themeForTextEditor();
bool isValidWorkingCopy(GitPtr g) const;
bool isValidWorkingCopy(GitPtr g) const;
void emitWriteLog(const QByteArray &ba, bool receive);
QString findFileID(RepositoryWrapperFrame *frame, const QString &commit_id, const QString &file);
const Git::CommitItem *commitItem(const RepositoryWrapperFrame *frame, int row) const;
Expand Down
10 changes: 5 additions & 5 deletions src/RepositoryPropertyDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ RepositoryPropertyDialog::RepositoryPropertyDialog(MainWindow *parent, Git::Cont

ui->groupBox_remote->setVisible(open_repository_menu);

ui->label_editable_name->setText(repository.name);
ui->label_editable_name->setVisible(true);
ui->lineEdit_name->setText(repository.name);
ui->lineEdit_name->setVisible(false);
ui->lineEdit_local_dir->setText(misc::normalizePathSeparator(repository.local_dir));
ui->label_editable_name->setText(repository.name);
ui->label_editable_name->setVisible(true);
ui->lineEdit_name->setText(repository.name);
ui->lineEdit_name->setVisible(false);
ui->lineEdit_local_dir->setText(misc::normalizePathSeparator(repository.local_dir));

ui->pushButton_close->setFocus();

Expand Down
6 changes: 3 additions & 3 deletions src/RepositoryPropertyDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RepositoryPropertyDialog : public BasicRepositoryDialog {
Ui::RepositoryPropertyDialog *ui;
RepositoryData repository;
bool remote_changed = false;
bool name_changed = false;
bool name_changed = false;
Git::Context const *gcx;
void updateRemotesTable();
bool execEditRemoteDialog(Git::Remote *remote, EditRemoteDialog::Operation op);
Expand All @@ -32,14 +32,14 @@ class RepositoryPropertyDialog : public BasicRepositoryDialog {
~RepositoryPropertyDialog() override;

bool isRemoteChanged() const;
bool isNameChanged() const;
bool isNameChanged() const;
QString getName();
private slots:
void on_pushButton_remote_add_clicked();
void on_pushButton_remote_edit_clicked();
void on_pushButton_remote_remove_clicked();
void on_pushButton_remote_menu_clicked();
void on_pushButton_edit_name_clicked();
void on_pushButton_edit_name_clicked();

// QDialog interface
public slots:
Expand Down
2 changes: 2 additions & 0 deletions src/SimpleImageWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void SimpleImageWidget::setImage(const QImage &image)
*/
void SimpleImageWidget::paintEvent(QPaintEvent *event)
{
(void)event;

// ウィンドウに内接するように画像を描画

int dw = width();
Expand Down
Loading

0 comments on commit eb55c4a

Please sign in to comment.