[repo.or.cz] nomnom.git branch next updated: v0.3.0-2-ga831f1c
Brought to you by:
legatvs
|
From: <nom...@li...> - 2011-10-31 16:10:09
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project nomnom.git.
The branch, next has been updated
via a831f1cd8c389e271b40706c6f35342550f1f823 (commit)
via 11e64fdb36bfeab183fafc081d36378a4cac15c7 (commit)
from 4b171a767f322cfeb087e3b5c97b77f40bd1f873 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/nomnom.git/commit/a831f1cd8c389e271b40706c6f35342550f1f823
commit a831f1cd8c389e271b40706c6f35342550f1f823
Author: Toni Gundogdu <le...@gm...>
Date: Mon Oct 31 18:03:53 2011 +0200
Add "copy to clipboard" to NLogDialog
diff --git a/src/log/nlogdialog.cpp b/src/log/nlogdialog.cpp
index 3a4016d..bc30aa6 100644
--- a/src/log/nlogdialog.cpp
+++ b/src/log/nlogdialog.cpp
@@ -51,8 +51,14 @@ NLogDialog::NLogDialog(QWidget *parent/*=NULL*/)
| QDialogButtonBox::Cancel
| QDialogButtonBox::Reset);
+ QPushButton *b = new QPushButton(tr("Co&py"));
+ b->setToolTip(tr("Copy to clipboard"));
+
+ bb->addButton(b, QDialogButtonBox::ActionRole);
+
connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(b, SIGNAL(clicked()), this, SLOT(copy()));
connect(bb->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
this, SLOT(reset()));
@@ -114,6 +120,12 @@ void NLogDialog::reset()
l->reset();
}
+void NLogDialog::copy()
+{
+ NLogWidget *l = dynamic_cast<NLogWidget*>(_toolbox->currentWidget());
+ l->copy();
+}
+
// NLogWidget
NLogWidget::NLogWidget(QWidget *parent/*=NULL*/)
diff --git a/src/log/nlogdialog.h b/src/log/nlogdialog.h
index 42614c6..a22b1cf 100644
--- a/src/log/nlogdialog.h
+++ b/src/log/nlogdialog.h
@@ -40,6 +40,7 @@ private:
private slots:
void selected(QString);
void reset();
+ void copy();
private:
QToolBox *_toolbox;
QString _selected;
@@ -53,6 +54,7 @@ public:
protected:
virtual void reset() = 0;
virtual void init() = 0;
+ virtual void copy() = 0;
// Friends
friend class NLogDialog;
};
@@ -69,6 +71,7 @@ private slots:
protected:
virtual void reset();
virtual void init();
+ virtual void copy();
private:
QTreeWidget *_treew;
};
diff --git a/src/log/nlogdialog_recent.cpp b/src/log/nlogdialog_recent.cpp
index d884cf0..b97f291 100644
--- a/src/log/nlogdialog_recent.cpp
+++ b/src/log/nlogdialog_recent.cpp
@@ -17,12 +17,13 @@
#include "config.h"
-#include <QCoreApplication>
#include <QDialogButtonBox>
+#include <QApplication>
#include <QVBoxLayout>
#include <QTextStream>
#include <QTreeWidget>
#include <QMessageBox>
+#include <QClipboard>
#include <NRecentMutator>
#include <NRecentEntry>
@@ -71,7 +72,7 @@ void NLogRecent::init()
void NLogRecent::selected()
{
- QTreeWidgetItem *i = _treew->selectedItems().first();
+ QTreeWidgetItem *i = _treew->currentItem();
i = (i->childCount() > 0) ? i->child(0) : i;
if (i)
emit selected(i->text(0));
@@ -92,6 +93,23 @@ void NLogRecent::reset()
recent.clear();
}
+void NLogRecent::copy()
+{
+ QTreeWidgetItem *i = _treew->currentItem();
+ if (!i)
+ {
+ info(this, tr("Please select an item from the list"));
+ return;
+ }
+
+ i = (i->childCount() > 0) ? i : i->parent();
+
+ QApplication::clipboard()->setText(QString("%1n %2n %3n")
+ .arg(i->text(0))
+ .arg(i->text(1))
+ .arg((i->child(0)->text(0))));
+}
+
} // namespace nn
/* vim: set ts=2 sw=2 tw=72 expandtab: */
http://repo.or.cz/w/nomnom.git/commit/11e64fdb36bfeab183fafc081d36378a4cac15c7
commit 11e64fdb36bfeab183fafc081d36378a4cac15c7
Author: Toni Gundogdu <le...@gm...>
Date: Mon Oct 31 17:16:44 2011 +0200
NLogRecent: Move Reset button to NLogDialog button box
diff --git a/src/log/nlogdialog.cpp b/src/log/nlogdialog.cpp
index 5e9b8ee..3a4016d 100644
--- a/src/log/nlogdialog.cpp
+++ b/src/log/nlogdialog.cpp
@@ -19,6 +19,7 @@
#include <QCoreApplication>
#include <QDialogButtonBox>
+#include <QPushButton>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QToolBox>
@@ -45,12 +46,17 @@ NLogDialog::NLogDialog(QWidget *parent/*=NULL*/)
// Button box
- QDialogButtonBox *bb = new QDialogButtonBox(
- QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QDialogButtonBox *bb =
+ new QDialogButtonBox(QDialogButtonBox::Ok
+ | QDialogButtonBox::Cancel
+ | QDialogButtonBox::Reset);
connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(bb->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
+ this, SLOT(reset()));
+
// Layout
QVBoxLayout *box = new QVBoxLayout;
@@ -73,9 +79,6 @@ void NLogDialog::foreachWidget()
for (int i=0; i<c; ++i)
{
NLogWidget *l = dynamic_cast<NLogWidget*>(_toolbox->widget(i));
-#ifdef _1
- l->read();
-#endif
l->init();
}
}
@@ -105,6 +108,12 @@ QString NLogDialog::selected() const
return _selected;
}
+void NLogDialog::reset()
+{
+ NLogWidget *l = dynamic_cast<NLogWidget*>(_toolbox->currentWidget());
+ l->reset();
+}
+
// NLogWidget
NLogWidget::NLogWidget(QWidget *parent/*=NULL*/)
diff --git a/src/log/nlogdialog.h b/src/log/nlogdialog.h
index 33313c7..42614c6 100644
--- a/src/log/nlogdialog.h
+++ b/src/log/nlogdialog.h
@@ -39,6 +39,7 @@ private:
void foreachWidget();
private slots:
void selected(QString);
+ void reset();
private:
QToolBox *_toolbox;
QString _selected;
@@ -50,10 +51,8 @@ class NLogWidget : public QWidget
public:
NLogWidget(QWidget *parent);
protected:
+ virtual void reset() = 0;
virtual void init() = 0;
-#ifdef _1
- virtual void read() = 0;
-#endif
// Friends
friend class NLogDialog;
};
@@ -67,12 +66,9 @@ signals:
void selected(QString);
private slots:
void selected();
- void reset();
protected:
+ virtual void reset();
virtual void init();
-#ifdef _1
- virtual void read();
-#endif
private:
QTreeWidget *_treew;
};
diff --git a/src/log/nlogdialog_recent.cpp b/src/log/nlogdialog_recent.cpp
index 6d9cea6..d884cf0 100644
--- a/src/log/nlogdialog_recent.cpp
+++ b/src/log/nlogdialog_recent.cpp
@@ -19,7 +19,6 @@
#include <QCoreApplication>
#include <QDialogButtonBox>
-#include <QPushButton>
#include <QVBoxLayout>
#include <QTextStream>
#include <QTreeWidget>
@@ -48,16 +47,10 @@ NLogRecent::NLogRecent(QWidget *parent/*=NULL*/)
connect(_treew, SIGNAL(itemSelectionChanged()), this, SLOT(selected()));
- QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Reset);
-
- connect(bb->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
- this, SLOT(reset()));
-
// Layout
QVBoxLayout *box = new QVBoxLayout;
box->addWidget(_treew);
- box->addWidget(bb);
setLayout(box);
}
-----------------------------------------------------------------------
Summary of changes:
src/log/nlogdialog.cpp | 31 ++++++++++++++++++++++++++-----
src/log/nlogdialog.h | 13 ++++++-------
src/log/nlogdialog_recent.cpp | 29 ++++++++++++++++++++---------
3 files changed, 52 insertions(+), 21 deletions(-)
repo.or.cz automatic notification. Contact project admin le...@gm...
if you want to unsubscribe, or site admin ad...@re... if you receive
no reply.
--
nomnom.git ("The graphical media download tool")
|