Restructured locations of source.
This commit is contained in:
parent
78a4c6d730
commit
7c4e8e95e8
151 changed files with 1 additions and 0 deletions
|
|
@ -1,100 +0,0 @@
|
|||
#include "BackupFormatModel.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
|
||||
class BackupFormatItem {
|
||||
public:
|
||||
const QString shortFlag;
|
||||
const QString longFlag;
|
||||
const QString description;
|
||||
|
||||
BackupFormatItem(QString s, QString l, QString d)
|
||||
: shortFlag(std::move(s))
|
||||
, longFlag(std::move(l))
|
||||
, description(std::move(d))
|
||||
{}
|
||||
};
|
||||
|
||||
using t_BackupFormatItemVector = std::vector<BackupFormatItem>;
|
||||
|
||||
|
||||
t_BackupFormatItemVector g_BackupFormats = {
|
||||
BackupFormatItem{ "p", "plain", "Output a plaintext SQL script, restore with psql" },
|
||||
BackupFormatItem{ "c", "custom", "Postgresql's own format most flexible and compressed, restore with pg_restore" },
|
||||
BackupFormatItem{ "d", "directory", "Generates a directory with a file for each table or blob" },
|
||||
BackupFormatItem{ "t", "tar", "Similar to directory if untarred it results in a valid directory backup" }
|
||||
};
|
||||
|
||||
} // end of unnamed namespace
|
||||
|
||||
|
||||
|
||||
BackupFormatModel::BackupFormatModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
//QVariant BackupFormatModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
//{
|
||||
// QVariant result;
|
||||
|
||||
// if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
||||
// switch (section) {
|
||||
// case Column::Short:
|
||||
// result = tr("Short");
|
||||
// break;
|
||||
// case Column::Long:
|
||||
// result = tr("Long");
|
||||
// break;
|
||||
// case Column::Description:
|
||||
// result = tr("Description");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return result;
|
||||
//}
|
||||
|
||||
|
||||
int BackupFormatModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
int size = g_BackupFormats.size();
|
||||
return size;
|
||||
}
|
||||
|
||||
int BackupFormatModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
return 3;
|
||||
|
||||
}
|
||||
|
||||
QVariant BackupFormatModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
QVariant result;
|
||||
if (index.isValid()) {
|
||||
const int row = index.row();
|
||||
const int col = index.column();
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
const auto &item = g_BackupFormats.at(row);
|
||||
switch (col) {
|
||||
case ColumnShort:
|
||||
result = item.shortFlag;
|
||||
break;
|
||||
case ColumnLong:
|
||||
result = item.longFlag;
|
||||
break;
|
||||
case ColumnDescription:
|
||||
result = item.description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (role == Qt::ToolTipRole) {
|
||||
const auto &item = g_BackupFormats.at(row);
|
||||
result = item.description;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue