ShredDialog::ShredDialog(ShredManager *plugin, QDialog *parent)
    :QDialog(parent)
{
    setWindowFlags(Qt::FramelessWindowHint);
    this->setStyleSheet("QDialog{border: 1px solid gray;border-radius:2px}");//设定边框宽度以及颜色
    this->setWindowIcon(QIcon(":/res/youker-assistant.png"));
    this->setFixedSize(500, 471);
    process_plugin = plugin;

    title_bar = new KylinTitleBar();
    initTitleBar();

    toolkits = new Toolkits(0, this->width(), this->height());

    select_edit = new QLineEdit();
    select_edit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");
    select_edit->setFixedWidth(400);
    select_edit->setReadOnly(true);
    select_btn = new KylinEditButton(select_edit);
    shred_btn = new QPushButton();
    cacel_btn = new QPushButton();
    shred_btn->setFixedSize(91, 25);
    shred_btn->setObjectName("blackButton");
    shred_btn->setFocusPolicy(Qt::NoFocus);
    cacel_btn->setFixedSize(91, 25);
    cacel_btn->setObjectName("blackButton");
    cacel_btn->setFocusPolicy(Qt::NoFocus);

    QHBoxLayout *layout1 = new QHBoxLayout();
    layout1->addStretch();
    layout1->addWidget(select_edit);
    layout1->addStretch();

    QHBoxLayout *layout2 = new QHBoxLayout();
    layout2->addStretch();
    layout2->addWidget(shred_btn);
    layout2->addWidget(cacel_btn);
    layout2->addStretch();
    layout2->setMargin(0);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addStretch();
    layout->addLayout(layout1);
    layout->addLayout(layout2);
    layout->addStretch();
    layout->setSpacing(10);

    QVBoxLayout *main_layout = new QVBoxLayout();
    main_layout->addWidget(title_bar);
    main_layout->addLayout(layout);
    main_layout->setSpacing(20);
    main_layout->setMargin(0);
    main_layout->setContentsMargins(0, 0, 0, 0);
    setLayout(main_layout);

    this->setLanguage();
    this->initConnect();
}
FileSystemBrowser::FileSystemBrowser():
    View(),
    _workspacePath( "/" )
{
    setWindowTitle( "File System" );
    
    initTitleBar();
    
    initMenu();
    
    initContent();
}
KylinFontDialog::KylinFontDialog(/*QSettings *mSettings, QString flag, */QString cur_font, QString skin, QWidget *parent) :
    QDialog(parent)
{
    this->setFixedSize(600, 500);
    this->setStyleSheet("QDialog{border: 1px solid white;border-radius:1px;background-color: #ffffff;}");
    this->setWindowIcon(QIcon(":/res/youker-assistant.png"));
    this->setAttribute(Qt::WA_DeleteOnClose);
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAutoFillBackground(true);

    title_bar = new KylinTitleBar();
    initTitleBar(skin);

    cur_tip_label = new QLabel();
    cur_font_label = new QLabel();
    font_label = new QLabel();
    style_label = new QLabel();
    size_label = new QLabel();
    font_edit = new QLineEdit();
    style_edit = new QLineEdit();
    size_edit = new QLineEdit();
    font_view = new QListView();
    style_view = new QListView();
    size_view = new QListView();
    sample_label = new QLabel();
    sample_edit = new QLineEdit();
    ok_btn = new QPushButton();
    cacel_btn = new QPushButton();
    ok_btn->setFixedSize(91, 25);
    ok_btn->setObjectName("blackButton");
    ok_btn->setFocusPolicy(Qt::NoFocus);
    cacel_btn->setFixedSize(91, 25);
    cacel_btn->setObjectName("blackButton");
    cacel_btn->setFocusPolicy(Qt::NoFocus);
    font_edit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");
    style_edit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");
    size_edit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");
    sample_edit->setStyleSheet("QLineEdit{border:1px solid #bebebe;}");

    style_label->setFixedWidth(140);
    style_edit->setFixedWidth(140);
    style_view->setFixedWidth(140);
    size_label->setFixedWidth(60);
    size_edit->setFixedWidth(60);
    size_view->setFixedWidth(60);

    font_edit->setReadOnly(true);
    font_edit->setFocusProxy(font_view);
    font_label->setBuddy(font_view);
    style_edit->setReadOnly(true);
    style_edit->setFocusProxy(style_view);
    style_label->setBuddy(style_view);
    size_edit->setReadOnly(true);
    size_edit->setFocusProxy(size_view);
    size_label->setBuddy(size_view);
    sample_edit->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    sample_edit->setAlignment(Qt::AlignCenter);

    QHBoxLayout *layout1 = new QHBoxLayout();
    layout1->addWidget(cur_tip_label);
    layout1->addWidget(cur_font_label);
    layout1->addStretch();
    layout1->setSpacing(5);
    layout1->setMargin(0);
    layout1->setContentsMargins(10, 0, 0, 0);

    QVBoxLayout *layout2 = new QVBoxLayout();
    layout2->addWidget(font_label);
    layout2->addWidget(font_edit);
    layout2->addWidget(font_view);

    QVBoxLayout *layout3 = new QVBoxLayout();
    layout3->addWidget(style_label);
    layout3->addWidget(style_edit);
    layout3->addWidget(style_view);

    QVBoxLayout *layout4 = new QVBoxLayout();
    layout4->addWidget(size_label);
    layout4->addWidget(size_edit);
    layout4->addWidget(size_view);

    QHBoxLayout *layout5 = new QHBoxLayout();
    layout5->addLayout(layout2);
    layout5->addLayout(layout3);
    layout5->addLayout(layout4);
    layout5->setSpacing(10);
    layout5->setMargin(0);
    layout5->setContentsMargins(10, 0, 10, 0);

    QVBoxLayout *layout6 = new QVBoxLayout();
    layout6->addWidget(cacel_btn);
    layout6->addWidget(ok_btn);

    QHBoxLayout *layout7 = new QHBoxLayout();
    layout7->addWidget(sample_edit);
//    layout7->addStretch();
    layout7->addLayout(layout6);

    QVBoxLayout *layout8 = new QVBoxLayout();
    layout8->addWidget(sample_label);
    layout8->addLayout(layout7);
    layout8->setSpacing(5);
    layout8->setMargin(0);
    layout8->setContentsMargins(10, 0, 10, 10);

    QVBoxLayout *main_layout = new QVBoxLayout();
    main_layout->addWidget(title_bar);
    main_layout->addLayout(layout1);
    main_layout->addLayout(layout5);
    main_layout->addLayout(layout8);
    main_layout->setSpacing(5);
    main_layout->setMargin(0);
    main_layout->setContentsMargins(0, 0, 0, 0);
    setLayout(main_layout);
    cur_font_label->setText(cur_font);

    familymodel = new QStringListModel;
    stylemodel = new QStringListModel;
    sizemodel = new QStringListModel;

    this->initDialog();//初始化字体对话框
    this->setLanguage();
    this->initConnect();
}