repo_name
stringlengths 5
122
| path
stringlengths 3
232
| text
stringlengths 6
1.05M
|
---|---|---|
dimarusyy/roster-display | src/rosterlistmodel.h | #pragma once
#include <QAbstractListModel>
#include <QStandardItemModel>
#include <QJsonDocument>
#include <QNetworkAccessManager>
#include <3rdparty/nlohmann/json.hpp>
#include "fetchjson.h"
class RosterListModel : public QAbstractListModel
{
Q_OBJECT
public:
enum RosterRoles
{
AvatarColor = Qt::UserRole + 1,
FirstName,
LastName,
UserName,
Sex,
Country,
Birthday,
Language,
Group,
GroupOrder
};
Q_ENUM(RosterRoles)
RosterListModel(QObject* parent = nullptr);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
signals:
void itemsPopulated(int);
void loading();
void loaded();
public slots:
void loadFromUrl(const QUrl&);
protected:
bool canFetchMore(const QModelIndex &parent) const override;
void fetchMore(const QModelIndex &parent) override;
private:
FetchJson _fetchJson;
std::shared_ptr<nlohmann::json> _json{};
int _fetched{ 0 };
};
|
dimarusyy/roster-display | src/config.h | <filename>src/config.h
#pragma once
#include <QUrl>
#include <QFileInfo>
struct config
{
static const QUrl defaultFetchUrl();
static const QFileInfo defaultCacheFile();
static quint64 defaultCacheValidityTimeout_ms();
};
|
dimarusyy/roster-display | src/filteredrostermodel.h | #pragma once
#include "rosterlistmodel.h"
#include <QSortFilterProxyModel>
class FilteredRosterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
FilteredRosterModel(QObject* parent = nullptr);
Q_INVOKABLE void setFilter(const QString&);
Q_INVOKABLE void setSortingColumn(int role);
signals:
void loading();
void loaded();
private:
RosterListModel _rosterListModel;
};
|
msantos/perc | c_src/perc.c | /*
* Copyright (c) 2012-2021 <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <errno.h>
#include <grp.h>
#include <signal.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/resource.h>
#include <sys/time.h>
#ifdef HAVE_SIGNALFD
#pragma message "Enabling support for signalfd(2)"
#include <sys/signalfd.h>
#endif
#ifdef HAVE_PRCTL
#include <sys/prctl.h>
#pragma message "Enabling support for prctl(2)"
#endif
#ifdef HAVE_PRLIMIT
#pragma message "Enabling support for prlimit(2)"
#endif
#include "erl_nif.h"
#include "erl_driver.h"
typedef struct {
ErlNifMutex *lock;
} PERC_PRIV;
static ERL_NIF_TERM atom_ok;
static ERL_NIF_TERM atom_error;
static ERL_NIF_TERM atom_unsupported;
static int load(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info) {
PERC_PRIV *priv = NULL;
atom_ok = enif_make_atom(env, "ok");
atom_error = enif_make_atom(env, "error");
atom_unsupported = enif_make_atom(env, "unsupported");
priv = enif_alloc(sizeof(PERC_PRIV));
if (priv == NULL)
return -1;
(void)memset(priv, 0, sizeof(PERC_PRIV));
priv->lock = enif_mutex_create("perc_lock");
if (priv->lock == NULL) {
enif_free(priv);
return -1;
}
*priv_data = priv;
return 0;
}
static int reload(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info) {
return 0;
}
static int upgrade(ErlNifEnv *env, void **priv_data, void **old_priv_data,
ERL_NIF_TERM load_info) {
return 0;
}
static ERL_NIF_TERM nif_kill(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
pid_t pid = 0;
int signal = 0;
if (!enif_get_int(env, argv[0], &pid))
return enif_make_badarg(env);
if (!enif_get_int(env, argv[1], &signal))
return enif_make_badarg(env);
if (kill(pid, signal) != 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return atom_ok;
}
static ERL_NIF_TERM nif_getpriority(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
int which = 0;
unsigned int who = 0;
int prio = 0;
if (!enif_get_int(env, argv[0], &which))
return enif_make_badarg(env);
if (!enif_get_uint(env, argv[1], &who))
return enif_make_badarg(env);
errno = 0;
if (((prio = getpriority(which, who)) == -1) && (errno != 0))
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return enif_make_tuple2(env, atom_ok, enif_make_int(env, prio));
}
static ERL_NIF_TERM nif_setpriority(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
int which = 0;
unsigned int who = 0;
int prio = 0;
if (!enif_get_int(env, argv[0], &which))
return enif_make_badarg(env);
if (!enif_get_uint(env, argv[1], &who))
return enif_make_badarg(env);
if (!enif_get_int(env, argv[2], &prio))
return enif_make_badarg(env);
if (setpriority(which, who, prio) == -1)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return atom_ok;
}
static ERL_NIF_TERM nif_signalfd(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
#ifdef HAVE_SIGNALFD
int fd = 0;
ErlNifBinary mask = {0};
int rv = 0;
if (!enif_get_int(env, argv[0], &fd))
return enif_make_badarg(env);
if (!enif_inspect_binary(env, argv[1], &mask) ||
mask.size != sizeof(sigset_t))
return enif_make_badarg(env);
/* According to sigprocmask(2):
*
* "The use of sigprocmask() is unspecified in a multithreaded
* process; see pthread_sigmask(3)."
*
* And pthread_sigmask(3):
*
* "The pthread_sigmask() function is just like sigprocmask(2),
* with the difference that its use in multithreaded programs is
* explicitly specified by POSIX.1-2001."
*
*/
if (pthread_sigmask(SIG_BLOCK, (sigset_t *)mask.data, NULL) < 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
if ((rv = signalfd(fd, (sigset_t *)mask.data, SFD_NONBLOCK | SFD_CLOEXEC)) <
0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return enif_make_tuple2(env, atom_ok, enif_make_int(env, rv));
#else
return enif_make_tuple2(env, atom_error, atom_unsupported);
#endif
}
static ERL_NIF_TERM nif_sigaddset(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
#ifdef HAVE_SIGNALFD
sigset_t mask = {{0}};
ERL_NIF_TERM head = {0};
ERL_NIF_TERM tail = {0};
ErlNifBinary bin = {0};
if (!enif_is_list(env, argv[0]))
return enif_make_badarg(env);
sigemptyset(&mask);
tail = argv[0];
while (enif_get_list_cell(env, tail, &head, &tail)) {
int sig = 0;
if (!enif_get_int(env, head, &sig))
return enif_make_badarg(env);
sigaddset(&mask, sig);
}
if (!enif_alloc_binary(sizeof(mask), &bin))
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(ENOMEM)));
(void)memcpy(bin.data, &mask, sizeof(mask));
return enif_make_tuple2(env, atom_ok, enif_make_binary(env, &bin));
#else
return enif_make_tuple2(env, atom_error, atom_unsupported);
#endif
}
static ERL_NIF_TERM nif_close(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
#ifdef HAVE_SIGNALFD
int fd;
if (!enif_get_int(env, argv[0], &fd))
return enif_make_badarg(env);
if (close(fd) < 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return atom_ok;
#else
return enif_make_tuple2(env, atom_error, atom_unsupported);
#endif
}
static ERL_NIF_TERM nif_prctl(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
#ifdef HAVE_PRCTL
int option = 0;
unsigned long arg2 = 0;
ErlNifBinary arg3 = {0};
if (!enif_get_int(env, argv[0], &option))
return enif_make_badarg(env);
if (!enif_get_ulong(env, argv[1], &arg2))
return enif_make_badarg(env);
if (!enif_inspect_binary(env, argv[2], &arg3))
return enif_make_badarg(env);
if (prctl(option, arg2, arg3.data) < 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return atom_ok;
#else
return enif_make_tuple2(env, atom_error, atom_unsupported);
#endif
}
static ERL_NIF_TERM nif_prlimit(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
#ifdef HAVE_PRLIMIT
pid_t pid = 0;
int resource = 0;
ErlNifBinary new_limit = {0};
ErlNifBinary old_limit = {0};
if (!enif_get_int(env, argv[0], &pid))
return enif_make_badarg(env);
if (!enif_get_int(env, argv[1], &resource))
return enif_make_badarg(env);
if (!enif_inspect_binary(env, argv[2], &new_limit))
return enif_make_badarg(env);
if (!enif_inspect_binary(env, argv[3], &old_limit))
return enif_make_badarg(env);
if (!(new_limit.size == 0 || new_limit.size == sizeof(struct rlimit)) ||
!(old_limit.size == 0 || old_limit.size == sizeof(struct rlimit)))
return enif_make_badarg(env);
if (prlimit(pid, resource,
(new_limit.size == 0 ? NULL : (struct rlimit *)new_limit.data),
(old_limit.size == 0 ? NULL : (struct rlimit *)old_limit.data)) !=
0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return enif_make_tuple3(env, atom_ok, enif_make_binary(env, &new_limit),
enif_make_binary(env, &old_limit));
#else
return enif_make_tuple2(env, atom_error, atom_unsupported);
#endif
}
static ERL_NIF_TERM nif_getrlimit(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
int resource = 0;
ErlNifBinary rlim = {0};
if (!enif_get_int(env, argv[0], &resource))
return enif_make_badarg(env);
if (!enif_inspect_binary(env, argv[1], &rlim) ||
rlim.size != sizeof(struct rlimit))
return enif_make_badarg(env);
if (getrlimit(resource, (struct rlimit *)rlim.data) != 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return enif_make_tuple2(env, atom_ok, enif_make_binary(env, &rlim));
}
static ERL_NIF_TERM nif_setrlimit(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
int resource = 0;
ErlNifBinary rlim = {0};
if (!enif_get_int(env, argv[0], &resource))
return enif_make_badarg(env);
if (!enif_inspect_binary(env, argv[1], &rlim) ||
rlim.size != sizeof(struct rlimit))
return enif_make_badarg(env);
if (setrlimit(resource, (struct rlimit *)rlim.data) != 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return enif_make_tuple2(env, atom_ok, enif_make_binary(env, &rlim));
}
static ERL_NIF_TERM nif_umask0(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
PERC_PRIV *priv;
u_int32_t mask;
priv = enif_priv_data(env);
enif_mutex_lock(priv->lock);
mask = umask(0);
(void)umask(mask);
enif_mutex_unlock(priv->lock);
return enif_make_uint(env, mask);
}
static void unload(ErlNifEnv *env, void *priv_data) {
PERC_PRIV *priv = priv_data;
if (priv) {
enif_mutex_destroy(priv->lock);
enif_free(priv);
}
}
static ERL_NIF_TERM nif_umask1(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
u_int32_t mask = 0;
u_int32_t omask = 0;
if (!enif_get_uint(env, argv[0], &mask))
return enif_make_badarg(env);
omask = umask(mask);
return enif_make_uint(env, omask);
}
static ERL_NIF_TERM nif_getuid(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
return enif_make_uint(env, getuid());
}
static ERL_NIF_TERM nif_geteuid(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
return enif_make_uint(env, geteuid());
}
static ERL_NIF_TERM nif_getgid(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
return enif_make_uint(env, getgid());
}
static ERL_NIF_TERM nif_getegid(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
return enif_make_uint(env, getegid());
}
static ERL_NIF_TERM nif_getgroups(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
int size;
int n;
int errnum;
gid_t *list;
ERL_NIF_TERM groups = {0};
size = getgroups(0, NULL);
if (size < 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
list = enif_alloc((size_t)size * sizeof(gid_t));
if (list == NULL)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
n = getgroups(size, list);
if (n < 0) {
errnum = errno;
enif_free(list);
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errnum)));
}
groups = enif_make_list(env, 0);
while (size--) {
groups = enif_make_list_cell(env, enif_make_uint(env, list[size]), groups);
}
enif_free(list);
return enif_make_tuple2(env, atom_ok, groups);
}
static ERL_NIF_TERM nif_setgroups(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
ERL_NIF_TERM head;
ERL_NIF_TERM tail;
unsigned int len = 0;
size_t size;
gid_t *list = NULL;
int rv;
if (!enif_is_list(env, argv[0]))
return enif_make_badarg(env);
if (!enif_get_list_length(env, argv[0], &len))
return enif_make_badarg(env);
tail = argv[0];
size = len;
if (size > 0) {
list = enif_alloc((size_t)len * sizeof(gid_t));
if (list == NULL)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
while (enif_get_list_cell(env, tail, &head, &tail)) {
unsigned int gid = 0;
if (!enif_get_uint(env, head, &gid)) {
enif_free(list);
return enif_make_badarg(env);
}
if (len == 0) {
enif_free(list);
return enif_make_badarg(env);
}
list[--len] = (gid_t)gid;
}
}
rv = setgroups(size, list);
if (rv < 0) {
enif_free(list);
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
}
return atom_ok;
}
static ERL_NIF_TERM nif_setresuid(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
u_int32_t ruid;
u_int32_t euid;
u_int32_t suid;
if (!enif_get_uint(env, argv[0], &ruid))
return enif_make_badarg(env);
if (!enif_get_uint(env, argv[1], &euid))
return enif_make_badarg(env);
if (!enif_get_uint(env, argv[2], &suid))
return enif_make_badarg(env);
if (setresuid(ruid, euid, suid) != 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return atom_ok;
}
static ERL_NIF_TERM nif_setresgid(ErlNifEnv *env, int argc,
const ERL_NIF_TERM argv[]) {
u_int32_t rgid;
u_int32_t egid;
u_int32_t sgid;
if (!enif_get_uint(env, argv[0], &rgid))
return enif_make_badarg(env);
if (!enif_get_uint(env, argv[1], &egid))
return enif_make_badarg(env);
if (!enif_get_uint(env, argv[2], &sgid))
return enif_make_badarg(env);
if (setresgid(rgid, egid, sgid) != 0)
return enif_make_tuple2(env, atom_error,
enif_make_atom(env, erl_errno_id(errno)));
return atom_ok;
}
static ErlNifFunc nif_funcs[] = {{"kill_nif", 2, nif_kill},
{"getpriority", 2, nif_getpriority},
{"setpriority", 3, nif_setpriority},
{"getuid", 0, nif_getuid},
{"geteuid", 0, nif_geteuid},
{"getgid", 0, nif_getgid},
{"getegid", 0, nif_getegid},
{"getgroups", 0, nif_getgroups},
{"setgroups", 1, nif_setgroups},
{"setresuid", 3, nif_setresuid},
{"setresgid", 3, nif_setresgid},
{"prlimit_nif", 4, nif_prlimit},
{"getrlimit_nif", 2, nif_getrlimit},
{"setrlimit_nif", 2, nif_setrlimit},
{"prctl", 3, nif_prctl},
{"umask_nif", 0, nif_umask0},
{"umask_nif", 1, nif_umask1},
/* signal handling */
{"close", 1, nif_close},
{"sigaddset_nif", 1, nif_sigaddset},
{"signalfd_nif", 2, nif_signalfd}};
ERL_NIF_INIT(perc, nif_funcs, load, reload, upgrade, unload)
|
fef-coin/fef | src/qt/blockbrowsermodel.h | #ifndef BLOCKBROWSERMODEL_H
#define BLOCKBROWSERMODEL_H
#include <QAbstractTableModel>
class BlockBrowserModelPriv;
class CWallet;
class WalletModel;
class BlockBrowserModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit BlockBrowserModel(CWallet* wallet, WalletModel *parent = 0);
~BlockBrowserModel();
// Header:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
// Basic functionality:
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
// Fetch data dynamically:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role);
private:
CWallet* wallet;
WalletModel *walletModel;
BlockBrowserModelPriv *priv;
QStringList columns;
friend class BlockBrowserModelPriv;
};
#endif // BLOCKBROWSERMODEL_H
|
fef-coin/fef | src/qt/multiaddress.h | <filename>src/qt/multiaddress.h
#ifndef MULTIADDRESS_H
#define MULTIADDRESS_H
#include <QtWidgets/QDialog>
class PubkeyItem;
namespace Ui {
class MultiAddress;
}
class MultiAddress : public QDialog
{
Q_OBJECT
public:
explicit MultiAddress(QWidget *parent = 0);
~MultiAddress();
void RemovePubkeyItem(PubkeyItem* item);
private:
void SetDelBtn(bool bEnable);
void ResizeScrollView();
private slots:
void on_generate_clicked();
void on_importMultiAddress_clicked();
protected:
void changeEvent(QEvent *e);
private slots:
void on_addpubkey_clicked();
private:
Ui::MultiAddress *ui;
QList<PubkeyItem*> items;
};
#endif // MULTIADDRESS_H
|
fef-coin/fef | src/qt/finance.h | #ifndef FINANCE_H
#define FINANCE_H
#include <QtWidgets/QDialog>
namespace Ui {
class Finance;
}
class Finance : public QDialog
{
Q_OBJECT
public:
explicit Finance(QWidget *parent = 0);
~Finance();
void AddWidget(QString label,QWidget* widgets);
void SetCurrentIndex(int index);
protected:
void changeEvent(QEvent *e);
private:
Ui::Finance *ui;
};
#endif // FINANCE_H
|
fef-coin/fef | src/qt/blockbrowser.h | <filename>src/qt/blockbrowser.h<gh_stars>0
#ifndef BLOCKBROWSER_H
#define BLOCKBROWSER_H
#include <QtWidgets/QWidget>
class CWallet;
class WalletModel;
namespace Ui {
class BlockBrowser;
}
class BlockBrowser : public QWidget
{
Q_OBJECT
public:
explicit BlockBrowser(CWallet *wallet,WalletModel *walletModel,QWidget *parent = 0);
~BlockBrowser();
protected:
void changeEvent(QEvent *e);
private:
Ui::BlockBrowser *ui;
CWallet *wallet;
WalletModel *walletModel;
};
#endif // BLOCKBROWSER_H
|
fef-coin/fef | src/qt/utilitydialog.h | #ifndef UTILITYDIALOG_H
#define UTILITYDIALOG_H
#include <QObject>
#include <QDialog>
/** "Shutdown" window */
class BitcoinGUI;
class ShutdownWindow : public QWidget
{
Q_OBJECT
public:
ShutdownWindow(QWidget *parent=0, Qt::WindowFlags f=0);
static QWidget *showShutdownWindow(BitcoinGUI *window);
protected:
void closeEvent(QCloseEvent *event);
};
#endif // UTILITYDIALOG_H
|
fef-coin/fef | src/qt/pubitem.h | <reponame>fef-coin/fef
#ifndef PUBITEM_H
#define PUBITEM_H
#include <QtWidgets/QWidget>
namespace Ui {
class pubitem;
}
class pubitem : public QWidget
{
Q_OBJECT
public:
explicit pubitem(QWidget *parent = 0);
~pubitem();
void enableDelBtn(bool bEnable = true);
protected:
void changeEvent(QEvent *e);
private:
Ui::pubitem *ui;
};
#endif // PUBITEM_H
|
fef-coin/fef | src/qt/pubkeyitem.h | <filename>src/qt/pubkeyitem.h
#ifndef PUBKEYITEM_H
#define PUBKEYITEM_H
#include <QtWidgets/QFrame>
class MultiAddress;
namespace Ui {
class PubkeyItem;
}
class PubkeyItem : public QFrame
{
Q_OBJECT
public:
explicit PubkeyItem(QWidget *parent = 0);
~PubkeyItem();
void enableDelBtn(bool bEnable = true);
void setModel(MultiAddress* model);
private slots:
void on_delButton_clicked();
protected:
void changeEvent(QEvent *e);
private:
Ui::PubkeyItem *ui;
MultiAddress* model;
};
#endif // PUBKEYITEM_H
|
tiantiankaixin/NetMonitor | lib/CHGlobalSingleton.h | //
// EXGlobalSingleton.h
// Extra
//
// Created by mal on 16/9/6.
// Copyright © 2016年 Haowai. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Reachability.h"
#define CHSingle [CHGlobalSingleton sharedInstance]
@interface CHGlobalSingleton : NSObject
/** 网络状态 */
@property (nonatomic, assign) NetworkStatus netStatus;
/**
* 全局单例
*
* @return 全局单例对象
*/
+ (CHGlobalSingleton *)sharedInstance;
/**
开启网络监控
*/
+ (void)startNetMonitoring;
+ (void)stopNetMonitoring;
+ (BOOL)isMobileNetWork;
+ (void)testFunc;
@end
|
dmjio/aoc2020 | 13/main.c | #include <stdio.h>
/* try it in C */
int allDivisible (int busses[], int offset[], int t) {
for (int i = 0; i < 10; i++) {
if ((t + offset[i]) % busses[i] != 0) {
return 0;
}
}
return 1;
}
int findEarly (int busses[], int offset[], int t) {
printf ("t = %d\n", t);
if (allDivisible (busses, offset, t) == 1) {
return t;
}
return findEarly (busses,offset,t+busses[0]);
}
int main () {
int busses[] = { 41,37,557,29,13,17,23,419,19 };
int offset[] = { 0,35,41,43,54,58,64,72,91 };
/* int busses[] = { 17,13,19 }; */
/* int offset[] = { }; */
int x = findEarly (busses, offset, 0);
printf ("found: %d\n", x);
}
|
Sigma-Squared/Brainf-_Interpreter | bf_interpreter.c | #define S_MEM 65536
#define uint unsigned int
#include <stdio.h>
#include <stdlib.h>
void run(char* prog, long len) {
uint* br_stack = calloc(len / 2, sizeof(uint));
int br_stackp = -1;
uint* brackets = calloc(len, sizeof(uint));
for (uint i=0; i<len; i++) {
if (prog[i] == '[')
br_stack[++br_stackp] = i;
else if (prog[i] == ']') {
if (br_stackp < 0) {
printf("Malformed brackets");
return;
}
uint op_brack = br_stack[br_stackp--];
brackets[op_brack] = i;
brackets[i] = op_brack;
}
}
free(br_stack);
char progmem[S_MEM] = {0};
char* ptr = progmem;
uint pc = 0;
while (1) {
switch(prog[pc]) {
case '>': ++ptr; break;
case '<': --ptr; break;
case '+': ++*ptr; break;
case '-': --*ptr; break;
case '.': putchar(*ptr); break;
case ',': *ptr = getchar(); break;
case '[':
if (*ptr == 0)
pc = brackets[pc];
break;
case ']':
if (*ptr != 0)
pc = brackets[pc];
break;
}
pc++;
if (pc >= len)
break;
}
free(brackets);
}
int main(int argc, char** argv) {
if (argc != 2)
return 1;
FILE* fp = fopen(argv[1], "r");
if (fp == NULL)
return 1;
fseek(fp, 0, SEEK_END);
long fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
char* fcontents = malloc(fsize);
fread(fcontents, 1, fsize, fp);
fclose(fp);
run(fcontents, fsize);
free(fcontents);
}
|
ViktorWalter/zathura | zathura/adjustment.h | <gh_stars>0
/* SPDX-License-Identifier: Zlib */
#ifndef ZATHURA_ADJUSTMENT_H
#define ZATHURA_ADJUSTMENT_H
#include <gtk/gtk.h>
#include <stdbool.h>
#include "document.h"
/**
* Calculate the page size according to the current scaling and rotation if
* desired.
*
* @param document the document
* @param height the original height
* @param width the original width
* @param page_height the scaled and rotated height
* @param page_width the scaled and rotated width
* @param rotate honor page's rotation
* @return real scale after rounding
*/
double page_calc_height_width(zathura_document_t* document, double height, double width,
unsigned int* page_height, unsigned int* page_width, bool rotate);
/**
* Calculate a page relative position after a rotation. The positions x y are
* relative to a page, i.e. 0=top of page, 1=bottom of page. They are NOT
* relative to the entire document.
*
* @param document the document
* @param x the x coordinates on the unrotated page
* @param y the y coordinates on the unrotated page
* @param xn the x coordinates after rotation
* @param yn the y coordinates after rotation
*/
void page_calc_position(zathura_document_t* document, double x, double y,
double *xn, double *yn);
/**
* Converts a relative position within the document to a page number.
*
* @param document The document
* @param pos_x the x position relative to the document
* @param pos_y the y position relative to the document
* @return page sitting in that position
*/
unsigned int position_to_page_number(zathura_document_t* document,
double pos_x, double pos_y);
/**
* Converts a page number to a position in units relative to the document
*
* We can specify where to aliwn the viewport and the page. For instance, xalign
* = 0 means align them on the left margin, xalign = 0.5 means centered, and
* xalign = 1.0 align them on the right margin.
*
* The return value is the position in in units relative to the document (0=top
* 1=bottom) of the point thet will lie at the center of the viewport.
*
* @param document The document
* @param page_number the given page number
* @param xalign where to align the viewport and the page
* @param yalign where to align the viewport and the page
* @param pos_x position that will lie at the center of the viewport.
* @param pos_y position that will lie at the center of the viewport.
*/
void page_number_to_position(zathura_document_t* document, unsigned int page_number,
double xalign, double yalign, double *pos_x, double *pos_y);
/**
* Checks whether a given page falls within the viewport
*
* @param document The document
* @param page_number the page number
* @return true if the page intersects the viewport
*/
bool page_is_visible(zathura_document_t *document, unsigned int page_number);
/**
* Set the adjustment value while enforcing its limits
*
* @param adjustment Adjustment instance
* @param value Adjustment value
*/
void zathura_adjustment_set_value(GtkAdjustment* adjustment, gdouble value);
/**
* Compute the adjustment ratio
*
* That is, the ratio between the length from the lower bound to the middle of
* the slider, and the total length of the scrollbar.
*
* @param adjustment Scrollbar adjustment
* @return Adjustment ratio
*/
gdouble zathura_adjustment_get_ratio(GtkAdjustment* adjustment);
/**
* Set the adjustment value from ratio
*
* The ratio is usually obtained from a previous call to
* zathura_adjustment_get_ratio().
*
* @param adjustment Adjustment instance
* @param ratio Ratio from which the adjustment value will be set
*/
void zathura_adjustment_set_value_from_ratio(GtkAdjustment* adjustment,
gdouble ratio);
#endif /* ZATHURA_ADJUSTMENT_H */
|
ViktorWalter/zathura | zathura/config.c | <reponame>ViktorWalter/zathura<filename>zathura/config.c
/* SPDX-License-Identifier: Zlib */
#include "config.h"
#include "commands.h"
#include "completion.h"
#include "callbacks.h"
#include "shortcuts.h"
#include "zathura.h"
#include "render.h"
#include "marks.h"
#include "utils.h"
#include <girara/settings.h>
#include <girara/session.h>
#include <girara/shortcuts.h>
#include <girara/config.h>
#include <girara/commands.h>
#include <girara/utils.h>
#include <glib/gi18n.h>
#define GLOBAL_RC "/etc/zathurarc"
#define ZATHURA_RC "zathurarc"
static void
cb_jumplist_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data;
const int* ivalue = value;
if (*ivalue < 0) {
zathura->jumplist.max_size = 0;
} else {
zathura->jumplist.max_size = *ivalue;
}
if (zathura->jumplist.list != NULL && zathura->jumplist.size != 0) {
zathura_jumplist_trim(zathura);
}
}
static void
cb_color_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data;
const char* string_value = (const char*) value;
if (g_strcmp0(name, "highlight-color") == 0) {
parse_color(&zathura->ui.colors.highlight_color, string_value);
} else if (g_strcmp0(name, "highlight-fg") == 0) {
parse_color(&zathura->ui.colors.highlight_color_fg, string_value);
} else if (g_strcmp0(name, "highlight-active-color") == 0) {
parse_color(&zathura->ui.colors.highlight_color_active, string_value);
} else if (g_strcmp0(name, "recolor-darkcolor") == 0) {
if (zathura->sync.render_thread != NULL) {
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, NULL, string_value);
}
} else if (g_strcmp0(name, "recolor-lightcolor") == 0) {
if (zathura->sync.render_thread != NULL) {
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, string_value, NULL);
}
} else if (g_strcmp0(name, "render-loading-bg") == 0) {
parse_color(&zathura->ui.colors.render_loading_bg, string_value);
} else if (g_strcmp0(name, "render-loading-fg") == 0) {
parse_color(&zathura->ui.colors.render_loading_fg, string_value);
}
render_all(zathura);
}
static void
cb_nohlsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data;
const bool* bvalue = value;
document_draw_search_results(zathura, !*bvalue);
render_all(zathura);
}
static void
cb_incsearch_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
bool inc_search = *(const bool*) value;
girara_special_command_add(session, '/', cmd_search, inc_search, FORWARD, NULL);
girara_special_command_add(session, '?', cmd_search, inc_search, BACKWARD, NULL);
}
static void
cb_sandbox_changed(girara_session_t* session, const char* UNUSED(name),
girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data;
const char* sandbox = value;
if (g_strcmp0(sandbox, "none") == 0) {
zathura->global.sandbox = ZATHURA_SANDBOX_NONE;
} else if (g_strcmp0(sandbox, "normal") == 0) {
zathura->global.sandbox = ZATHURA_SANDBOX_NORMAL;
} else if (g_strcmp0(sandbox, "strict") == 0) {
zathura->global.sandbox = ZATHURA_SANDBOX_STRICT;
} else {
girara_error("Invalid sandbox option");
}
}
static void
cb_window_statbusbar_changed(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), const void* value, void* UNUSED(data))
{
g_return_if_fail(value != NULL);
g_return_if_fail(session != NULL);
g_return_if_fail(session->global.data != NULL);
zathura_t* zathura = session->global.data;
const bool is_window_setting = g_str_has_prefix(name, "window-");
if (is_window_setting) {
char* formatted_filename = get_formatted_filename(zathura, !is_window_setting);
girara_set_window_title(zathura->ui.session, formatted_filename);
g_free(formatted_filename);
} else {
statusbar_page_number_update(zathura);
}
}
void
config_load_default(zathura_t* zathura)
{
if (zathura == NULL || zathura->ui.session == NULL) {
return;
}
int int_value = 0;
float float_value = 0;
bool bool_value = false;
girara_session_t* gsession = zathura->ui.session;
/* mode settings */
zathura->modes.normal = gsession->modes.normal;
zathura->modes.fullscreen = girara_mode_add(gsession, "fullscreen");
zathura->modes.index = girara_mode_add(gsession, "index");
zathura->modes.insert = girara_mode_add(gsession, "insert");
zathura->modes.presentation = girara_mode_add(gsession, "presentation");
#define NORMAL zathura->modes.normal
#define INSERT zathura->modes.insert
#define INDEX zathura->modes.index
#define FULLSCREEN zathura->modes.fullscreen
#define PRESENTATION zathura->modes.presentation
const girara_mode_t all_modes[] = {
NORMAL,
INSERT,
INDEX,
FULLSCREEN,
PRESENTATION
};
/* Set default mode */
girara_mode_set(gsession, zathura->modes.normal);
/* zathura settings */
girara_setting_add(gsession, "database", "plain", STRING, true, _("Database backend"), NULL, NULL);
girara_setting_add(gsession, "filemonitor", "glib", STRING, true, _("File monitor backend"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "zoom-step", &int_value, INT, false, _("Zoom step"), NULL, NULL);
int_value = 1;
girara_setting_add(gsession, "page-padding", &int_value, INT, false, _("Padding between pages"), cb_page_layout_value_changed, NULL);
int_value = 1;
girara_setting_add(gsession, "pages-per-row", &int_value, INT, false, _("Number of pages per row"), cb_page_layout_value_changed, NULL);
int_value = 1;
girara_setting_add(gsession, "first-page-column", "1:2", STRING, false, _("Column of the first page"), cb_page_layout_value_changed, NULL);
bool_value = false;
girara_setting_add(gsession, "page-right-to-left", &bool_value, BOOLEAN, false, _("Render pages from right to left"), cb_page_layout_value_changed, NULL);
float_value = 40;
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, _("Scroll step"), NULL, NULL);
float_value = 40;
girara_setting_add(gsession, "scroll-hstep", &float_value, FLOAT, false, _("Horizontal scroll step"), NULL, NULL);
float_value = 0.0;
girara_setting_add(gsession, "scroll-full-overlap", &float_value, FLOAT, false, _("Full page scroll overlap"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "zoom-min", &int_value, INT, false, _("Zoom minimum"), NULL, NULL);
int_value = 1000;
girara_setting_add(gsession, "zoom-max", &int_value, INT, false, _("Zoom maximum"), NULL, NULL);
int_value = ZATHURA_PAGE_CACHE_DEFAULT_SIZE;
girara_setting_add(gsession, "page-cache-size", &int_value, INT, true, _("Maximum number of pages to keep in the cache"), NULL, NULL);
int_value = ZATHURA_PAGE_THUMBNAIL_DEFAULT_SIZE;
girara_setting_add(gsession, "page-thumbnail-size", &int_value, INT, true, _("Maximum size in pixels of thumbnails to keep in the cache"), NULL, NULL);
int_value = 2000;
girara_setting_add(gsession, "jumplist-size", &int_value, INT, false, _("Number of positions to remember in the jumplist"), cb_jumplist_change, NULL);
girara_setting_add(gsession, "recolor-darkcolor", "#FFFFFF", STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
girara_setting_add(gsession, "recolor-lightcolor", "#000000", STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-color", "#9FBC00");
girara_setting_add(gsession, "highlight-fg", NULL, STRING, false, _("Foreground color for highlighting"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-fg", "#000000");
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-active-color", "#00BC00");
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-bg", "#FFFFFF");
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-fg", "#000000");
girara_setting_add(gsession, "index-fg", "#DDDDDD", STRING, true, _("Index mode foreground color"), NULL, NULL);
girara_setting_add(gsession, "index-bg", "#232323", STRING, true, _("Index mode background color"), NULL, NULL);
girara_setting_add(gsession, "index-active-fg", "#232323", STRING, true, _("Index mode foreground color (active element)"), NULL, NULL);
girara_setting_add(gsession, "index-active-bg", "#9FBC00", STRING, true, _("Index mode background color (active element)"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "recolor", &bool_value, BOOLEAN, false, _("Recolor pages"), cb_setting_recolor_change, NULL);
bool_value = false;
girara_setting_add(gsession, "recolor-keephue", &bool_value, BOOLEAN, false, _("When recoloring keep original hue and adjust lightness only"), cb_setting_recolor_keep_hue_change, NULL);
bool_value = false;
girara_setting_add(gsession, "recolor-reverse-video", &bool_value, BOOLEAN, false, _("When recoloring keep original image colors"), cb_setting_recolor_keep_reverse_video_change, NULL);
bool_value = false;
girara_setting_add(gsession, "scroll-wrap", &bool_value, BOOLEAN, false, _("Wrap scrolling"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "scroll-page-aware", &bool_value, BOOLEAN, false, _("Page aware scrolling"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "advance-pages-per-row", &bool_value, BOOLEAN, false, _("Advance number of pages per row"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "zoom-center", &bool_value, BOOLEAN, false, _("Horizontally centered zoom"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "vertical-center", &bool_value, BOOLEAN, false, _("Vertically center pages"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "link-hadjust", &bool_value, BOOLEAN, false, _("Align link target to the left"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "link-zoom", &bool_value, BOOLEAN, false, _("Let zoom be changed when following links"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "search-hadjust", &bool_value, BOOLEAN, false, _("Center result horizontally"), NULL, NULL);
float_value = 0.5;
girara_setting_add(gsession, "highlight-transparency", &float_value, FLOAT, false, _("Transparency for highlighting"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "render-loading", &bool_value, BOOLEAN, false, _("Render 'Loading ...'"), NULL, NULL);
girara_setting_add(gsession, "adjust-open", "best-fit", STRING, false, _("Adjust to when opening file"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "show-hidden", &bool_value, BOOLEAN, false, _("Show hidden files and directories"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "show-directories", &bool_value, BOOLEAN, false, _("Show directories"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "show-recent", &int_value, INT, false, _("Show recent files"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "open-first-page", &bool_value, BOOLEAN, false, _("Always open on first page"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "nohlsearch", &bool_value, BOOLEAN, false, _("Highlight search results"), cb_nohlsearch_changed, NULL);
#define INCREMENTAL_SEARCH false
bool_value = INCREMENTAL_SEARCH;
girara_setting_add(gsession, "incremental-search", &bool_value, BOOLEAN, false, _("Enable incremental search"), cb_incsearch_changed, NULL);
bool_value = true;
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "window-title-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the window title"), cb_window_statbusbar_changed, NULL);
bool_value = false;
girara_setting_add(gsession, "window-title-home-tilde", &bool_value, BOOLEAN, false, _("Use ~ instead of $HOME in the filename in the window title"), cb_window_statbusbar_changed, NULL);
bool_value = false;
girara_setting_add(gsession, "window-title-page", &bool_value, BOOLEAN, false, _("Display the page number in the window title"), cb_window_statbusbar_changed, NULL);
bool_value = false;
girara_setting_add(gsession, "window-icon-document", &bool_value, BOOLEAN, false, _("Use first page of a document as window icon"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "statusbar-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the statusbar"), cb_window_statbusbar_changed, NULL);
bool_value = false;
girara_setting_add(gsession, "statusbar-home-tilde", &bool_value, BOOLEAN, false, _("Use ~ instead of $HOME in the filename in the statusbar"), cb_window_statbusbar_changed, NULL);
bool_value = true;
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL);
girara_setting_add(gsession, "synctex-editor-command", "", STRING, false, _("Synctex editor command"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service"), NULL, NULL);
girara_setting_add(gsession, "dbus-raise-window", &bool_value, BOOLEAN, false, _("Raise window on certain D-Bus commands"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "continuous-hist-save", &bool_value, BOOLEAN, false, _("Save history at each page change"), NULL, NULL);
girara_setting_add(gsession, "selection-clipboard", "primary", STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "selection-notification", &bool_value, BOOLEAN, false, _("Enable notification after selecting text"), NULL, NULL);
/* default to no sandbox when running in WSL */
const char* string_value = running_under_wsl() ? "none" : "normal";
girara_setting_add(gsession, "sandbox", string_value, STRING, true, _("Sandbox level"), cb_sandbox_changed, NULL);
#define DEFAULT_SHORTCUTS(mode) \
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_s, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_WIDTH, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_F, NULL, sc_display_link, (mode), 0, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_c, NULL, sc_copy_link, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_slash, NULL, sc_focus_inputbar, (mode), 0, &("/")); \
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_slash, NULL, sc_focus_inputbar, (mode), 0, &("/")); \
girara_shortcut_add(gsession, 0, GDK_KEY_question, NULL, sc_focus_inputbar, (mode), 0, &("?")); \
girara_shortcut_add(gsession, 0, GDK_KEY_colon, NULL, sc_focus_inputbar, (mode), 0, &(":")); \
girara_shortcut_add(gsession, 0, GDK_KEY_o, NULL, sc_focus_inputbar, (mode), 0, &(":open ")); \
girara_shortcut_add(gsession, 0, GDK_KEY_O, NULL, sc_focus_inputbar, (mode), APPEND_FILEPATH, &(":open ")); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_f, NULL, sc_follow, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, 0, "gg", sc_goto, (mode), TOP, NULL); \
girara_shortcut_add(gsession, 0, 0, "G", sc_goto, (mode), BOTTOM, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_m, NULL, sc_mark_add, (mode), 0, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_apostrophe, NULL, sc_mark_evaluate, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, (mode), NEXT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_K, NULL, sc_navigate, (mode), PREVIOUS, NULL); \
girara_shortcut_add(gsession, GDK_MOD1_MASK, GDK_KEY_Right, NULL, sc_navigate, (mode), NEXT, NULL); \
girara_shortcut_add(gsession, GDK_MOD1_MASK, GDK_KEY_Left, NULL, sc_navigate, (mode), PREVIOUS, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Down, NULL, sc_navigate, (mode), NEXT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Up, NULL, sc_navigate, (mode), PREVIOUS, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_p, NULL, sc_print, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_r, NULL, sc_recolor, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_R, NULL, sc_reload, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_r, NULL, sc_rotate, (mode), ROTATE_CW, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_scroll, (mode), LEFT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_scroll, (mode), DOWN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_k, NULL, sc_scroll, (mode), UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_l, NULL, sc_scroll, (mode), RIGHT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_scroll, (mode), LEFT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, (mode), UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, (mode), DOWN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_H, NULL, sc_scroll, (mode), PAGE_TOP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_L, NULL, sc_scroll, (mode), PAGE_BOTTOM, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, (mode), RIGHT, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_t, NULL, sc_scroll, (mode), HALF_LEFT, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, (mode), HALF_DOWN, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_u, NULL, sc_scroll, (mode), HALF_UP, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_y, NULL, sc_scroll, (mode), HALF_RIGHT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_t, NULL, sc_scroll, (mode), FULL_LEFT, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_f, NULL, sc_scroll, (mode), FULL_DOWN, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_b, NULL, sc_scroll, (mode), FULL_UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_y, NULL, sc_scroll, (mode), FULL_RIGHT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_scroll, (mode), FULL_DOWN, NULL); \
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_scroll, (mode), FULL_UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Y, NULL, sc_copy_filepath, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_o, NULL, sc_jumplist, (mode), BACKWARD, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_i, NULL, sc_jumplist, (mode), FORWARD, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_j, NULL, sc_bisect, (mode), FORWARD, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_k, NULL, sc_bisect, (mode), BACKWARD, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_n, NULL, sc_search, (mode), FORWARD, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_N, NULL, sc_search, (mode), BACKWARD, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_P, NULL, sc_snap_to_page, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, (mode), 0, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_n, NULL, girara_sc_toggle_statusbar, (mode), 0, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_m, NULL, girara_sc_toggle_inputbar, (mode), 0, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_d, NULL, sc_toggle_page_mode, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_plus, NULL, sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Add, NULL, sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_minus, NULL, sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Subtract,NULL, sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_equal, NULL, sc_zoom, (mode), ZOOM_SPECIFIC, NULL); \
girara_shortcut_add(gsession, 0, 0, "zi", sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, 0, "zI", sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, 0, "zo", sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, 0, "zO", sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, 0, "z0", sc_zoom, (mode), ZOOM_ORIGINAL, NULL); \
girara_shortcut_add(gsession, 0, 0, "zz", sc_zoom, (mode), ZOOM_SPECIFIC, NULL); \
girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, (mode), ZOOM_SPECIFIC, NULL);
#define DEFAULT_MOUSE_EVENTS(mode) \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_BIDIRECTIONAL, BIDIRECTIONAL, NULL); \
\
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, LEFT, NULL); \
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL); \
\
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_BIDIRECTIONAL, BIDIRECTIONAL, NULL); \
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_PRESS, 0, NULL); \
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_RELEASE, 0, NULL); \
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_MOTION_NOTIFY, 0, NULL); \
/* Define mode-less shortcuts
* girara adds them only for normal mode, so passing 0 as mode is currently
* not enough. We need to add/override for every mode. */
for (size_t idx = 0; idx != LENGTH(all_modes); ++idx) {
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, all_modes[idx], 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Escape, NULL, sc_abort, all_modes[idx], 0, NULL);
}
/* Normal mode */
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_presentation, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_F11, NULL, sc_toggle_fullscreen, NORMAL, 0, NULL);
DEFAULT_SHORTCUTS(NORMAL)
/* Normal mode - Mouse events */
DEFAULT_MOUSE_EVENTS(NORMAL)
/* Fullscreen mode */
girara_shortcut_add(gsession, 0, GDK_KEY_F11, NULL, sc_toggle_fullscreen, FULLSCREEN, 0, NULL);
DEFAULT_SHORTCUTS(FULLSCREEN)
/* Fullscreen mode - Mouse events */
DEFAULT_MOUSE_EVENTS(FULLSCREEN)
/* Index mode */
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, INDEX, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_k, NULL, sc_navigate_index, INDEX, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_navigate_index, INDEX, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_navigate_index, INDEX, COLLAPSE, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_l, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_L, NULL, sc_navigate_index, INDEX, EXPAND_ALL, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_H, NULL, sc_navigate_index, INDEX, COLLAPSE_ALL, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_navigate_index, INDEX, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_navigate_index, INDEX, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_navigate_index, INDEX, COLLAPSE, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_j, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, INDEX, 0, NULL);
girara_shortcut_add(gsession, 0, 0, "gg", sc_navigate_index, INDEX, TOP, NULL);
girara_shortcut_add(gsession, 0, 0, "G", sc_navigate_index, INDEX, BOTTOM, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Escape, NULL, sc_toggle_index, INDEX, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_bracketleft, NULL, sc_toggle_index, INDEX, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_toggle_index, INDEX, 0, NULL);
/* Presentation mode */
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Down, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_K, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Up, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_BackSpace, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_presentation, PRESENTATION, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, PRESENTATION, 0, NULL);
/* Presentation mode - Mouse events */
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON1, sc_navigate, PRESENTATION, GIRARA_EVENT_BUTTON_PRESS, NEXT, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON3, sc_navigate, PRESENTATION, GIRARA_EVENT_BUTTON_PRESS, PREVIOUS, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, PRESENTATION, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, PRESENTATION, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
/* inputbar shortcuts */
girara_inputbar_shortcut_add(gsession, 0, GDK_KEY_Escape, sc_abort, 0, NULL);
girara_inputbar_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, sc_abort, 0, NULL);
/* define default inputbar commands */
girara_inputbar_command_add(gsession, "bmark", NULL, cmd_bookmark_create, NULL, _("Add a bookmark"));
girara_inputbar_command_add(gsession, "bdelete", NULL, cmd_bookmark_delete, cc_bookmarks, _("Delete a bookmark"));
girara_inputbar_command_add(gsession, "blist", NULL, cmd_bookmark_open, cc_bookmarks, _("List all bookmarks"));
girara_inputbar_command_add(gsession, "close", NULL, cmd_close, NULL, _("Close current file"));
girara_inputbar_command_add(gsession, "info", NULL, cmd_info, NULL, _("Show file information"));
girara_inputbar_command_add(gsession, "exec", NULL, cmd_exec, NULL, _("Execute a command"));
girara_inputbar_command_add(gsession, "!", NULL, cmd_exec, NULL, _("Execute a command")); /* like vim */
girara_inputbar_command_add(gsession, "help", NULL, cmd_help, NULL, _("Show help"));
girara_inputbar_command_add(gsession, "open", "o", cmd_open, cc_open, _("Open document"));
girara_inputbar_command_add(gsession, "quit", "q", cmd_quit, NULL, _("Close zathura"));
girara_inputbar_command_add(gsession, "print", NULL, cmd_print, NULL, _("Print document"));
girara_inputbar_command_add(gsession, "save", NULL, cmd_save, cc_write, _("Save document"));
girara_inputbar_command_add(gsession, "save!", NULL, cmd_savef, cc_write, _("Save document (and force overwriting)"));
girara_inputbar_command_add(gsession, "write", NULL, cmd_save, cc_write, _("Save document"));
girara_inputbar_command_add(gsession, "write!", NULL, cmd_savef, cc_write, _("Save document (and force overwriting)"));
girara_inputbar_command_add(gsession, "export", NULL, cmd_export, cc_export, _("Save attachments"));
girara_inputbar_command_add(gsession, "offset", NULL, cmd_offset, NULL, _("Set page offset"));
girara_inputbar_command_add(gsession, "mark", NULL, cmd_marks_add, NULL, _("Mark current location within the document"));
girara_inputbar_command_add(gsession, "delmarks", "delm", cmd_marks_delete, NULL, _("Delete the specified marks"));
girara_inputbar_command_add(gsession, "nohlsearch", "nohl", cmd_nohlsearch, NULL, _("Don't highlight current search results"));
girara_inputbar_command_add(gsession, "hlsearch", NULL, cmd_hlsearch, NULL, _("Highlight current search results"));
girara_inputbar_command_add(gsession, "version", NULL, cmd_version, NULL, _("Show version information"));
girara_inputbar_command_add(gsession, "source", NULL, cmd_source, NULL, _("Source config file"));
girara_special_command_add(gsession, '/', cmd_search, INCREMENTAL_SEARCH, FORWARD, NULL);
girara_special_command_add(gsession, '?', cmd_search, INCREMENTAL_SEARCH, BACKWARD, NULL);
/* add shortcut mappings */
girara_shortcut_mapping_add(gsession, "abort", sc_abort);
girara_shortcut_mapping_add(gsession, "adjust_window", sc_adjust_window);
girara_shortcut_mapping_add(gsession, "bisect", sc_bisect);
girara_shortcut_mapping_add(gsession, "change_mode", sc_change_mode);
girara_shortcut_mapping_add(gsession, "display_link", sc_display_link);
girara_shortcut_mapping_add(gsession, "copy_link", sc_copy_link);
girara_shortcut_mapping_add(gsession, "copy_filepath", sc_copy_filepath);
girara_shortcut_mapping_add(gsession, "exec", sc_exec);
girara_shortcut_mapping_add(gsession, "focus_inputbar", sc_focus_inputbar);
girara_shortcut_mapping_add(gsession, "follow", sc_follow);
girara_shortcut_mapping_add(gsession, "goto", sc_goto);
girara_shortcut_mapping_add(gsession, "jumplist", sc_jumplist);
girara_shortcut_mapping_add(gsession, "mark_add", sc_mark_add);
girara_shortcut_mapping_add(gsession, "mark_evaluate", sc_mark_evaluate);
girara_shortcut_mapping_add(gsession, "navigate", sc_navigate);
girara_shortcut_mapping_add(gsession, "navigate_index", sc_navigate_index);
girara_shortcut_mapping_add(gsession, "nohlsearch", sc_nohlsearch);
girara_shortcut_mapping_add(gsession, "print", sc_print);
girara_shortcut_mapping_add(gsession, "quit", sc_quit);
girara_shortcut_mapping_add(gsession, "recolor", sc_recolor);
girara_shortcut_mapping_add(gsession, "reload", sc_reload);
girara_shortcut_mapping_add(gsession, "rotate", sc_rotate);
girara_shortcut_mapping_add(gsession, "scroll", sc_scroll);
girara_shortcut_mapping_add(gsession, "search", sc_search);
girara_shortcut_mapping_add(gsession, "snap_to_page", sc_snap_to_page);
girara_shortcut_mapping_add(gsession, "toggle_fullscreen", sc_toggle_fullscreen);
girara_shortcut_mapping_add(gsession, "toggle_index", sc_toggle_index);
girara_shortcut_mapping_add(gsession, "toggle_page_mode", sc_toggle_page_mode);
girara_shortcut_mapping_add(gsession, "toggle_presentation", sc_toggle_presentation);
girara_shortcut_mapping_add(gsession, "zoom", sc_zoom);
/* add argument mappings */
girara_argument_mapping_add(gsession, "backward", BACKWARD);
girara_argument_mapping_add(gsession, "bottom", BOTTOM);
girara_argument_mapping_add(gsession, "default", DEFAULT);
girara_argument_mapping_add(gsession, "collapse", COLLAPSE);
girara_argument_mapping_add(gsession, "collapse-all", COLLAPSE_ALL);
girara_argument_mapping_add(gsession, "down", DOWN);
girara_argument_mapping_add(gsession, "expand", EXPAND);
girara_argument_mapping_add(gsession, "expand-all", EXPAND_ALL);
girara_argument_mapping_add(gsession, "select", SELECT);
girara_argument_mapping_add(gsession, "toggle", TOGGLE);
girara_argument_mapping_add(gsession, "forward", FORWARD);
girara_argument_mapping_add(gsession, "full-down", FULL_DOWN);
girara_argument_mapping_add(gsession, "full-up", FULL_UP);
girara_argument_mapping_add(gsession, "half-down", HALF_DOWN);
girara_argument_mapping_add(gsession, "half-up", HALF_UP);
girara_argument_mapping_add(gsession, "full-right", FULL_RIGHT);
girara_argument_mapping_add(gsession, "full-left", FULL_LEFT);
girara_argument_mapping_add(gsession, "half-right", HALF_RIGHT);
girara_argument_mapping_add(gsession, "half-left", HALF_LEFT);
girara_argument_mapping_add(gsession, "in", ZOOM_IN);
girara_argument_mapping_add(gsession, "left", LEFT);
girara_argument_mapping_add(gsession, "next", NEXT);
girara_argument_mapping_add(gsession, "out", ZOOM_OUT);
girara_argument_mapping_add(gsession, "page-top", PAGE_TOP);
girara_argument_mapping_add(gsession, "page-bottom", PAGE_BOTTOM);
girara_argument_mapping_add(gsession, "previous", PREVIOUS);
girara_argument_mapping_add(gsession, "right", RIGHT);
girara_argument_mapping_add(gsession, "specific", ZOOM_SPECIFIC);
girara_argument_mapping_add(gsession, "top", TOP);
girara_argument_mapping_add(gsession, "up", UP);
girara_argument_mapping_add(gsession, "best-fit", ZATHURA_ADJUST_BESTFIT);
girara_argument_mapping_add(gsession, "width", ZATHURA_ADJUST_WIDTH);
girara_argument_mapping_add(gsession, "rotate-cw", ROTATE_CW);
girara_argument_mapping_add(gsession, "rotate-ccw", ROTATE_CCW);
}
void
config_load_files(zathura_t* zathura)
{
/* load global configuration files */
char* config_path = girara_get_xdg_path(XDG_CONFIG_DIRS);
girara_list_t* config_dirs = girara_split_path_array(config_path);
ssize_t size = girara_list_size(config_dirs) - 1;
for (; size >= 0; --size) {
const char* dir = girara_list_nth(config_dirs, size);
char* file = g_build_filename(dir, ZATHURA_RC, NULL);
girara_config_parse(zathura->ui.session, file);
g_free(file);
}
girara_list_free(config_dirs);
g_free(config_path);
girara_config_parse(zathura->ui.session, GLOBAL_RC);
/* load local configuration files */
char* configuration_file = g_build_filename(zathura->config.config_dir, ZATHURA_RC, NULL);
girara_config_parse(zathura->ui.session, configuration_file);
g_free(configuration_file);
}
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/View/SAMWalletDetailCell.h | <reponame>haichainLab/wallet-ios<filename>SamosWallet/Class/Wallet/View/SAMWalletDetailCell.h
//
// SAMWalletDetailCell.h
// SamosWallet
//
// Created by zys on 2018/12/2.
// Copyright © 2018 zys. All rights reserved.
//
/**
钱包详情页cell
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletDetailCell : UITableViewCell
@property (weak, nonatomic, readonly) IBOutlet UITextField *walletNameTextField;
@property (weak, nonatomic, readonly) IBOutlet UITextField *pwdTipTextField;
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithModel:(SAMWalletInfo *)model;
extern NSString *const SAMWalletDetailCellID;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Network/SAMApi.h | <filename>SamosWallet/Util/Network/SAMApi.h<gh_stars>0
//
// SAMApi.h
// XB
//
// Created by Xiaobu on 2017/2/20.
// Copyright © 2017年 XiaoBu. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SAMApi : NSObject
/// 主地址
extern NSString *const SAMApiBaseURLString;
/// 获取token信息(支持的货币数据)
extern NSString *const SAMApiGetToken;
/// 获取兑换比率的数据
extern NSString *const SAMApiGetPrice;
/// 获取某一币种的交易记录列表
/// http://samos.yqkkn.com/api/transaction?token=<PASSWORD>&address=2STmHA282bDmWisDHt6LNJjgTvbwezeJCct&ts=1
/// ts为时间戳,防止服务器接口缓存
extern NSString *const SAMApiGetCoinTradeRecordList;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Base/Controller/SAMNavigationController.h | <filename>SamosWallet/Class/Base/Controller/SAMNavigationController.h
//
// SAMNavigationController.h
// SamosWallet
//
// Created by zys on 2018/8/20.
// Copyright © 2018年 zys. All rights reserved.
//
/**
项目里nav controller基类
*/
#import <UIKit/UIKit.h>
@interface SAMNavigationController : UINavigationController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Base/Controller/SAMBaseCollectionViewController.h | //
// SAMBaseCollectionViewController.h
// SamosWallet
//
// Created by zys on 2018/8/18.
// Copyright © 2018年 zys. All rights reserved.
//
/**
项目里所有collection列表页基类
*/
#import "SAMBaseViewController.h"
@interface SAMBaseCollectionViewController : SAMBaseViewController <UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>
/// collectionView
@property (nonatomic, strong, readonly) UICollectionView *collectionView;
/// 是否显示下拉刷新
@property (nonatomic, assign) BOOL showRefreshHeader;
/// 是否显示上拉刷新
@property (nonatomic, assign) BOOL showRefreshFooter;
/**
注册cell,子类重写
*/
- (void)registerCell;
/**
下拉刷新 子类重写
@param completion 数据加载完成的回调
*/
- (void)loadNewDataWithCompletionHandler:(SAMVoidBlock)completion;
/**
上拉加载 子类重写
@param completion 数据加载完成的回调
*/
- (void)loadMoreDataWithCompletionHandler:(void (^)(BOOL hasMoreData))completion;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Trade/View/SAMReceiveCell.h | //
// SAMReceiveCell.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
转入cell
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMReceiveCell : UITableViewCell
/// 二维码
@property (weak, nonatomic, readonly) IBOutlet UIImageView *qrcodeImageView;
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithAddress:(NSString *)address
token:(NSString *)token;
extern NSString *const SAMReceiveCellID;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Find/Controller/SAMUIWebViewController.h | //
// SAMUIWebViewController.h
// SAM
//
// Created by zys on 2017/7/15.
// Copyright © 2017年 Xiaobu. All rights reserved.
//
/**
封装UIWebview,调用H5
*/
#import "SAMBaseViewController.h"
@interface SAMUIWebViewController : SAMBaseViewController
/// webivew
@property (nonatomic, strong, readonly) UIWebView *webView;
@property (nonatomic, copy) NSString *URLString;
+ (instancetype)pushFrom:(UIViewController *)fromVC
withURLString:(NSString *)urlStr;
- (void)hideNavbar;
- (void)reloadPage;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Root/View/SAMGuideScrollViewItem.h | <gh_stars>0
//
// SAMGuideScrollViewItem.h
// SamosWallet
//
// Created by zys on 2018/8/28.
// Copyright © 2018年 zys. All rights reserved.
//
/**
引导页-图片item
*/
#import <UIKit/UIKit.h>
@interface SAMGuideScrollViewItem : UIView
/// dismiss回调
@property (nonatomic, copy) SAMVoidBlock dismissBlock;
+ (instancetype)item;
- (void)setItemWithImageName:(NSString *)imageName;
- (void)showStartBtn:(BOOL)show;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMSelectLanuageCell.h | //
// SAMSelectLanuageCell.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
选择语言cell
*/
#import <UIKit/UIKit.h>
@interface SAMSelectLanuageCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithLanguageName:(NSString *)name
selected:(BOOL)selected;
extern NSString *const SAMSelectLanuageCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/Controller/SAMImportWalletController.h | <filename>SamosWallet/Class/Wallet/Controller/SAMImportWalletController.h
//
// SAMImportWalletController.h
// SamosWallet
//
// Created by zys on 2018/8/30.
// Copyright © 2018年 zys. All rights reserved.
//
/**
导入钱包第一步:名称、图标
*/
#import "SAMBaseCollectionViewController.h"
@interface SAMImportWalletController : SAMBaseCollectionViewController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Root/Controller/SAMTabBarViewController.h | <filename>SamosWallet/Class/Root/Controller/SAMTabBarViewController.h
//
// SAMTabBarViewController.h
// SamosWallet
//
// Created by zys on 2018/8/18.
// Copyright © 2018年 zys. All rights reserved.
//
/**
root tab bar vc
*/
#import <UIKit/UIKit.h>
@interface SAMTabBarViewController : UITabBarController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMVersionCell.h | <reponame>haichainLab/wallet-ios
//
// SAMVersionCell.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
关于我们-版本
*/
#import <UIKit/UIKit.h>
@interface SAMVersionCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
extern NSString *const SAMVersionCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Root/Controller/SAMFirstMananeWalletController.h | <filename>SamosWallet/Class/Root/Controller/SAMFirstMananeWalletController.h
//
// SAMFirstMananeWalletController.h
// SamosWallet
//
// Created by zys on 2018/9/8.
// Copyright © 2018年 zys. All rights reserved.
//
/**
第一次管理钱包蓝色页面
*/
#import "SAMBaseTableViewController.h"
@interface SAMFirstMananeWalletController : SAMBaseTableViewController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/View/SAMBackupWordsCell.h | <reponame>haichainLab/wallet-ios
//
// SAMBackupWordsCell.h
// SamosWallet
//
// Created by zys on 2018/9/2.
// Copyright © 2018年 zys. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SAMBackupWordsCell : UITableViewCell
@property (weak, nonatomic, readonly) IBOutlet UIButton *recreateBtn;
@property (weak, nonatomic, readonly) IBOutlet UILabel *btnTitleLabel;
/// 重新生成words
@property (nonatomic, copy) SAMVoidBlock recreateBlock;
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeightWithWord:(NSString *)word;
- (void)setCellWithWords:(NSString *)word;
extern NSString *const SAMBackupWordsCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMCoinDetailHeader.h | <gh_stars>0
//
// SAMCoinDetailHeader.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMCoinDetailHeader : UIView
+ (instancetype)header;
+ (CGFloat)headerHeight;
- (void)setHeaderWithModel:(SAMWalletTokenInfo *)model;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/DB/SAMCoinRateInfo.h | <filename>SamosWallet/Util/DB/SAMCoinRateInfo.h
//
// SAMCoinRateInfo.h
// SamosWallet
//
// Created by zys on 2018/11/18.
// Copyright © 2018 zys. All rights reserved.
//
/**
用户币种兑换比率数据(数据库表)
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMCoinRateInfo : NSObject
/// token, eg: SAMO
@property (nonatomic, copy) NSString *token;
/// 美元兑换比率(1个币=usd个美元)
@property (nonatomic, assign) CGFloat usd;
/// 人民币兑换比率(1个币=cny个人民)
@property (nonatomic, assign) CGFloat cny;
/// 比特币兑换比率(1个币=btc个比特币)
@property (nonatomic, assign) CGFloat btc;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Category/NSString+SAMAddtion.h | //
// NSString+SAMAddtion.h
// SamosWallet
//
// Created by zys on 2018/10/14.
// Copyright © 2018 zys. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (SAMAddtion)
/**
去除首尾的空格和回车
@return 处理后的字符串
*/
- (NSString *)trime;
/**
对url进行enCode
@return enCode后的字符串
*/
- (NSString *)enCode;
/**
对url进行deCode
@return deCode后的字符串
*/
- (NSString *)deCode;
// 3DES加密
- (NSString*)encrypt3DES;
// 3DES解密
- (NSString*)decrypt3DES;
/**
* URLEncode
*/
- (NSString *)URLEncodedString;
/**
* URLDecode
*/
-(NSString *)URLDecodedString;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMAboutUsHeaderView.h | <filename>SamosWallet/Class/Me/View/SAMAboutUsHeaderView.h<gh_stars>0
//
// SAMAboutUsHeaderView.h
// SamosWallet
//
// Created by zys on 2018/8/20.
// Copyright © 2018年 zys. All rights reserved.
//
/**
个人中心-蓝色header
*/
#import <UIKit/UIKit.h>
@interface SAMAboutUsHeaderView : UIView
+ (instancetype)header;
+ (CGFloat)headerHeight;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/Controller/SAMBackupWordsController.h | <gh_stars>0
//
// SAMBackupWordsController.h
// SamosWallet
//
// Created by zys on 2018/9/2.
// Copyright © 2018年 zys. All rights reserved.
//
/**
备份助记词
*/
#import "SAMBaseTableViewController.h"
@interface SAMBackupWordsController : SAMBaseTableViewController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Base/Controller/SAMBaseTableViewController.h | //
// SAMBaseTableViewController.h
// SamosWallet
//
// Created by zys on 2018/8/18.
// Copyright © 2018年 zys. All rights reserved.
//
/**
项目里所有列表页基类
*/
#import "SAMBaseViewController.h"
@interface SAMBaseTableViewController : SAMBaseViewController <UITableViewDataSource, UITableViewDelegate>
/// tableView
@property (nonatomic, strong, readonly) UITableView *tableView;
/// 是否显示下拉刷新
@property (nonatomic, assign) BOOL showRefreshHeader;
/// 是否显示上拉刷新
@property (nonatomic, assign) BOOL showRefreshFooter;
/// 注册cell
- (void)registerCell;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Controller/SAMTradeRecordDetailController.h | <gh_stars>0
//
// SAMTradeRecordDetailController.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
交易记录详情页
*/
#import "SAMBaseTableViewController.h"
@class SAMTradeRecordListModel;
NS_ASSUME_NONNULL_BEGIN
@interface SAMTradeRecordDetailController : SAMBaseTableViewController
+ (instancetype)pushFrom:(UIViewController *)fromVC
tradeInfo:(SAMTradeRecordListModel *)tradeInfo
explorerUrl:(NSString *)explorerUrl;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/DeviceInfo/SAMDeviceInfo.h | <filename>SamosWallet/Util/DeviceInfo/SAMDeviceInfo.h<gh_stars>0
//
// SAMDeviceInfo.h
// XB
//
// Created by zys on 2017/8/23.
// Copyright © 2017年 zys. All rights reserved.
//
/**
获取系统设备信息
*/
#import <Foundation/Foundation.h>
@interface SAMDeviceInfo : NSObject
/**
是否是iPhoneX系列
@return 是否是
*/
+ (BOOL)isiPhoneXSeries;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Model/SAMCoinBalanceInfo.h | //
// SAMCoinBalanceInfo.h
// SamosWallet
//
// Created by jtt on 2018/11/19.
// Copyright © 2018年 zys. All rights reserved.
//
/**
币种余额数据:包括余额和币时
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMCoinBalanceInfo : NSObject
/// 余额
@property (nonatomic, assign) CGFloat balance;
/// 币时
@property (nonatomic, assign) NSInteger hours;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMHomeMenuHeaderView.h | //
// SAMHomeMenuHeaderView.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
首页-菜单-header
*/
#import <UIKit/UIKit.h>
@interface SAMHomeMenuHeaderView : UIView
+ (instancetype)header;
+ (CGFloat)headerHeight;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Category/UIColor+SAMAddition.h | <gh_stars>0
//
// UIColor+SAMAddition.h
// SamosWallet
//
// Created by zys on 2018/8/20.
// Copyright © 2018年 zys. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIColor (SAMAddition)
/// 16进制颜色值
+ (UIColor *)colorFromHexRGB:(NSString *)colorString;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/DB/SAMWalletDB.h | <gh_stars>0
//
// SAMWalletDB.h
// SamosWallet
//
// Created by zys on 2018/11/10.
// Copyright © 2018 zys. All rights reserved.
//
/**
数据库操作类:存储钱包信息
*/
#import <Foundation/Foundation.h>
@class SAMWalletInfo;
@class SAMTokenInfo;
@class SAMCoinRateInfo;
@class SAMWalletTokenInfo;
//xxl 0.0.2 for lock the tokens
@class LockTokenInfo;
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletDB : NSObject
#pragma mark - pwd
/// 存储密码
+ (void)savePwd:(NSString *)pwd;
/// 获取密码
+ (NSString *)fetchPwd;
#pragma mark - wallet info
/// 获取所有钱包数据
+ (NSArray <SAMWalletInfo *> *)fetchAllWallets;
/// 获取当前钱包
+ (SAMWalletInfo *)fetchCurWallet;
/// 根据钱包名获取一个钱包
+ (SAMWalletInfo *)fetchWallet:(NSString *)walletName;
/// 存储一个钱包数据
+ (BOOL)saveWalletInfo:(SAMWalletInfo *)info;
/// 更新一个钱包数据
+ (BOOL)updateWalletInfo:(SAMWalletInfo *)info withOldWalletName:(NSString *)oldWalletName;
/// 选中一个钱包
+ (void)selectWallet:(NSString *)walletName;
/// 删除一个钱包
+ (BOOL)removeWallet:(NSString *)walletName;
#pragma mark - token info
/// 获取所有token数据(不包含walletID)
+ (NSArray <SAMTokenInfo *> *)fetchAllTokens;
/// 存储或更新一个币种数据(不包含walletID)
+ (BOOL)saveToken:(SAMTokenInfo *)token;
/// 获取一个token
+ (SAMTokenInfo *)fetchToken:(NSString *)token;
/// 存储默认token
+ (void)saveDefaultToken:(NSString *)token;
/// 获取默认token
+ (SAMTokenInfo *)fetchDefaultToken;
#pragma mark - wallet token info
/// 获取某一钱包下的所有token数据
+ (NSArray <SAMWalletTokenInfo *> *)fetchAllWalletTokensWithWalletName:(NSString *)walletName;
/// 获取某一个钱包下的一个特定token
+ (SAMWalletTokenInfo *)fetchWalletToken:(NSString *)token fromWallet:(NSString *)walletName;
/// 根据钱包id获取一个walletToken
+ (SAMWalletTokenInfo *)fetchWalletTokenWithWalletID:(NSString *)walletID;
/// 存储或更新一个币种数据(包含walletID和walletName)
+ (BOOL)saveWalletToken:(SAMWalletTokenInfo *)token;
/// 从钱包下移除一个币种
+ (BOOL)removeWalletToken:(NSString *)walletID;
/// 删除一个钱包下的所有币种
+ (BOOL)removeAllWalletTokens:(NSString *)walletName;
#pragma mark - 货币比率
/// 存储所有货币比率
+ (void)saveAllRates:(NSArray <SAMCoinRateInfo *> *)rates;
/// 获取所有货币比率
+ (NSArray <SAMCoinRateInfo *> *)fetchAllCoinRates;
/// 获取某一货币比率
+ (SAMCoinRateInfo *)rateForCoin:(NSString *)token;
/// 存储单一货币比率
+ (void)saveRate:(SAMCoinRateInfo *)rate;
#pragma mark - 显示单位:美元/人民币
/// 获取当前的币种单位
+ (NSString *)fetchCurCoinUnit;
/// 存储当前币种单位
+ (void)saveCurCoinUnit:(NSString *)unit;
/// 保存锁币信息
+ (BOOL)saveLockToken:(LockTokenInfo *)lockToken;
/// 判断是是否锁币
+ (BOOL)isTokenLocked:(NSString *)walletName;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | Pods/BGFMDB/BGFMDB/libs/BG/BGTool.h | //
// BGTool.h
// BGFMDB
//
// Created by huangzhibiao on 17/2/16.
// Copyright © 2017年 Biao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#define bg_completeBlock(obj) !complete?:complete(obj);
#define BG @"BG_"
#define bg_tableNameKey @"bg_tableName"
#define bg_rowid @"rowid"
#define bg_uniqueKeysSelector NSSelectorFromString(@"bg_uniqueKeys")
#define bg_ignoreKeysSelector NSSelectorFromString(@"bg_ignoreKeys")
#define bg_unionPrimaryKeysSelector NSSelectorFromString(@"bg_unionPrimaryKeys")
typedef NS_ENUM(NSInteger,bg_getModelInfoType){//过滤数据类型
bg_ModelInfoInsert,//插入过滤
bg_ModelInfoSingleUpdate,//单条更新过滤
bg_ModelInfoArrayUpdate,//批量更新过滤
bg_ModelInfoNone//无过滤
};
@interface BGTool : NSObject
/**
json字符转json格式数据 .
*/
+(id _Nonnull)jsonWithString:(NSString* _Nonnull)jsonString;
/**
字典转json字符 .
*/
+(NSString* _Nonnull)dataToJson:(id _Nonnull)data;
/**
根据类获取变量名列表
@onlyKey YES:紧紧返回key,NO:在key后面添加type.
*/
+(NSArray* _Nonnull)getClassIvarList:(__unsafe_unretained _Nonnull Class)cla Object:(_Nullable id)object onlyKey:(BOOL)onlyKey;
/**
判断系统类型与否
*/
+(BOOL)isKindOfSystemType:(NSString* _Nonnull)type;
/**
抽取封装条件数组处理函数.
*/
+(NSArray* _Nonnull)where:(NSArray* _Nonnull)where;
/**
封装like语句获取函数
*/
+(NSString* _Nonnull)getLikeWithKeyPathAndValues:(NSArray* _Nonnull)keyPathValues where:(BOOL)where;
/**
判断是不是主键.
*/
+(BOOL)isUniqueKey:(NSString* _Nonnull)uniqueKey with:(NSString* _Nonnull)param;
/**
判断并获取字段类型.
*/
+(NSString* _Nonnull)keyAndType:(NSString* _Nonnull)param;
/**
根据类属性类型返回数据库存储类型.
*/
+(NSString* _Nonnull)getSqlType:(NSString* _Nonnull)type;
//NSDate转字符串,格式: yyyy-MM-dd HH:mm:ss
+(NSString* _Nonnull)stringWithDate:(NSDate* _Nonnull)date;
/**
根据传入的对象获取表名.
*/
+(NSString* _Nonnull)getTableNameWithObject:(id _Nonnull)object;
/**
根据类属性值和属性类型返回数据库存储的值.
@value 数值.
@type 数组value的类型.
@encode YES:编码 , NO:解码.
*/
+(id _Nonnull)getSqlValue:(id _Nonnull)value type:(NSString* _Nonnull)type encode:(BOOL)encode;
/**
转换从数据库中读取出来的数据.
@tableName 表名(即类名).
@array 传入要转换的数组数据.
*/
+(NSArray* _Nonnull)tansformDataFromSqlDataWithTableName:(NSString* _Nonnull)tableName class:(__unsafe_unretained _Nonnull Class)cla array:(NSArray* _Nonnull)array;
/**
转换从数据库中读取出来的数据.
@claName 类名.
@valueDict 传入要转换的字典数据.
*/
+(id _Nonnull)objectFromJsonStringWithTableName:(NSString* _Nonnull)tablename class:(__unsafe_unretained _Nonnull Class)cla valueDict:(NSDictionary* _Nonnull)valueDict;
/**
字典或json格式字符转模型用的处理函数.
*/
+(id _Nonnull)bg_objectWithClass:(__unsafe_unretained _Nonnull Class)cla value:(id _Nonnull)value;
/**
模型转字典.
*/
+(NSMutableDictionary* _Nonnull)bg_keyValuesWithObject:(id _Nonnull)object ignoredKeys:(NSArray* _Nullable)ignoredKeys;
/**
判断并执行类方法.
*/
+(id _Nonnull)executeSelector:(SEL _Nonnull)selector forClass:(__unsafe_unretained _Nonnull Class)cla;
/**
判断并执行对象方法.
*/
+(id _Nonnull)executeSelector:(SEL _Nonnull)selector forObject:(id _Nonnull)object;
/**
根据对象获取要更新或插入的字典.
*/
+(NSDictionary* _Nonnull)getDictWithObject:(id _Nonnull)object ignoredKeys:(NSArray* const _Nullable)ignoredKeys filtModelInfoType:(bg_getModelInfoType)filtModelInfoType;
/**
过滤建表的key.
*/
+(NSArray* _Nonnull)bg_filtCreateKeys:(NSArray* _Nonnull)createkeys ignoredkeys:(NSArray* _Nonnull)ignoredkeys;
/**
如果表格不存在就新建.
*/
+(BOOL)ifNotExistWillCreateTableWithObject:(id _Nonnull)object ignoredKeys:(NSArray* const _Nullable)ignoredKeys;
/**
整形判断
*/
+ (BOOL)isPureInt:(NSString* _Nonnull)string;
/**
浮点形判断
*/
+ (BOOL)isPureFloat:(NSString* _Nonnull)string;
/**
NSUserDefaults封装使用函数.
*/
+(BOOL)getBoolWithKey:(NSString* _Nonnull)key;
+(void)setBoolWithKey:(NSString* _Nonnull)key value:(BOOL)value;
+(NSString* _Nonnull)getStringWithKey:(NSString* _Nonnull)key;
+(void)setStringWithKey:(NSString* _Nonnull)key value:(NSString* _Nonnull)value;
+(NSInteger)getIntegerWithKey:(NSString* _Nonnull)key;
+(void)setIntegerWithKey:(NSString* _Nonnull)key value:(NSInteger)value;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/Controller/SAMVerifyWordsController.h | //
// SAMVerifyWordsController.h
// SamosWallet
//
// Created by zys on 2018/9/2.
// Copyright © 2018年 zys. All rights reserved.
//
/**
验证助记词
*/
#import "SAMBaseTableViewController.h"
@interface SAMVerifyWordsController : SAMBaseTableViewController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Root/View/SAMWalletPasswordPopView.h | //
// SAMWalletPasswordPopView.h
// SamosWallet
//
// Created by zys on 2018/9/8.
// Copyright © 2018年 zys. All rights reserved.
//
/**
钱包密码弹窗
*/
#import "SAMPopupView.h"
typedef void(^SAMPwdConfirmBlock)(NSString *pwd, NSString *pwdTip);
@interface SAMWalletPasswordPopView : SAMPopupView
/// 确定按钮回调
@property (nonatomic, copy) SAMPwdConfirmBlock confirmBlock;
/// 是否应该弹窗
+ (BOOL)shouldShow;
/// 保存密码
+ (void)savePwd:(NSString *)pwd;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/AppDelegate/SAMAppDelegate.h | <gh_stars>0
//
// SAMAppDelegate.h
// SamosWallet
//
// Created by zys on 2018/8/18.
// Copyright © 2018年 zys. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SAMAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Network/SAMNetworkConfig.h | <filename>SamosWallet/Util/Network/SAMNetworkConfig.h
//
// SAMNetworkConfig.h
// XB
//
// Created by zys on 2018/7/3.
// Copyright © 2018年 XiaoBu. All rights reserved.
//
/**
网络配置类:主要处理公共参数、请求头、baseURL等
*/
#import <Foundation/Foundation.h>
@interface SAMNetworkConfig : NSObject
/// 基础urlstr
@property (class, nonatomic, copy, readonly) NSString *baseURLString;
/// 请求超时时间
@property (class, nonatomic, assign) NSTimeInterval timeoutInterval;
/// 请求头
@property (class, nonatomic, strong, readonly) NSDictionary *httpHeaders;
/// 请求支持的序列化格式
@property (class, nonatomic, strong, readonly) NSSet <NSString *> *contentTypes;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/View/SAMWalletIconListItem.h | //
// SAMWalletIconListItem.h
// SamosWallet
//
// Created by zys on 2018/8/31.
// Copyright © 2018年 zys. All rights reserved.
//
/**
创建钱包-钱包icon item
*/
#import <UIKit/UIKit.h>
@interface SAMWalletIconListItem : UICollectionViewCell
+ (void)registerWith:(UICollectionView *)collectionView;
+ (CGSize)itemSize;
+ (UIEdgeInsets)sectionInsets;
+ (CGFloat)hSpacing;
+ (CGFloat)vSpacing;
- (void)setCellWithIconName:(NSString *)iconName;
extern NSString *const SAMWalletIconListItemID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Controller/SAMHomeWalletController.h | <gh_stars>0
//
// SAMHomeWalletController.h
// SamosWallet
//
// Created by zys on 2018/8/20.
// Copyright © 2018年 zys. All rights reserved.
//
/**
首页 - 钱包页
*/
#import "SAMBaseTableViewController.h"
@interface SAMHomeWalletController : SAMBaseTableViewController
/// 左侧菜单点击
@property (nonatomic, copy) SAMVoidBlock menuClickBlock;
/// 当前钱包
@property (nonatomic, strong) SAMWalletInfo *curWallet;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Trade/View/SAMReceiveBottomBar.h | //
// SAMReceiveBottomBar.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
交易记录页bottombar
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMReceiveBottomBar : UIView
@property (nonatomic, copy) SAMVoidBlock samCopyBlock;
@property (nonatomic, copy) SAMVoidBlock saveBlock;
+ (instancetype)bottomBar;
+ (CGFloat)barHeight;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Tool/SAMControllerTool.h | <gh_stars>0
//
// SAMControllerTool.h
// SamosWallet
//
// Created by zys on 2018/8/29.
// Copyright © 2018年 zys. All rights reserved.
//
/**
项目Controller相关的方法
*/
#import <Foundation/Foundation.h>
@interface SAMControllerTool : NSObject
/**
设置root vc:
1.第一次安装,显示蓝色管理钱包页(设置钱包密码弹窗)
2.创建或导入钱包后,第一次显示引导页
3.设置了密码,创建或导入钱包后,显示tabvc
*/
+ (void)chooseRootVC;
/**
通过scheme跳转
@param scheme 跳转地址
*/
+ (void)chooseVCWithScheme:(NSString *)scheme;
/**
获取当前vc
@return 当前显示的vc
*/
+ (UIViewController *)currentVC;
/**
显示vc
@param vc 要显示的vc
*/
+ (void)showVC:(UIViewController *)vc;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/DB/SAMWalletInfo.h | //
// SAMWalletInfo.h
// SamosWallet
//
// Created by zys on 2018/11/10.
// Copyright © 2018 zys. All rights reserved.
//
/**
钱包信息:存储在数据库的数据(数据库表)
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletInfo : NSObject
/// 钱包名字
@property (nonatomic, copy) NSString *walletName;
/// 钱包icon
@property (nonatomic, copy) NSString *walletIcon;
/// 是否选中(是否是当前的钱包)
@property (nonatomic, assign) BOOL isSelected;
/// 余额(不存入数据库表)
@property (nonatomic, assign) CGFloat balance;
/// 转账地址
@property (nonatomic, copy) NSString *address;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Widget/ActionSheet/SAMActionSheet.h | <reponame>haichainLab/wallet-ios<filename>SamosWallet/Widget/ActionSheet/SAMActionSheet.h
//
// SAMActionSheet.h
// SAM
//
// Created by zys on 2017/7/1.
// Copyright © 2017年 XiaoBu. All rights reserved.
//
/**
项目里的自定义sheet的基类
*/
#import <UIKit/UIKit.h>
@interface SAMActionSheet : UIView
/// popview(self)'s size
@property (nonatomic, assign) CGSize orgSize;
/// animation duration
@property (nonatomic, assign) NSTimeInterval animationDuration;
/// show frame
@property (nonatomic, assign, readonly) CGRect showFrame;
/// dismiss回调
@property (nonatomic, copy) SAMVoidBlock dismissBlock;
- (void)setupSubviews;
- (void)show;
- (void)dismiss;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Root/Controller/SAMLoadingViewController.h | <reponame>haichainLab/wallet-ios
//
// SAMLoadingViewController.h
// SamosWallet
//
// Created by zys on 2019/2/11.
// Copyright © 2019 Samos. All rights reserved.
//
/**
开屏页倒计时
*/
#import "SAMBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMLoadingViewController : SAMBaseViewController
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/View/SAMWalletIconItem.h | //
// SAMWalletIconItem.h
// SamosWallet
//
// Created by zys on 2018/8/31.
// Copyright © 2018年 zys. All rights reserved.
//
/**
创建钱包-钱包icon item
*/
#import <UIKit/UIKit.h>
@interface SAMWalletIconItem : UICollectionViewCell
/// icon
@property (nonatomic, copy) NSString *walletIocn;
+ (void)registerWith:(UICollectionView *)collectionView;
+ (CGSize)itemSize;
+ (UIEdgeInsets)sectionInsets;
- (void)setCellWithIconName:(NSString *)iconName;
extern NSString *const SAMWalletIconItemID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMHomeWalletCoinCell.h | //
// SAMHomeWalletCoinCell.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
首页-钱包-币种列表cell
*/
#import <UIKit/UIKit.h>
@class SAMWalletTokenInfo;
@interface SAMHomeWalletCoinCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithModel:(SAMWalletTokenInfo *)model;
extern NSString *const SAMHomeWalletCoinCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Tool/HaiProtocolTool.h | //
// HaiProtocol.h
// SamosWallet
//
// Created by <NAME> on 2019/11/3.
// Copyright © 2019年 Hai. All rights reserved.
//
/**
工具类方法
*/
//xxl 0.0.0
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface HaiProtocolTool : NSObject
+ (void)dealWithUrl:(NSURL *)url;
+ (void)httpGetWithUrl:(NSString *)strUrl;
/**
json字符转json格式数据 .
*/
+(id _Nonnull)jsonWithString:(NSString* _Nonnull)jsonString;
+(void)clearCallURLInfo;
+(void)strCallBackURL:(NSString *) str;
+(void)strOutTradeNo:(NSString *) str;
+(void)strCallURL:(NSString *) strURL;
+(void)bIsFromMoble:(BOOL ) isFromMoble;
/**
获取网络状态
@return 返回回调URL
*/
+(NSString *)getCallBackURL;
+(NSString *)getOutTradeNo;
+(NSString *)getCallURL;
+(BOOL)getIsFromMoble;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Wallet/SAMWalletAddressInfo.h | <reponame>haichainLab/wallet-ios<filename>SamosWallet/Util/Wallet/SAMWalletAddressInfo.h<gh_stars>0
//
// SAMWalletAddressInfo.h
// SamosWallet
//
// Created by zys on 2018/11/24.
// Copyright © 2018 zys. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletAddressInfo : NSObject
/// 字符串数组
@property (nonatomic, strong) NSArray *addresses;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMTradeBottomBar.h | //
// SAMTradeBottomBar.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
转入、转出bar
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMTradeBottomBar : UIView
@property (nonatomic, copy) SAMVoidBlock outBtnClickBlock;
@property (nonatomic, copy) SAMVoidBlock inBtnClickBlock;
+ (instancetype)bottomBar;
+ (CGFloat)barHeight;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Base/Controller/SAMBaseViewController.h | <filename>SamosWallet/Class/Base/Controller/SAMBaseViewController.h
//
// SAMBaseViewController.h
// SamosWallet
//
// Created by zys on 2018/8/18.
// Copyright © 2018年 zys. All rights reserved.
//
/**
项目里所有Controller基类
*/
#import <UIKit/UIKit.h>
#import "SAMNavigationBar.h"
@interface SAMBaseViewController : UIViewController
/// 是否显示导航栏
@property (nonatomic, assign) BOOL isShowNavBar;
/// 导航栏背景色(透明或者白色)
@property (nonatomic, assign) SAMNavigationBarBGColor navBGColor;
/// 导航栏
@property (nonatomic, strong, readonly) SAMNavigationBar *sam_navigationBar;
- (void)setupVariables;
- (void)setupSubviews;
- (void)showBackBtn:(BOOL)show;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Trade/View/SAMSendDetailSheet.h | //
// SAMSendDetailSheet.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
#import "SAMActionSheet.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMSendDetailSheet : SAMActionSheet
@property (nonatomic, copy) SAMVoidBlock confirmBlock;
+ (instancetype)sheet;
- (void)setSheetWithToken:(NSString *)token
address:(NSString *)address
num:(NSString *)num;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Path/SAMPathManager.h | //
// SAMPathManager.h
// SAM
//
// Created by zys on 2017/7/25.
// Copyright © 2017年 Xiaobu. All rights reserved.
//
/**
文件目录管理类
*/
#import <Foundation/Foundation.h>
@interface SAMPathManager : NSObject
#pragma mark - 获取沙盒目录
/// get documents directory
+ (NSString *)docPath;
/// get temp directory
+ (NSString *)tempPath;
/// cache path
+ (NSString *)cachePath;
/// lib path
+ (NSString *)libraryPath;
#pragma mark - 创建、删除目录,获取目录大小
/// create directory
+ (BOOL)createDirectory:(NSString *)directory;
/// remove directory
+ (BOOL)removeDirectory:(NSString *)directory;
/// get file or directory's size(unit: B)
+ (unsigned long long)sizeAtPath:(NSString *)path;
#pragma mark - 创建、删除文件
/// create file at path
+ (BOOL)createFileAtPath:(NSString *)path;
/// delete file at path
+ (BOOL)deleteFileAtPath:(NSString *)path;
/// delete file at path
+ (BOOL)deleteFileByURL:(NSURL *)url;
#pragma mark - 钱包目录
+ (NSString *)walletDirectory;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Trade/Controller/SAMSendViewController.h | //
// SAMSendViewController.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
转出
*/
#import "SAMBaseTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMSendViewController : SAMBaseTableViewController
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Me/Controller/SAMMeController.h | <gh_stars>0
//
// SAMMeController.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
个人中心页
*/
#import "SAMBaseTableViewController.h"
@interface SAMMeController : SAMBaseTableViewController
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Base/View/SAMNavigationBar.h | //
// SAMNavigationBar.h
// SAM
//
// Created by zys on 2017/7/17.
// Copyright © 2017年 XiaoBu. All rights reserved.
//
/**
导航控制栏
*/
#import <UIKit/UIKit.h>
/// 导航栏背景色类型
typedef NS_ENUM(NSInteger, SAMNavigationBarBGColor) {
SAMNavigationBarBGColorWhite = 0,
SAMNavigationBarBGColorClear,
SAMNavigationBarBGColorBlue,
};
@interface SAMNavigationBar : UIView
/// 标题Label
@property (nonatomic, strong, readonly) UILabel *titleLabel;
/// 返回图片
@property (nonatomic, strong, readonly) UIImageView *backImageView;
/// title
@property (nonatomic, copy) NSString *title;
/// bar背景颜色
@property (nonatomic, assign) SAMNavigationBarBGColor BGColor;
/// 返回按钮响应
@property (nonatomic, copy) SAMVoidBlock backBlock;
/// 背景填充色(BGColor为clear时会用到)
@property (nonatomic, strong) UIColor *BGFillColor;
/// 背景色的透明度
@property (nonatomic, assign) CGFloat BGAlpha;
/// 隐藏返回按钮
- (void)showBackBtn:(BOOL)show;
/// 显示 / 隐藏底部黑线
- (void)showBottomLine:(BOOL)show;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMHomeMenuToolCell.h | //
// SAMHomeMenuToolCell.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
首页-菜单-工具cell:扫描二维码、创建钱包、管理钱包
*/
#import <UIKit/UIKit.h>
@interface SAMHomeMenuToolCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithIconName:(NSString *)iconName
title:(NSString *)title;
extern NSString *const SAMHomeMenuToolCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMHomeWalletHeaderView.h | <filename>SamosWallet/Class/Home/View/SAMHomeWalletHeaderView.h
//
// SAMHomeWalletHeaderView.h
// SamosWallet
//
// Created by zys on 2018/8/20.
// Copyright © 2018年 zys. All rights reserved.
//
/**
首页-钱包-蓝色header
*/
#import <UIKit/UIKit.h>
@interface SAMHomeWalletHeaderView : UIView
+ (instancetype)header;
+ (CGFloat)headerHeight;
- (void)setHeaderWithModel:(SAMWalletInfo *)info;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Token/SAMTokenNode.h | <gh_stars>0
//
// SAMTokenNode.h
// SamosWallet
//
// Created by zys on 2018/8/19.
// Copyright © 2018年 zys. All rights reserved.
//
/**
Token节点数据
*/
#import <Foundation/Foundation.h>
/// token节点
@interface SAMTokenNode : NSObject
/// token array
@property (nonatomic, strong) NSArray *tokens;
/// web url
@property (nonatomic, copy) NSString *weburl;
/// 默认的Token,比如SAMO
@property (nonatomic, copy) NSString *defaultToken;
/// 配置的版本号
@property (nonatomic, copy) NSString *version;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Root/Controller/SAMGuideViewController.h | <gh_stars>0
//
// SAMGuideViewController.h
// SamosWallet
//
// Created by zys on 2018/8/28.
// Copyright © 2018年 zys. All rights reserved.
//
/**
引导页
*/
#import "SAMBaseViewController.h"
@interface SAMGuideViewController : SAMBaseViewController
/// dismiss回调
@property (nonatomic, copy) SAMVoidBlock dismissBlock;
+ (BOOL)shouldShow;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Const/SAMConst.h | //
// SAMConst.h
// SamosWallet
//
// Created by zys on 2018/8/19.
// Copyright © 2018年 zys. All rights reserved.
//
/**
全局宏定义
*/
#import <Foundation/Foundation.h>
@interface SAMConst : NSObject
#pragma mark - common
/// 弱引用
#define SAMWeakSelf __weak typeof(self) weakSelf = self;
/// 参数、返回值均为空的block
typedef void (^SAMVoidBlock) (void);
/// 参数为布尔值、返回值为空的block
typedef void (^SAMBOOLBlock) (BOOL flag);
/// App版本
#define SAM_APP_VERSION [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
#pragma mark - 打印
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...)
#endif
#pragma mark - Language
#define SAM_LOCALIZED(key) [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"AppLanguage"]] ofType:@"lproj"]] localizedStringForKey:(key) value:nil table:@"SAMLanguage"]
#pragma mark - NSUserDefaults key
/// ud
#define SAM_UD [NSUserDefaults standardUserDefaults]
/// 语言key
#define SAM_UD_KEY_APP_LANGUAGE @"AppLanguage"
#pragma mark - Screen
/// 屏幕尺寸
#define SAM_SCREEN_BOUNDS ([UIScreen mainScreen].bounds)
/// 屏幕宽度
#define SAM_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
/// 屏幕高度
#define SAM_SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
/// tabBar h
#define SAM_TABBAR_HEIGHT 49.f
/// status bar h
#define SAM_STATUSBAR_HEIGHT ([UIApplication sharedApplication].statusBarHidden ? ([SAMDeviceInfo isiPhoneXSeries] ? 44.f : 20.f) : CGRectGetHeight([UIApplication sharedApplication].statusBarFrame))
/// nav h
#define SAM_NAV_HEIGHT (SAM_STATUSBAR_HEIGHT + 44.f)
/// tableView底部距离,iPhoneX为-34,其余为0
#define SAM_TABLE_BOTTOM ([SAMDeviceInfo isiPhoneXSeries] ? -34.f : 0.f)
#pragma mark - color
#define SAM_BLUE_COLOR ([UIColor colorFromHexRGB:@"1833C7"])
#define SAM_DEFAULT_FONT_COLOR ([UIColor colorFromHexRGB:@"333333"])
#define SAM_GRAY_COLOR ([UIColor colorFromHexRGB:@"999999"])
/// haicoin协议类型
#define HAI_HOST_LOCK_WALLET @"lockWallet"
#define HAI_HOST_GO_BACK @"goBack"
// xxl 0.0.4 vote
#define HAI_HOST_VOTE @"vote"
#define HAI_PARAM_COIN_NAME @"coinname"
#define HAI_PARAM_WALLET_NAME @"walletname"
#define HAI_PARAM_AMOUNT @"amount"
#define HAI_PARAM_PERIOD_TYPE @"periodtype"
#define HAI_PARAM_RECEIVING_ADDRESS @"receivingaddress"
#define HAI_PARAM_RETURN_URL @"returnurl"
#define HAI_PARAM_CALLBACK_URL @"callbackurl"
#define HAI_PARAM_OUT_TRADE_NO @"outtradeno"
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/Controller/SAMWalletDetailController.h | //
// SAMWalletDetailController.h
// SamosWallet
//
// Created by zys on 2018/12/2.
// Copyright © 2018 zys. All rights reserved.
//
/**
钱包详情页
*/
#import "SAMBaseTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletDetailController : SAMBaseTableViewController
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/DB/LockTokenInfo.h | //
// LockCoinInfo.h
// SamosWallet
//
// Created by <NAME> on 2019/11/9.
// Copyright © 2019年 Samos. All rights reserved.
//
/**
添加锁币数据库表
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface LockTokenInfo : NSObject
/// 钱包名字
@property (nonatomic, copy) NSString *walletName;
/// 锁币类型
@property (nonatomic, assign) NSInteger periodType;
/// 开始时间
@property (nonatomic, assign) NSInteger startTimestamp;
/// 结束时间
@property (nonatomic, assign) NSInteger endTimestamp;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Model/SAMTradeRecordListModel.h | //
// SAMTradeRecordListModel.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
交易列表数据
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMTradeRecordListModel : NSObject
/// 状态: true/false
@property (nonatomic, assign) BOOL status;
/// 交易时间戳
@property (nonatomic, assign) NSInteger time;
/// 交易id
@property (nonatomic, copy) NSString *txid;
/// 交易数量: +100.0
@property (nonatomic, copy) NSString *delta;
/// 接受方地址
@property (nonatomic, copy) NSString *inputs;
/// 发送方地址
@property (nonatomic, copy) NSString *outputs;
/// token
@property (nonatomic, copy) NSString *token;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Tool/SAMTool.h | <gh_stars>0
//
// SAMTool.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
工具类方法
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMTool : NSObject
/// 保存图片成功回调
@property (nonatomic, copy) SAMVoidBlock savePhotoCompleteBlock;
/// 保存图片
- (void)savePhotoToAlbum:(UIImage *)image
completion:(SAMVoidBlock)completion;
/// 时间戳转换 yyyy-MM-dd HH:mm:dd
+ (NSString *)formatTimeStamp:(NSInteger)timeStamp;
/// 生成二维码
+ (UIImage *)genQRCodeWithString:(NSString *)qrStr;
/// 复制到剪切板
+ (void)copyToPasteboadrd:(NSString *)text;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Network/SAMNetwork.h | //
// SAMNetwork.h
// XB
//
// Created by zys on 2018/7/3.
// Copyright © 2018年 XiaoBu. All rights reserved.
//
/**
网络请求管理类:此类中一律提供类方法供调用
*/
#import <Foundation/Foundation.h>
@interface SAMNetwork : NSObject
/// GET请求
+ (void)GETWithURLStr:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(id responseObject))successBlock
failure:(void (^)(NSError *error))failBlock;
/// POST请求
+ (void)POSTWithURLStr:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(id responseObject))successBlock
failure:(void (^)(NSError *error))failBlock;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMHomeMenuWalletCell.h | <reponame>haichainLab/wallet-ios
//
// SAMHomeMenuWalletCell.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
首页-菜单-钱包cell
*/
#import <UIKit/UIKit.h>
@interface SAMHomeMenuWalletCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithModel:(SAMWalletInfo *)model;
extern NSString *const SAMHomeMenuWalletCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Trade/View/SAMSendInputPwdSheet.h | <reponame>haichainLab/wallet-ios<filename>SamosWallet/Class/Trade/View/SAMSendInputPwdSheet.h
//
// SAMSendInputPwdSheet.h
// SamosWallet
//
// Created by zys on 2018/12/2.
// Copyright © 2018 zys. All rights reserved.
//
#import "SAMActionSheet.h"
typedef void(^SAMConfirmPwdBlock)(NSString *pwd);
NS_ASSUME_NONNULL_BEGIN
@interface SAMSendInputPwdSheet : SAMActionSheet
@property (nonatomic, copy) SAMConfirmPwdBlock confirmBlock;
+ (instancetype)sheet;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/DB/SAMDBConst.h | <reponame>haichainLab/wallet-ios<gh_stars>0
//
// SAMDBConst.h
// SamosWallet
//
// Created by zys on 2018/11/11.
// Copyright © 2018 zys. All rights reserved.
//
/**
数据库常量定义:一共定义了4张表
1.钱包数据库表(存储本设备包含的钱包)
2.支持的token数据库表(此表中不包含walletID、walletName)
3.添加的钱包数据库表(此表包含walletID、walletName、token)
4.币种的兑换比率
*/
#ifndef SAMDBConst_h
#define SAMDBConst_h
#pragma mark - key
/// 密码key
#define SAM_PWD_KEY @"SAM_PASS_WORD"
/// 默认token key
#define SAM_DEFAULT_TOKEN_KEY @"sam_default_token"
/// 币种单位 key
#define SAM_CUR_COIN_UNIT_KEY @"sam_cur_coin_unit"
#pragma mark - DB name / table name
/// 数据库名字
#define SAM_DB_NAME @"sam_wallet_data"
/// 钱包数据库表名字
#define SAM_DB_WALLET_TABLE @"sam_wallet_table"
/// token数据库表名字
#define SAM_DB_TOKEN_TABLE @"sam_token_table"
/// 添加的币种数据库表
#define SAM_DB_WALLET_TOKEN_TABLE @"sam_wallet_token_table"
/// 货币比率数据库表名
#define SAM_DB_RATE_TABLE @"sam_rate_table"
//xxl 0.0.2 锁币数据库表名
#define SAM_DB_LOCK_TABLE @"hai_lock_table"
#endif /* SAMDBConst_h */
|
haichainLab/wallet-ios | SamosWallet/Util/AppConfig/SAMAppConfig.h | <reponame>haichainLab/wallet-ios
//
// SAMAppConfig.h
// SamosWallet
//
// Created by zys on 2018/8/19.
// Copyright © 2018年 zys. All rights reserved.
//
/**
App配置类
*/
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, SAMLanguageType) {
SAMLanguageTypeCN = 0, // 中文
SAMLanguageTypeEN, // 英文
};
@interface SAMAppConfig : NSObject
/// 全局设置
+ (void)globalSettings;
/// 初始化语言
+ (void)setupAppLanguage;
/// 设置语言:en / zh-Hans
+ (void)setAppLanguage:(SAMLanguageType)languageType;
/// 获取语言类别
+ (SAMLanguageType)fetchLanguageType;
/// 初始化钱包
+ (void)walletInitCompletion:(SAMBOOLBlock)completion;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Notification/SAMNotificationConst.h | <filename>SamosWallet/Util/Notification/SAMNotificationConst.h
//
// SAMNotificationConst.h
// SamosWallet
//
// Created by jtt on 2018/11/19.
// Copyright © 2018年 zys. All rights reserved.
//
/**
存储通知常量
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMNotificationConst : NSObject
/// 初始化成功通知
extern NSString *const SAMNotificationInitSuccess;
/// 刷新tabbBaf首页
extern NSString *const SAMNotificationRefreshTabBarHome;
/// 刷新交易列表页
extern NSString *const SAMNotificationRefreshTradeRecordList;
/// 刷新管理钱包页
extern NSString *const SAMNotificationRefreshManageWalletPage;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Controller/SAMAddNewCoinController.h | //
// SAMAddNewCoinController.h
// SamosWallet
//
// Created by jtt on 2018/11/14.
// Copyright © 2018年 zys. All rights reserved.
//
/**
添加新资产
*/
#import "SAMBaseTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMAddNewCoinController : SAMBaseTableViewController
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMAddNewCoinCell.h | <reponame>haichainLab/wallet-ios
//
// SAMAddNewCoinCell.h
// SamosWallet
//
// Created by jtt on 2018/11/14.
// Copyright © 2018年 zys. All rights reserved.
//
/**
添加新资产cell
*/
#import <UIKit/UIKit.h>
@class SAMTokenInfo;
typedef void(^SAMCoinSelectStatusChanged)(BOOL isSelected);
NS_ASSUME_NONNULL_BEGIN
@interface SAMAddNewCoinCell : UITableViewCell
/// 开关变化
@property (nonatomic, copy) SAMCoinSelectStatusChanged selectStatusBlock;
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithModel:(SAMTokenInfo *)model
defaultToken:(NSString *)defaultToken
isSelected:(BOOL)isSelected;
extern NSString *const SAMAddNewCoinCellID;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Controller/HaiExplorerController.h | <gh_stars>0
//
// HaiExplorer.h
// HaiWallet
//
// Created by <NAME> on 2019/10/26.
// Copyright © 2019年 Samos. All rights reserved.
//
#import "SAMBaseViewController.h"
#import <WebKit/WKWebView.h>
#import <WebKit/WebKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HaiExplorerController : SAMBaseViewController
/** 是否显示Nav */
@property (nonatomic,assign) BOOL isNavHidden;
/**
加载纯外部链接网页
@param string URL地址
*/
- (void)loadWebURLSring:(NSString *)string;
/**
加载本地网页
@param string 本地HTML文件名
*/
- (void)loadWebHTMLSring:(NSString *)string;
/**
加载外部链接POST请求(注意检查 XFWKJSPOST.html 文件是否存在 )
postData请求块 注意格式:@"\"username\":\"xxxx\",\"password\":\"<PASSWORD>\""
@param string 需要POST的URL地址
@param postData post请求块
*/
- (void)POSTWebURLSring:(NSString *)string postData:(NSString *)postData;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMCoinTradeRecordListCell.h | //
// SAMCoinTradeRecordListCell.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
币种交易记录列表cell
*/
#import <UIKit/UIKit.h>
@class SAMTradeRecordListModel;
NS_ASSUME_NONNULL_BEGIN
@interface SAMCoinTradeRecordListCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithModel:(SAMTradeRecordListModel *)model;
extern NSString *const SAMCoinTradeRecordListCellID;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/View/SAMSaveWordsAlert.h | //
// SAMSaveWordsAlert.h
// SamosWallet
//
// Created by zys on 2018/9/2.
// Copyright © 2018年 zys. All rights reserved.
//
/**
保存助记词弹窗
*/
#import "SAMPopupView.h"
@interface SAMSaveWordsAlert : SAMPopupView
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Wallet/View/SAMVerifyWordsCell.h | <filename>SamosWallet/Class/Wallet/View/SAMVerifyWordsCell.h
//
// SAMVerifyWordsCell.h
// SamosWallet
//
// Created by zys on 2018/9/2.
// Copyright © 2018年 zys. All rights reserved.
//
/**
验证助记词
*/
#import <UIKit/UIKit.h>
@interface SAMVerifyWordsCell : UITableViewCell
/// 验证助记词
@property (nonatomic, copy) NSString *words;
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
extern NSString *const SAMVerifyWordsCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMSelectUnitSheet.h | //
// SAMSelectUnitSheet.h
// SamosWallet
//
// Created by zys on 2018/8/24.
// Copyright © 2018年 zys. All rights reserved.
//
/**
选择计价单位sheet
*/
#import "SAMActionSheet.h"
@interface SAMSelectUnitSheet : SAMActionSheet
@property (nonatomic, copy) SAMVoidBlock selectBlock;
+ (instancetype)sheet;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/DB/SAMWalletTokenInfo.h | <reponame>haichainLab/wallet-ios
//
// SAMWalletTokenInfo.h
// SamosWallet
//
// Created by jtt on 2018/11/27.
// Copyright © 2018年 zys. All rights reserved.
//
/**
添加币种数据库表
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletTokenInfo : NSObject
/// 币种钱包id
@property (nonatomic, copy) NSString *walletID;
/// 钱包名字
@property (nonatomic, copy) NSString *walletName;
/// 币种token:SAMO
@property (nonatomic, copy) NSString *token;
/// 货币余额
@property (nonatomic, assign) CGFloat balance;
/// 币时
@property (nonatomic, assign) NSInteger hours;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Widget/PopupView/SAMPopupView.h | //
// SAMPopupView.h
// SAM
//
// Created by zys on 2017/5/11.
// Copyright © 2017年 XiaoBu. All rights reserved.
//
/**
项目里所有弹出视图的基类
*/
#import <UIKit/UIKit.h>
#define SAMPopupViewContainerViewTag 1313
@interface SAMPopupView : UIView
/// self的父视图(直接添加在window上的view)
@property (nonatomic, strong, readonly) UIView *containerView;
/// 透明黑色蒙层
@property (nonatomic, strong, readonly) UIView *overlayView;
/// 是否允许弹出动画(缺省为YES)
@property (nonatomic, assign) BOOL allowAnimation;
/// 是否允许点击消失(缺省为YES)
@property (nonatomic, assign) BOOL allowTapGesture;
/// 是否隐藏overlayView,缺省不隐藏
@property (nonatomic, assign) BOOL hideOverlay;
/// 蒙层显示时的透明度,默认0.7
@property (nonatomic, assign) CGFloat overlayAlpha;
/// 监听dismiss事件
@property (nonatomic, copy) SAMVoidBlock dismissBlock;
/**
创建实例,子类实现
@return 子类实例
*/
+ (instancetype)popView;
/**
子类重写,记得调用[super setupVariables];
*/
- (void)setupVariables;
/**
子类重写,记得调用[super setupSubviews];
*/
- (void)setupSubviews;
/**
布局方法,由子类重写来布局视图(主要是self)
注意:调用前,请先调用父类的方法(父类里实现了addSubview),这样子类调用masonry才不会出问题
*/
- (void)placeSubviews;
- (void)show;
- (void)dismiss;
- (void)dismissCompletion:(SAMVoidBlock)completion;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMTradeRecordDetailCell.h | //
// SAMTradeRecordDetailCell.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
#import <UIKit/UIKit.h>
@class SAMTradeRecordListModel;
NS_ASSUME_NONNULL_BEGIN
@interface SAMTradeRecordDetailCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithModel:(id)model explorerUrl:(NSString *)explorerUrl;
extern NSString *const SAMTradeRecordDetailCellID;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMManageWalletBottomView.h | <reponame>haichainLab/wallet-ios
//
// SAMManageWalletBottomView.h
// SamosWallet
//
// Created by zys on 2018/8/30.
// Copyright © 2018年 zys. All rights reserved.
//
/**
管理钱包-底部的菜单view
*/
#import <UIKit/UIKit.h>
@interface SAMManageWalletBottomView : UIView
+ (instancetype)bottomView;
+ (CGFloat)viewHeight;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMMeCell.h | //
// SAMMeCell.h
// SamosWallet
//
// Created by zys on 2018/8/21.
// Copyright © 2018年 zys. All rights reserved.
//
/**
我的-交易记录、系统设置、关于我们
*/
#import <UIKit/UIKit.h>
@interface SAMMeCell : UITableViewCell
+ (void)registerWith:(UITableView *)tableView;
+ (CGFloat)cellHeight;
- (void)setCellWithTitle:(NSString *)title;
extern NSString *const SAMMeCellID;
@end
|
haichainLab/wallet-ios | SamosWallet/Class/Trade/Controller/SAMReceiveViewController.h | //
// SAMReceiveViewController.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
转入页
*/
#import "SAMBaseTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMReceiveViewController : SAMBaseTableViewController
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/Controller/SAMCoinDetailController.h | <reponame>haichainLab/wallet-ios
//
// SAMCoinDetailController.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
币种详情页:包含余额币时、交易记录列表
*/
#import "SAMBaseTableViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface SAMCoinDetailController : SAMBaseTableViewController
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | Pods/BGFMDB/BGFMDB/libs/BG/BGModelInfo.h | <gh_stars>1-10
//
// BGModelInfo.h
// BGFMDB
//
// Created by huangzhibiao on 17/2/22.
// Copyright © 2017年 Biao. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface BGModelInfo : NSObject
//属性名
@property (nonatomic, copy, readonly) NSString *propertyName;
//属性的类型
@property (nonatomic, copy, readonly) NSString *propertyType;
//属性值
@property (nonatomic, strong, readonly) id propertyValue;
//保存到数据库的列名
@property (nonatomic, copy, readonly) NSString *sqlColumnName;
//保存到数据库的类型
@property (nonatomic, copy, readonly) NSString *sqlColumnType;
//保存到数据库的值
@property (nonatomic, strong, readonly) id sqlColumnValue;
//获取对象相关信息
+(NSArray<BGModelInfo*>*)modelInfoWithObject:(id)object;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Me/View/SAMSelectLanuageSheet.h | <reponame>haichainLab/wallet-ios<filename>SamosWallet/Class/Me/View/SAMSelectLanuageSheet.h
//
// SAMSelectLanuageSheet.h
// SamosWallet
//
// Created by zys on 2018/8/24.
// Copyright © 2018年 zys. All rights reserved.
//
#import "SAMActionSheet.h"
@interface SAMSelectLanuageSheet : SAMActionSheet
+ (instancetype)sheet;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Tool/NSString+encryptionMD5.h | <reponame>haichainLab/wallet-ios
//
// NSString+encryptionMD5.h
// SamosWallet
//
// Created by <NAME> on 2019/12/30.
// Copyright © 2019年 Samos. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (encryptionMD5)
//外部调用,用于字符串加密
+(NSMutableString *)stringMD5:(NSString *)string;
+(NSMutableString *)stringMD5Lower:(NSString *)string;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/Wallet/SAMWalletUtil.h | //
// SAMWalletUtil.h
// SamosWallet
//
// Created by zys on 2018/11/24.
// Copyright © 2018 zys. All rights reserved.
//
/**
钱包相关操作
*/
#import <Foundation/Foundation.h>
@class SAMCoinBalanceInfo;
NS_ASSUME_NONNULL_BEGIN
@interface SAMWalletUtil : NSObject
/**
创建新钱包
@param walletName 钱包名字
@param walletIcon 钱包icon(本地icon名称)
@param walletSeed 助记词
@param token 币种数据
@return 成功YES;失败NO
*/
+ (BOOL)createWalletWithWalletName:(NSString *)walletName
walletIcon:(NSString *)walletIcon
walletSeed:(NSString *)walletSeed
token:(SAMTokenInfo *)token;
/**
添加钱包地址
@param walletID 钱包id
@return 添加成功返回钱包地址;失败则返回nil
*/
+ (NSString *)createAddressWithWalletID:(NSString *)walletID;
/**
删除钱包
@param walletName 钱包名字
@return 删除成功
*/
+ (BOOL)removeWallet:(NSString *)walletName;
/**
修改钱包的名字
@param walletOldName 钱包的旧名字
@param walletNewName 钱包的新名字
@return 修改成功
*/
+ (BOOL)changeWalletName:(NSString *)walletOldName withNewName:(NSString *)walletNewName;
/**
获取钱包助记词
@param walletName 钱包名
@return 助记词
*/
+ (NSString *)fetchWalletSeed:(NSString *)walletName;
/**
检测钱包名是否存在
@return 存在返回YES
*/
+ (BOOL)isWalletExist:(NSString *)walletName;
/**
根据walletID获取这个币种钱包的余额和币时
@param walletID 钱包id
@return 余额和币时
*/
+ (SAMCoinBalanceInfo *)fetchWalletTokenBalanceInfoWithWalletID:(NSString *)walletID;
/**
根据URL获取协议的参数
@param URL
@return 协议参数
*/
+ (NSDictionary *)getUrlParameterWithUrl:(NSURL *)url;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Util/Network/NSString+URL.h | <reponame>haichainLab/wallet-ios
//
// Header.h
// SamosWallet
//
// Created by <NAME> on 2019/10/27.
// Copyright © 2019年 Samos. All rights reserved.
//
//
// NSString+URL.h
//
// Created by aidong on 15/5/8.
// Copyright (c) 2015年 aidong. All rights reserved.
//
/**
* url字符串中具有特殊功能的特殊字符的字符串,或者中文字符,作为参数用GET方式传递时,需要用urlencode处理一下。
*
* 例如:在 iOS 程序访问 HTTP 资源时,像拼出来的 http://unmi.cc?p1=%+&sd f&p2=中文,其中的中文、特殊符号&%和空格都必须进行转译才能正确访问。
*/
/**
* 调用示例:
引入头文件:NSString+URL.h
// URLEncode
NSString *unencodedString = @"cc?p1=%+&sd f&p";
NSString *encodedString = [unencodedString URLEncodedString];
// URLDecode
NSString *undecodedString = @"%25+&sd%20&p2=%E4%B8%AD%E6%96%87";
NSString *decodedString = [undecodedString URLDecodedString];
*/
#import <Foundation/Foundation.h>
@interface NSString (URL)
/**
* URLEncode
*/
- (NSString *)URLEncodedString;
/**
* URLDecode
*/
-(NSString *)URLDecodedString;
@end
|
haichainLab/wallet-ios | SamosWallet/Util/DB/SAMTokenInfo.h | <reponame>haichainLab/wallet-ios<filename>SamosWallet/Util/DB/SAMTokenInfo.h
//
// SAMTokenInfo.h
// SamosWallet
//
// Created by zys on 2018/11/11.
// Copyright © 2018 zys. All rights reserved.
//
/**
支持的token数据(数据库表)
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMTokenInfo : NSObject
/// token全称:samos、skycoin、yongbang、shihu
@property (nonatomic, copy) NSString *tokenName;
/// token简称:SAMO、<KEY>
@property (nonatomic, copy) NSString *token;
/// token图标:icon有两个,以逗号分隔
@property (nonatomic, copy) NSString *tokenIcon;
/// 交易地址,交易地址有两个,以逗号分隔,默认现在一个
@property (nonatomic, copy) NSString *hostApi;
/// 币种的类型,比如SKY/ETH/BTC ...
@property (nonatomic, copy) NSString *tokenType;
/// 是否显示币时
@property (nonatomic, assign) BOOL coinHour;
/// 币显示的顺序
@property (nonatomic, copy) NSString *seq;
@end
NS_ASSUME_NONNULL_END
|
haichainLab/wallet-ios | SamosWallet/Class/Home/View/SAMTradeRecordDetailBottomBar.h | //
// SAMTradeRecordDetailBottomBar.h
// SamosWallet
//
// Created by zys on 2018/12/1.
// Copyright © 2018 zys. All rights reserved.
//
/**
交易记录页bottombar
*/
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SAMTradeRecordDetailBottomBar : UIView
@property (nonatomic, copy) SAMVoidBlock samCopyBlock;
+ (instancetype)bottomBar;
+ (CGFloat)barHeight;
@end
NS_ASSUME_NONNULL_END
|
Subsets and Splits