Replace notes dialog with a page.

This commit is contained in:
Petr Mrázek
2014-06-18 01:15:01 +02:00
parent 702e00e059
commit d911c9908c
9 changed files with 124 additions and 164 deletions

35
gui/pages/NotesPage.cpp Normal file
View File

@ -0,0 +1,35 @@
#include "NotesPage.h"
#include "ui_NotesPage.h"
QString NotesPage::displayName()
{
return tr("Notes");
}
QIcon NotesPage::icon()
{
return QIcon::fromTheme("news");
}
QString NotesPage::id()
{
return "notes";
}
NotesPage::NotesPage(BaseInstance *inst, QWidget *parent)
: QWidget(parent), ui(new Ui::NotesPage), m_inst(inst)
{
ui->setupUi(this);
ui->noteEditor->setText(m_inst->notes());
}
NotesPage::~NotesPage()
{
delete ui;
}
bool NotesPage::apply()
{
m_inst->setNotes(ui->noteEditor->toPlainText());
return true;
}

45
gui/pages/NotesPage.h Normal file
View File

@ -0,0 +1,45 @@
/* Copyright 2014 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QWidget>
#include <logic/BaseInstance.h>
#include <logic/net/NetJob.h>
#include "BasePage.h"
class EnabledItemFilter;
namespace Ui
{
class NotesPage;
}
class NotesPage : public QWidget, public BasePage
{
Q_OBJECT
public:
explicit NotesPage(BaseInstance *inst, QWidget *parent = 0);
virtual ~NotesPage();
virtual QString displayName() override;
virtual QIcon icon() override;
virtual QString id() override;
virtual bool apply();
virtual QString helpPage() override { return "Notes"; };
private:
Ui::NotesPage *ui;
BaseInstance *m_inst;
};

46
gui/pages/NotesPage.ui Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotesPage</class>
<widget class="QWidget" name="NotesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTextEdit" name="noteEditor">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>