2011-01-05 22:24:11 +01:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
2014-10-04 20:04:03 +02:00
|
|
|
* and is distributed under the 2-Clause BSD licence.
|
|
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2014-02-12 17:30:49 +01:00
|
|
|
* Copyright (c) 2010-2014, Tomasz Sowa
|
2011-01-05 22:24:11 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2014-10-04 20:04:03 +02:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2011-01-05 22:24:11 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef headerfile_winix_plugins_thread_threadinfo
|
|
|
|
#define headerfile_winix_plugins_thread_threadinfo
|
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
#include <vector>
|
|
|
|
#include "core/item.h"
|
|
|
|
#include "core/system.h"
|
2011-01-24 00:23:24 +01:00
|
|
|
#include "db/db.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "tdb.h"
|
2018-11-21 18:51:15 +01:00
|
|
|
#include "core/winixmodel.h"
|
|
|
|
|
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
2011-01-20 19:37:51 +01:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
|
|
|
|
namespace Thread
|
|
|
|
{
|
|
|
|
|
2018-11-21 18:51:15 +01:00
|
|
|
class ThreadInfo : public WinixModel
|
2011-01-20 19:37:51 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
2011-01-24 00:23:24 +01:00
|
|
|
void SetDb(Db * pdb);
|
|
|
|
void SetTDb(TDb * ptdb);
|
2011-01-20 19:37:51 +01:00
|
|
|
void SetSystem(System * psystem);
|
2011-01-24 00:23:24 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
void Clear();
|
|
|
|
Item * FindThreadDir();
|
|
|
|
|
2011-01-24 00:23:24 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
// id of a mount type
|
|
|
|
int mount_type_thread;
|
|
|
|
|
|
|
|
// enable a thread in a specific directory
|
|
|
|
// and set sort type (asc, desc)
|
|
|
|
int mount_par_thread;
|
|
|
|
|
|
|
|
// a special directory in which we store the answers
|
|
|
|
int mount_par_thread_dir;
|
|
|
|
|
|
|
|
// id of the current plugin
|
|
|
|
int plugin_id;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
// files in the current directory
|
|
|
|
// used for 'show_threads' or 'thread' function
|
|
|
|
std::vector<Item> item_tab;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
// additional info to the above files if 'show_threads' is used
|
|
|
|
// sorted by file_id
|
|
|
|
std::vector<Thread> thread_tab;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
// for sorting
|
|
|
|
std::vector<Item*> item_sort_tab;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
// template index for notifications
|
|
|
|
size_t template_index;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-24 00:23:24 +01:00
|
|
|
|
|
|
|
void RemoveThread(long file_id);
|
2011-03-23 18:54:53 +01:00
|
|
|
void RemoveThreadAnswer(long answer_id);
|
2011-01-24 00:23:24 +01:00
|
|
|
|
2011-03-23 18:54:53 +01:00
|
|
|
// repairing the database
|
|
|
|
void Repair();
|
2011-01-24 00:23:24 +01:00
|
|
|
|
2012-09-14 09:14:54 +02:00
|
|
|
void MakeRedirectIfPossible(const Item & item);
|
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
private:
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-24 00:23:24 +01:00
|
|
|
Db * db;
|
|
|
|
TDb * tdb;
|
2011-01-20 19:37:51 +01:00
|
|
|
System * system;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
std::vector<Item*> out_dir_tab;
|
2011-03-23 18:54:53 +01:00
|
|
|
std::vector<long> remove_answer_id_tab, repair_id_tab, repair_answer_tab;
|
|
|
|
Item out_item, repair_item;
|
|
|
|
DbItemQuery iq;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-03-23 18:54:53 +01:00
|
|
|
void RepairAnswer(long answer_id);
|
|
|
|
void RepairAnswers(long file_id);
|
|
|
|
void Repair(long file_id);
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
};
|
2011-01-05 22:24:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
} // namespace Winix
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|