Skip to content

Commit

Permalink
Change UI
Browse files Browse the repository at this point in the history
  • Loading branch information
olegshtch committed Feb 17, 2011
1 parent 2bf2a28 commit b07d793
Show file tree
Hide file tree
Showing 19 changed files with 759 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = docs po src win32
SUBDIRS = docs po src ui win32

@INTLTOOL_DESKTOP_RULE@

Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ AC_CONFIG_FILES([
src/orm/Makefile
po/Makefile.in
win32/Makefile
ui/Makefile
])

AC_OUTPUT
Expand Down
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ src/notebook_label_widget.cpp
src/table_frame.cpp
src/teachers_frame.cpp
src/time_frame.cpp
ui/main_window.glade

92 changes: 65 additions & 27 deletions po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Table 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-07-12 08:56+0400\n"
"PO-Revision-Date: 2010-06-04 09:24+0300\n"
"POT-Creation-Date: 2011-02-17 22:00+0300\n"
"PO-Revision-Date: 2011-02-17 22:00+0300\n"
"Last-Translator: Oleg Shchelykal'nov <[email protected]>\n"
"Language-Team: Russian\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%"
"10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

#. Glib::RefPtr<Gtk::TreeModel> model = m_ListBox.get_model();
#. Glib::RefPtr<Gtk::ListStore> list_model = Glib::RefPtr<Gtk::ListStore>::cast_dynamic(model);
Expand All @@ -36,58 +37,95 @@ msgstr "Редактировать"
msgid "Edit order"
msgstr "Редактировать порядок"

#: ../src/main_window.cpp:17 ../src/main_window.cpp:183
msgid "Table"
msgstr "Расписание"

#: ../src/main_window.cpp:20
#: ../src/main_window.cpp:48
msgid "File"
msgstr "Файл"

#: ../src/main_window.cpp:27
#: ../src/main_window.cpp:55
msgid "Run"
msgstr "Запуск"

#: ../src/main_window.cpp:32
#: ../src/main_window.cpp:60
msgid "Help"
msgstr "Помощь"

#: ../src/main_window.cpp:117
#: ../src/main_window.cpp:141
msgid "Choose file for saving database:"
msgstr "Выберите файл для хранения базы данных:"

#: ../src/main_window.cpp:140
#: ../src/main_window.cpp:159
msgid "Choose file for opening database:"
msgstr "Выберите файл содержащий базу данных:"

#: ../src/main_window.cpp:189
#: ../src/main_window.cpp:203
msgid "Time"
msgstr "Время"

#: ../src/main_window.cpp:190
#: ../src/main_window.cpp:204
msgid "Auditoruiums"
msgstr "Аудитории"

#: ../src/main_window.cpp:191
#: ../src/main_window.cpp:205
msgid "Teachers"
msgstr "Преподаватели"

#: ../src/main_window.cpp:192
#: ../src/main_window.cpp:206
msgid "Lessons"
msgstr "Занятия"

#: ../src/main_window.cpp:193
#: ../src/main_window.cpp:207
msgid "Groups"
msgstr "Группы"

#: ../src/table_frame.cpp:12
msgid "Choose"
msgstr "Выбрать"
#: ../ui/main_window.glade.h:1
msgid "Hours"
msgstr "Часы"

#: ../ui/main_window.glade.h:2
msgid "Lists"
msgstr "Списки"

#: ../ui/main_window.glade.h:3
msgid "Loading"
msgstr "Нагрузки"

#: ../ui/main_window.glade.h:4
msgid "Schedule"
msgstr "Расписание"

#: ../ui/main_window.glade.h:5
msgid "Table"
msgstr "Расписание"

#: ../ui/main_window.glade.h:6
msgid "_File"
msgstr "_Файл"

#: ../ui/main_window.glade.h:7
msgid "_Help"
msgstr "_Помощь"

#: ../ui/main_window.glade.h:8
msgid "_Schedule"
msgstr "_Расписание"

#: ../ui/main_window.glade.h:9
msgid "toolbutton1"
msgstr "toolbutton1"

#: ../ui/main_window.glade.h:10
msgid "toolbutton2"
msgstr "toolbutton2"

#: ../ui/main_window.glade.h:11
msgid "toolbutton3"
msgstr "toolbutton3"

#~ msgid "Choose"
#~ msgstr "Выбрать"

#: ../src/table_frame.cpp:13
msgid "Set"
msgstr "Разместить"
#~ msgid "Set"
#~ msgstr "Разместить"

#: ../src/table_frame.cpp:14
msgid "Drop"
msgstr "Убрать"
#~ msgid "Drop"
#~ msgstr "Убрать"
10 changes: 8 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ table_SOURCES = auditorium_frame.cpp \
ga/fitness.cpp \
ga/ga.cpp \
ga/individual.cpp \
groups_frame.cpp lessons_widget.cpp lessons_frame.cpp link_list_widget.cpp logbuf.cpp main.cpp main_window.cpp notebook_label_widget.cpp order_dialog.cpp table_frame.cpp teachers_frame.cpp time_frame.cpp
groups_frame.cpp \
lessons_widget.cpp \
lessons_frame.cpp \
link_list_widget.cpp \
logbuf.cpp \
main.cpp main_window.cpp notebook_label_widget.cpp order_dialog.cpp table_frame.cpp teachers_frame.cpp time_frame.cpp
noinst_HEADERS = auditorium_frame.h \
combobox_dialog.h entities_list_widget.h entry_text_dialog.h groups_frame.h lessons_widget.h lessons_frame.h link_list_widget.h logbuf.h main_window.h notebook_label_widget.h shared.h order_dialog.h table_frame.h teachers_frame.h time_frame.h

AM_CXXFLAGS = \
-I$(top_srcdir) \
-DTABLE_LOCALEDIR=\"${TABLE_LOCALEDIR}\" \
-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" \
$(GLIB_CFLAGS)
$(GLIB_CFLAGS) \
-DUIDIR=\"$(pkgdatadir)/ui/\"
table_CXXFLAGS = $(AM_CXXFLAGS)
table_LDADD = \
$(INTLLIBS) \
Expand Down
7 changes: 7 additions & 0 deletions src/db/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ size_t DataBase::GetEntitiesIDs(const DB::Entity& ent, std::vector<size_t> *arra
return SQLExecArray<size_t>(Glib::ustring::compose("SELECT id FROM %1 ORDER BY id", ent.m_TableName), array);
}

Glib::ustring DataBase::GetEntityName(const Entity& ent, int id)
{
Glib::ustring res;
SQLExecString(Glib::ustring::compose("SELECT name FROM %1 WHERE id = %2", ent.m_TableName, id), &res);
return res;
}

bool DataBase::IsLinkBetween(const DB::Link_N2N &link, size_t id_a, size_t id_l)
{
size_t res;
Expand Down
23 changes: 23 additions & 0 deletions src/db/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace DB
void ListEntity(const Entity& ent, Glib::RefPtr<ORM::Table> &list_store);
void DeleteEntity(const Entity& ent, int id);
void EditEntityName(const Entity& ent, int id, const Glib::ustring &new_name);
Glib::ustring GetEntityName(const Entity& ent, int id);

void EditMultithr(const Entity& ent, int id, bool multithr);
void ListEntityAud(const Entity& ent, Glib::RefPtr<ORM::Table> &list_store);
Expand Down Expand Up @@ -83,6 +84,28 @@ namespace DB
return 0;
}

void SQLExecString(const Glib::ustring& sql, Glib::ustring *result)
{
m_Connection.SQLExecOwn(sql, CallbackString, reinterpret_cast<void*>(result));
}

static int CallbackString(void *result, int argc, char **argv, char **col_name)
{
if(! result)
{
throw Glib::Error(1, 0, "Null poiter to result at DB::Callback<Type>.");
}
if(argc != 1)
{
throw Glib::Error(1, 0, "Not 1 columns at DB::Callback<Type>.");
}
Glib::ustring &res = *reinterpret_cast<Glib::ustring*>(result);
std::clog << " [" << col_name[0] << "]=" << argv[0] << std::endl;
res = argv[0];
return 0;
}


template <class Type> size_t SQLExecArray(const Glib::ustring& sql, std::vector<Type> *array)
{
std::pair<size_t, std::vector<Type>*> res;
Expand Down
4 changes: 4 additions & 0 deletions src/ga/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
noinst_HEADERS = fitness.h \
ga.h \
individual.h

26 changes: 26 additions & 0 deletions src/ga/fitness.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,34 @@ struct Fitness
:ind(ind_), errors(errors_), quality(quality_)
{
}

bool operator<(const Fitness& other) const
{
if(errors < other.errors)
{
return true;
}
else
{
if(errors > other.errors)
{
return false;
}
}
return quality < other.quality;
}

const Individual& GetIndividual() const
{
return *ind;
}
std::vector<Individual>::const_iterator GetIter() const
{
return ind;
}
private:
std::vector<Individual>::const_iterator ind;
public:
size_t errors;
size_t quality;
};
Expand Down
Loading

0 comments on commit b07d793

Please sign in to comment.