Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 2dfcc9ca authored by Julien Wintz's avatar Julien Wintz
Browse files

Styling a bit more.

parent a5d597ea
Pipeline #205660 passed with stage
in 0 seconds
......@@ -81,8 +81,6 @@ dtkReferenceFetcher::dtkReferenceFetcher(void)
this->document = QJsonDocument(proxy["response"]["docs"].toArray());
qDebug() << Q_FUNC_INFO << document.toJson();
dirty = false;
});
}
......@@ -108,8 +106,6 @@ void dtkReferenceFetcher::addResultType(QString result_type)
void dtkReferenceFetcher::fetch(void)
{
qDebug() << this->url;
dirty = true;
request->setUrl(QUrl(this-> url));
......@@ -326,10 +322,17 @@ public:
QJsonDocument json() const;
public:
void setAlignment(Qt::AlignmentFlag flag)
{
this->alignment = flag;
}
private:
QJsonValue genJson(dtkReferenceModelItem *) const;
dtkReferenceModelItem * mRootItem;
QStringList mHeaders;
Qt::AlignmentFlag alignment = Qt::AlignLeft;
};
// /////////////////////////////////////////////////////////////////////////////
......@@ -392,7 +395,7 @@ bool dtkReferenceModel::load(const QJsonDocument& document)
return true;
}
qDebug()<<Q_FUNC_INFO<<"cannot load json";
qDebug() << Q_FUNC_INFO << "cannot load json";
return false;
}
......@@ -434,36 +437,33 @@ bool dtkReferenceModel::loadJson(const QJsonObject& json)
QVariant dtkReferenceModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
dtkReferenceModelItem *item = static_cast<dtkReferenceModelItem*>(index.internalPointer());
if (role == Qt::DisplayRole) {
if (index.column() == 0)
return QString("%1").arg(item->key());
if (index.column() == 1)
return QString("%1").arg(item->value());
} else if (Qt::EditRole == role) {
if (index.column() == 1) {
return QString("%1").arg(item->value());
}
} else if (Qt::TextAlignmentRole == role) {
if (index.column() == 0 && this->alignment != Qt::AlignLeft) {
return this->alignment;
}
}
return QVariant();
}
bool dtkReferenceModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
int col = index.column();
if (Qt::EditRole == role) {
if (col == 1) {
dtkReferenceModelItem *item = static_cast<dtkReferenceModelItem*>(index.internalPointer());
......@@ -476,8 +476,6 @@ bool dtkReferenceModel::setData(const QModelIndex &index, const QVariant &value,
return false;
}
QVariant dtkReferenceModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole)
......@@ -628,7 +626,7 @@ private:
dtkReferenceFetcherDialog::dtkReferenceFetcherDialog(void) : QWebEngineView(0)
{
// this->page = new QWebEnginePage;
this->page()->setBackgroundColor(dtkThemesEngine::instance()->color("@bg"));
}
dtkReferenceFetcherDialog::~dtkReferenceFetcherDialog(void)
......@@ -638,7 +636,8 @@ dtkReferenceFetcherDialog::~dtkReferenceFetcherDialog(void)
void dtkReferenceFetcherDialog::setIndex(int index)
{
this->setHtml(QString("<html><body><h1>%1</h1><br/><br/><p>There will be some results</p></body></html>").arg(index));
this->setHtml(QString("<html><head><style>body { color: %2; }</style></head><body><h1>%1</h1><br/><br/><p>There will be some results</p></body></html>").arg(index).arg(dtkThemesEngine::instance()->value("@fg")));
this->page()->setBackgroundColor(dtkThemesEngine::instance()->color("@bg"));
}
void dtkReferenceFetcherDialog::setFetcher(dtkReferenceFetcher *fetcher)
......@@ -736,26 +735,33 @@ int main(int argc, char **argv)
// Fetcher (Ux Part - Model)
// /////////////////////////////////////////////////////////////////////////////
dtkReferenceModel model_p;
dtkReferenceModel model;
model.setAlignment(Qt::AlignCenter);
model.load(fetcher.document);
dtkReferenceModel model_p;
if (model.rowCount())
model_p.loadJson(fetcher.document.array().at(0).toObject());
QTableView view_a;
view_a.setModel(&model_p);
view_a.setAlternatingRowColors(true);
view_a.horizontalHeader()->setStretchLastSection(true);
view_a.verticalHeader()->hide();
QListView view_l;
view_l.setModel(&model);
view_l.setAlternatingRowColors(true);
view_l.setFixedWidth(80);
view_l.setStyleSheet("QListView::item { min-height: 30; }");
dtkReferenceSearchBar *search = new dtkReferenceSearchBar;
search->setText("authLastName_t:Kloczko");
dtkReferenceFetcherDialog fetcher_dialog;
fetcher_dialog.setFetcher(&fetcher);
fetcher_dialog.setFixedHeight(400);
fetcher_dialog.setMinimumHeight(200);
fetcher_dialog.setIndex(0);
QVBoxLayout *layout_i = new QVBoxLayout;
layout_i->setContentsMargins(0, 0, 0, 0);
......@@ -811,9 +817,7 @@ int main(int argc, char **argv)
fetcher.addResultType("json");
fetcher.fetch();
qDebug() << fetcher.document.toJson();
model.load(fetcher.document); // TODO: Beurk
model.load(fetcher.document);
view_l.setModel(&model);
view_a.setModel(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment